Games\CaptureTheFlag\Game.jsGamesByEmailObject
GamesByEmail.Game
All Implemented Interfaces:
GamesByEmail.CaptureTheFlagGame
extendsGame
| Constructor Summary |
|
| Enum Summary | |
static | PIECE_TYPE
|
| Field Summary | |
static | resourcePack
Resources for most of the game. Override to add resources specific to game.
|
static | setupSuggestions
|
static | unsetupLayout
|
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 | |
|
|
|
|
|
|
|
|
|
Checks to see if a move is legal. By default calls
isMoveLegal. |
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gets the HTML for the team title on the board. By default uses resources 'turnTeamTitle' or 'teamTitle'.
|
|
Override to handle move collisions from concurrent turns.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
Called when needing the offer-a-draw-with-this-move prompts HTML (typically a short sentence and a Offer A Draw checkbox). Override to set. Internally uses the "youMayOfferDraw" and "offerDrawWithThisMove" resources.
|
|
|
|
|
|
|
|
|
|
|
|
Gets called when the sending moves, fir processing secure move data on the client. Override to process secure data.
|
|
|
|
|
|
|
|
|
|
|
|
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 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. |
|
|
|
|
|
|
|
|
|
Called when needing the undo-this-move prompts HTML (typically a short sentence and an Undo button). Override to set. Internally uses the "youMayUndoYourMove" resource.
|
|
|
|
Updates the team titles, the game header, the game title, all prompts and action links.
|
|
|
|
|
|
|
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.CaptureTheFlagGame()
| Enum Detail |
static PIECE_TYPE
HIDDEN -
MOVED -
MOVED_2 -
MOVED_2_PLUS -
MOVED_3_PLUS -
FLAG -
BOMB -
MARSHAL -
GENERAL -
COLONEL -
MAJOR -
CAPTAIN -
LIEUTENANT -
SERGEANT -
MINER -
SCOUT -
SPY -
ATTACK -
UNKNOWN -
| Field Detail |
static Object resourcePack
Resources for most of the game. Override to add resources specific to game.
Overrides:resourcePack in class Game
static setupSuggestions
static unsetupLayout
| Method Detail |
addToTaken(team,
piece)
team -
piece -
apparentValueFromMove(fromPoint,
toPoint,
publicBoard,
privateBoard)
fromPoint -
toPoint -
publicBoard -
privateBoard -
areThereMultipleUnknownPieces(defaultValue,
publicBoard,
privateBoard)
defaultValue -
publicBoard -
privateBoard -
canMoveFrom(fromPoint,
board,
color)
fromPoint -
board -
color -
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.
checkSetupMove(toPoint,
fromPoint)
toPoint -
fromPoint -
clearSetup()
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.
convertBoardValueToSetup(boardValue)
boardValue -
convertSetupToBoardValue(setup,
color)
setup -
color -
dispose()
dragByClicks(up,
origPoint,
screenPoint)
up -
origPoint -
screenPoint -
flipSetup()
getAttackBoardHtml(attackerColor,
attackerPoint,
defenderPoint,
newAttack,
forceResolution)
attackerColor -
attackerPoint -
defenderPoint -
newAttack -
forceResolution -
getAttackInfo(team,
boardPoint)
team -
boardPoint -
getAttackPiece()
getCombinedBoardState()
getStartBoard(color)
color -
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 handleMoveCollision(/*Object*/ gameData,
/*Array*/ collisionMoves)
Override to handle move collisions from concurrent turns.
Overrides:handleMoveCollision in class GamegameData -The most current gameData on the server. This is the state the collision moves must be merged into.
collisionMoves -The list of moves that generated the collision.
Example:
handleMoveCollision:function(gameData,collisionMoves)
{
var lastCollisionMove=collisionMoves[collisionMoves.length-1];
this.importRawGame(gameData);
//make same moves as lastCollisionMove
this.sendMove();
}
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);
}
isExactValueUnknown(value)
value -
isLake(boardPoint)
boardPoint -
isMoveLegal(toPoint,
fromPoint,
board,
color)
toPoint -
fromPoint -
board -
color -
isMoveablePiece(piece)
piece -
isSetupChoked(board,
color)
board -
color -
isSetupComplete(board,
color)
board -
color -
isSetupFilled(board,
color)
board -
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.
makeColorHidden(value,
color)
value -
color -
mouseDown(screenPoint)
screenPoint -
mouseMove(screenPoint)
screenPoint -
mouseUp(screenPoint)
screenPoint -
noteAttackResults(attackerInfo,
defenderInfo)
attackerInfo -
defenderInfo -
String offerDrawHtml(/*String*/ resourceName)
Called when needing the offer-a-draw-with-this-move prompts HTML (typically a short sentence and a Offer A Draw checkbox). Override to set. Internally uses the "youMayOfferDraw" and "offerDrawWithThisMove" resources.
Overrides:offerDrawHtml in class GameresourceName -(Optional) A resource name to override the default resource to use.
offsetStartBoard(board,
color)
board -
color -
parsePlayOptions(optionString)
optionString -
pathThroughLake(fromPoint,
toPoint)
fromPoint -
toPoint -
pieceNotation(pieceChar)
pieceChar -
pieceTypeRange(pieceType,
diagonal)
pieceType -
diagonal -
Boolean processSecureMove(/*GamesByEmail*/ game)
Gets called when the sending moves, fir processing secure move data on the client. Override to process secure data.
Overrides:processSecureMove in class Gamegame -The game object to process.
false.
rankApparentValue(value)
value -
resolveAttack(index,
color1,
remove1,
color2,
remove2)
index -
color1 -
remove1 -
color2 -
remove2 -
resolveAttackHtml()
resolveAttackPart(index,
piece,
color,
remove)
index -
piece -
color -
remove -
reverseString(value)
value -
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.
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.
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.
settingUpHtml()
setupDragByClicks(up,
origPoint,
screenPoint)
up -
origPoint -
screenPoint -
setupMouseDown(screenPoint)
screenPoint -
setupMouseMove(screenPoint)
screenPoint -
setupMouseUp(screenPoint)
screenPoint -
showHilites()
sortSetupForDisplay(setup)
setup -
spaceNotation(x,
y)
x -
y -
void synch()
Called when the game should synchronize with info properties from the server.
void synchTeam(/*Team*/ team)
Called to synchronize the team properties with the raw team data. Just the color and title properties are set by default, override to set more.
team -The team to synchronize.
teamCanMove(team)
team -
teamsNeedToSetup()
void undo(/*Boolean*/ skipUpdate)
Undos all moves since the last synch method call. The synch and update methods will be called again.
skipUpdate -(Optional) Skips the update call if true. Defaults to false.
String undoMoveHtml(/*String*/ resourceName)
Called when needing the undo-this-move prompts HTML (typically a short sentence and an Undo button). Override to set. Internally uses the "youMayUndoYourMove" resource.
Overrides:undoMoveHtml in class GameresourceName -(Optional) A resource name to override the default resource to use.
unshiftSetup(board,
color)
board -
color -
void update()
Updates the team titles, the game header, the game title, all prompts and action links.
Overrides:
updateAttackBoard()
updateRescuerIndices(team,
fromIndex,
toIndex)
team -
fromIndex -
toIndex -
useSetupSuggestion(setup)
setup -