File: Games\GamesByEmail.js

GamesByEmail
Class Pieces

Array
  
 
 
GamesByEmail.Pieces

All Implemented Interfaces:

Class


GamesByEmail.Pieces

extends Array
implements Foundation.Class

A collection of pieces in a game, like chess. May be used directly or extended. Implemented as an Array.

See Also:

GamesByEmail.Piece

Constructor Summary
GamesByEmail.Pieces(/*Game*/ game)
Creates a piece collection.

Field Summary
Gamegame
The parent game object.

Fields inherited from Array
length

Method Summary
StringBuilderappendHiliteHtml(/*StringBuilder*/ htmlBuilder)
Adds the necessary HTML to display highlights for the pieces collection. To be overridden by each game class as necessary.
StringBuilderappendHtml(/*StringBuilder*/ htmlBuilder, /*Point*/ boardSize)
Adds the necessary HTML to display the pieces collection, wrapped in a container element for positioning.
StringBuilderappendInnerHtml(/*StringBuilder*/ htmlBuilder)
Adds the necessary HTML to display the pieces collection.
voidcancelFlashes()
Cancels all flashing pieces.
voidclear()
Removes all pieces from the collection.
NumbercountColor(/*Number*/ color)
Gets the number of pieces of a color.
 dispose()
PiecefindAtPoint(/*Point*/ boardPoint)
Finds the piece in the collection located at a board point.
voidflash(/*Number*/ numFlashes, /*String*/ doneCode, /*Point|Array*/ boardPoint, ...)
Flashes one or more pieces a specified number of times, then invokes code.
PiecegetNewPiece()
Gets the extra piece object in the collection for adding new pieces to the board in games like Reversi and Go.
StringgetValue()
Gets the combined value of all the pieces in the collection, extra piece object in the collection for adding new pieces to the board in games like Reversi and Go.
voidsetValue(/*String*/ value)
Sets the value for the entire pieces collection. The collection is cleared, and new pieces are added for non-blank characters. An extra piece is always added, see getNewPiece.

Methods inherited from Array
indexOf

Methods inherited from Foundation.Class
getTypePath, isInstanceOf

Constructor Detail

Pieces

GamesByEmail.Pieces(/*Game*/ game)

Creates a piece collection.

Parameters:
game - 
The parent game object.

Field Detail

game

Game game

The parent game object.

Method Detail

appendHiliteHtml

StringBuilder appendHiliteHtml(/*StringBuilder*/ htmlBuilder)

Adds the necessary HTML to display highlights for the pieces collection. To be overridden by each game class as necessary.

Parameters:
htmlBuilder - 
The HTML builder to append to.
Returns:
The html builder after appending.

appendHtml

StringBuilder appendHtml(/*StringBuilder*/ htmlBuilder,
                         /*Point*/ boardSize)

Adds the necessary HTML to display the pieces collection, wrapped in a container element for positioning.

Parameters:
htmlBuilder - 
The HTML builder to append to.
boardSize - 
The size of the board on which the pieces will be overlayed.
Returns:
The html builder after appending.

appendInnerHtml

StringBuilder appendInnerHtml(/*StringBuilder*/ htmlBuilder)

Adds the necessary HTML to display the pieces collection.

Parameters:
htmlBuilder - 
The HTML builder to append to.
Returns:
The html builder after appending.

cancelFlashes

void cancelFlashes()

Cancels all flashing pieces.


clear

void clear()

Removes all pieces from the collection.


countColor

Number countColor(/*Number*/ color)

Gets the number of pieces of a color.

Parameters:
color - 
The color to look for.
Returns:
The number of pieces of the color.

dispose

dispose()
Overrides:
dispose in class Class

findAtPoint

Piece findAtPoint(/*Point*/ boardPoint)

Finds the piece in the collection located at a board point.

Parameters:
boardPoint - 
The board point to search.
Returns:
The piece at the board point, or null.

flash

void flash(/*Number*/ numFlashes,
           /*String*/ doneCode,
           /*Point|Array*/ boardPoint,
           ...)

Flashes one or more pieces a specified number of times, then invokes code.

Parameters:
numFlashes - 
The number of times to flash the pieces on and off.
doneCode - 
The code to execute when the flashing is complete. Generally created with the game.event method.
boardPoint - 
(Repeatable) The board point(s) and/or arrays of board points of the piece to flash.

getNewPiece

Piece getNewPiece()

Gets the extra piece object in the collection for adding new pieces to the board in games like Reversi and Go.

Returns:
The new piece.

getValue

String getValue()

Gets the combined value of all the pieces in the collection, extra piece object in the collection for adding new pieces to the board in games like Reversi and Go.

Returns:
The combined value, typically for setting game.info.board.

setValue

void setValue(/*String*/ value)

Sets the value for the entire pieces collection. The collection is cleared, and new pieces are added for non-blank characters. An extra piece is always added, see getNewPiece.

Parameters:
value - 
The value, usually from game.info.board.