Games\X\Game.jsGamesByEmailObject
GamesByEmail.Game
All Implemented Interfaces:
GamesByEmail.XGame
extendsGame
implementsGamesByEmail.Hex
| Nested Class Summary | |
static | XGame.MoveData
|
| Constructor Summary |
|
| Field Summary | |
static | resourcePack
Resources for most of the game. Override to add resources specific to game.
|
Fields inherited from GamesByEmail.Game |
board, canPie, constrainer, font, id, info, isLog, lastMove, logSettings, maxMoveNumber, message, move, notify, onLeftMouseDown, onLeftMouseUp, onMiddleMouseDown, onMiddleMouseUp, onMouseDown, onMouseMove, onMouseOut, onMouseOver, onMouseUp, onRightMouseDown, onRightMouseUp, pieces, previewing, rotation, status, teams, territories, testing, title, type, verbose |
Fields inherited from Foundation.Elemental |
$Foundation_$registry_index |
| Method Summary | |
|
Gets the board value from a value and color. By default, the value is returned if color is zero, else the upper case of the value is returned.
|
|
|
|
|
|
|
|
|
|
|
|
Checks to see if a move is legal. By default calls
isMoveLegal. |
|
|
|
Gets the color from a board value. By default, lower case characters return 0, uppercase 1, and everything else -1.
|
|
|
|
Called when needing the complete-your-turn game prompt HTML (typically a short sentence about the move and a Send This Move button). Override and set mouse events here. Internally uses the "completeYourTurn" resource.
|
|
|
|
|
|
|
|
|
|
|
|
Orders the players for the next game. By default the user information is reversed.
|
|
|
|
|
|
Gets the HTML for the team title on the board. By default uses resources 'turnTeamTitle' or 'teamTitle'.
|
|
The first method to be called when a game is created, override to set up teams, players and the game state.
|
|
|
|
Called when needing the it-is-your-turn game prompt HTML (typically a short sentence about the move). Override and set mouse events here. Internally uses the "itIsYourTurnToMove" resource.
|
static |
|
|
|
|
|
|
|
|
|
|
Called when needing the you-may-resign prompt HTML (typically a short sentence about resiging and a Resign button). Override to set. Internally uses the "youMayResign" resource.
|
|
Gets called when the Send Move button is pushed. Override and set the game state, then call Super.sendMove.
|
|
|
|
Called when synchronizing, sets the perspective of the board based on the player. By default sets the
rotation property to 0. |
|
|
|
|
|
Called when the game should synchronize with
info properties from the server. |
|
Updates the top and bottom team title rows.
|
|
Gets the value from a board value. By default, the lower case of the board value is returned.
|
Methods inherited from GamesByEmail.Hex |
boardPointFromScreenXY, boardPointFromValueIndex, forEachBoardPoint, numInPath, screenRectFromBoardXY, valueIndexFromBoardXY |
Methods inherited from Foundation.Class |
getTypePath, isInstanceOf |
Methods inherited from Foundation.Elemental |
attachEvent, detachEvent, elementId, event, getById, getElement, getElementValue, getElements, getFirst, getNext, parseElementId, processHtml, processHtml |
Methods inherited from Foundation.Resourceful |
resource, resource, resourceUrl, resourceUrl |
Methods inherited from Foundation.Server |
server, serverSerialized, serverSynchronous |
| Constructor Detail |
GamesByEmail.XGame()
| Field Detail |
static Object resourcePack
Resources for most of the game. Override to add resources specific to game.
Overrides:resourcePack in class Game| Method Detail |
String boardValueFromValueColor(/*String*/ value,
/*Number*/ color)
Gets the board value from a value and color. By default, the value is returned if color is zero, else the upper case of the value is returned.
Overrides:boardValueFromValueColor in class Gamevalue -The value.
color -The color.
checkEdges()
checkForPotentialOtherWinner(winner,
board)
winner -
board -
checkForPotentialOtherWinnerColor(winner,
color,
board)
winner -
color -
board -
checkForPotentialOtherWinners(winners,
board)
winners -
board -
checkForWinner(moveData)
moveData -
Boolean checkMove(/*Point*/ toPoint,
/*Point*/ fromPoint)
Checks to see if a move is legal. By default calls isMoveLegal.
toPoint -The board point moving to.
fromPoint -The board point moving from.
true if the move is legal.
colorCanUsePointForPath(board,
color,
point,
canUseClears)
board -
color -
point -
canUseClears -
Number colorFromBoardValue(/*String*/ boardValue)
Gets the color from a board value. By default, lower case characters return 0, uppercase 1, and everything else -1.
Overrides:colorFromBoardValue in class GameboardValue -The value to check, by default a single character.
coloredPathExistsFromPointToPoint(board,
color,
p1,
p2,
canUseClears)
board -
color -
p1 -
p2 -
canUseClears -
String completeYourTurnHtml(/*String*/ resourceName)
Called when needing the complete-your-turn game prompt HTML (typically a short sentence about the move and a Send This Move button). Override and set mouse events here. Internally uses the "completeYourTurn" resource.
Overrides:completeYourTurnHtml in class GameresourceName -(Optional) A resource name to override the default resource to use.
dispose()
getEdgeWinner(board,
edge)
board -
edge -
getEdgeWinners(board)
board -
getEdges()
getMoveData(board)
board -
Array getNewGamePlayerOrder(/*Array*/ userInfo)
Orders the players for the next game. By default the user information is reversed.
Overrides:getNewGamePlayerOrder in class GameuserInfo -An array of user information as currently in this game.
getTeamCorners(team)
team -
getTeamScore(team)
team -
String getTeamTitleHtml(/*Team*/ team,
/*Boolean*/ top)
Gets the HTML for the team title on the board. By default uses resources 'turnTeamTitle' or 'teamTitle'.
Overrides:getTeamTitleHtml in class Gameteam -The team to get the color for.
top -Whether this team's title will be displayed above the board or below.
void initialize(/*Number*/ numPlayers,
/*Number*/ turnTeamIndex)
The first method to be called when a game is created, override to set up teams, players and the game state.
Overrides:initialize in class GamenumPlayers -The number of players from the game form.
turnTeamIndex -The index of the team to set the initial turn. Call the Super with -1 to set all teams turn.
Example:
// Override initialize
initialize:function(numPlayers,turnTeamIndex)
{
// Call the Super.initialize to add default teams.
Super.initialize(numPlayers,turnTeamIndex);
// Initialize the board state.
this.info["board"]="rnbqkbnrpppppppp PPPPPPPPRNBQKBNR";
var team=this.teams[0];
team.info["i_ep"]=-1;
team.info["b_cs"]=true;
team.info["b_cl"]=true;
team=this.teams[1];
team.info["i_ep"]=-1;
team.info["b_cs"]=true;
team.info["b_cl"]=true;
// Log the start of game.
this.move.log=this.logEntry(44);
}
isMoveLegal(point,
moveData,
color)
point -
moveData -
color -
String itsYourTurnHtml(/*String*/ resourceName)
Called when needing the it-is-your-turn game prompt HTML (typically a short sentence about the move). Override and set mouse events here. Internally uses the "itIsYourTurnToMove" resource.
Overrides:itsYourTurnHtml in class GameresourceName -(Optional) A resource name to override the default resource to use.
static joe()
mouseDown(screenPoint)
screenPoint -
mouseMove(screenPoint)
screenPoint -
mouseOut(screenPoint)
screenPoint -
mouseOver(screenPoint)
screenPoint -
String resignHtml(/*String*/ resourceName)
Called when needing the you-may-resign prompt HTML (typically a short sentence about resiging and a Resign button). Override to set. Internally uses the "youMayResign" resource.
Overrides:resignHtml in class GameresourceName -(Optional) A resource name to override the default resource to use.
Boolean sendMove(/*Boolean*/ sendNow,
/*Player*/ player)
Gets called when the Send Move button is pushed. Override and set the game state, then call Super.sendMove.
Overrides: Parameters:sendNow -(Optional) Send the moves to the server now. Else, save the move for sending later. Defaults to
true.player -(Optional) The player responsible for the move. Defaults to the current player (game.player).
true.
setMoveData(moveData)
moveData -
void setPerspective(/*Team*/ team)
Called when synchronizing, sets the perspective of the board based on the player. By default sets the rotation property to 0.
setPerspective in class Gameteam -The team to synchronize.
showHilites(hilites)
hilites -
spaceNotation(x,
y)
x -
y -
void synch()
Called when the game should synchronize with info properties from the server.
void updateTeamTitles()
Updates the top and bottom team title rows.
Overrides:updateTeamTitles in class Game
String valueFromBoardValue(/*String*/ boardValue)
Gets the value from a board value. By default, the lower case of the board value is returned.
Overrides:valueFromBoardValue in class GameboardValue -The value to check, by default a single character.