Games\Scribe\Game.js
GamesByEmail
Object
GamesByEmail.Game
All Implemented Interfaces:
GamesByEmail.ScribeGame
extendsGame
Nested Class Summary | |
static | ScribeGame.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 point from a screen coordinates.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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 it-is-not-your-turn game prompt HTML (typically a short sentence with Send Reminder, Refresh Game and Close Window buttons Start Another Game button). Override to set. Internally uses the "notYourTurn" resource.
|
|
|
|
|
|
|
|
Gets the screen rectangle from board coordinates.
|
|
Gets called when the Send Move button is pushed. Override and set the game state, then call Super.sendMove.
|
|
|
|
|
|
|
|
Called when the game should synchronize with
info properties from the server. |
|
Called when needing the you-lose game prompts HTML. Override to set. Internally uses the "youLose" resource.
|
|
Called when needing the you-win game prompts HTML. Override to set. Internally uses the "youWin" resource.
|
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.ScribeGame()
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 |
arePointsAdjacent(p1,
p2)
p1 -
p2 -
Point
boardPointFromScreenXY(/*Number
*/ screenX,
/*Number
*/ screenY)
Gets the board point from a screen coordinates.
Overrides:boardPointFromScreenXY
in class Game
screenX -The x coordinate, in screen space.
screenY -The y coordinate, in screen space.
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.
closeGridScore()
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 Game
resourceName -(Optional) A resource name to override the default resource to use.
countWonGrid(value)
value -
dispose()
extractGlyph(miniBoard)
miniBoard -
findGlyphTitle(glyph)
glyph -
findPreviousMovePoint(point,
board,
color)
point -
board -
color -
getAdjacentPiece(point,
x,
y)
point -
x -
y -
getCompulsaryGridIndex(board,
color)
board -
color -
getGlyph(glyphInfo,
x,
y,
color)
glyphInfo -
x -
y -
color -
getGlyphExplinationHtml(miniBoard,
closeButton,
gridLabel)
miniBoard -
closeButton -
gridLabel -
getGlyphList(miniBoard,
color)
miniBoard -
color -
getGlyphShapeHtml(glyph,
color)
glyph -
color -
getGlyphTitle(glyph)
glyph -
getGlyphValue(glyph)
glyph -
getMiniBoardShapeHtml(miniBoard,
color)
miniBoard -
color -
getMiniGridBoard(board,
point)
board -
point -
getMoveData()
getTeamScore(team)
team -
glyphMouseDown(screenPoint)
screenPoint -
gridCenterFromIndex(index)
index -
gridIndexFromPoint(point)
point -
gridOriginFromIndex(index)
index -
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 Game
numPlayers -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); }
isGridAvailable(board,
index)
board -
index -
isMoveLegal(point,
moveData,
color,
quick)
point -
moveData -
color -
quick -
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 Game
resourceName -(Optional) A resource name to override the default resource to use.
markGlyph(glyphInfo,
x,
y,
color)
glyphInfo -
x -
y -
color -
markWonGrids(board,
color)
board -
color -
mirrorGlyph(glyph)
glyph -
mouseDown(screenPoint)
screenPoint -
mouseMove(screenPoint)
screenPoint -
mouseOut(screenPoint)
screenPoint -
mouseOver(screenPoint)
screenPoint -
String
notYourTurnHtml(/*String
*/ resourceName)
Called when needing the it-is-not-your-turn game prompt HTML (typically a short sentence with Send Reminder, Refresh Game and Close Window buttons Start Another Game button). Override to set. Internally uses the "notYourTurn" resource.
Overrides:notYourTurnHtml
in class Game
resourceName -(Optional) A resource name to override the default resource to use.
rotateGlyph(glyph)
glyph -
scoreGlyph(glyph)
glyph -
scoreGlyphs(glyphs)
glyphs -
Rectangle
screenRectFromBoardXY(/*Number
*/ boardX,
/*Number
*/ boardY)
Gets the screen rectangle from board coordinates.
Overrides:screenRectFromBoardXY
in class Game
boardX -The x coordinate, in board point space.
boardY -The y coordinate, in board point space.
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 -
showCompulsaryAndWonGrids(board,
team)
board -
team -
squareIndexFromPoint(point)
point -
void
synch()
Called when the game should synchronize with info
properties from the server.
String
youLoseHtml(/*String
*/ resourceName)
Called when needing the you-lose game prompts HTML. Override to set. Internally uses the "youLose" resource.
Overrides:youLoseHtml
in class Game
resourceName -(Optional) A resource name to override the default resource to use.
String
youWinHtml(/*String
*/ resourceName)
Called when needing the you-win game prompts HTML. Override to set. Internally uses the "youWin" resource.
Overrides:youWinHtml
in class Game
resourceName -(Optional) A resource name to override the default resource to use.