Games\GamesByEmail.js
GamesByEmail
Object
All Implemented Interfaces:
GamesByEmail.Game
implementsFoundation.Class
,Foundation.Elemental
,Foundation.Resourceful
,Foundation.Server
Base class for all games.
Constructor Summary |
|
Field Summary | |
| board
The data from the board entry of the
resourcePack . |
| canPie
Whether the game supports pieing.
|
| constrainer
A rectangle to constrain piece movement.
|
| font
The font to use throughout the game. Defaults to the player's font preference.
|
| id
The unique ID for a game.
|
| info
The game specific state data.
|
| isLog
Whether the game is a log (display only for a game log page) or a playing game .
|
| lastMove
The date and time of the last move made in the game.
|
| logSettings
Various settings for altering the log display.
|
| maxMoveNumber
The number of moves made in the game.
|
| message
The message between all the players of the game.
|
| move
The last move of the game.
|
| notify
The notification types in the game.
|
| onLeftMouseDown
The name of a method of the game to call when the left mouse button is pressed over the board, or
null . |
| onLeftMouseUp
The name of a method of the game to call when the left mouse button is released over the board, or
null . |
| onMiddleMouseDown
The name of a method of the game to call when the middle mouse button is pressed over the board, or
null . |
| onMiddleMouseUp
The name of a method of the game to call when the middle mouse released is pressed over the board, or
null . |
| onMouseDown
The name of a method of the game to call when a mouse button is pressed over the board, or
null . |
| onMouseMove
The name of a method of the game to call when the mouse moves over the board area, or
null . |
| onMouseOut
The name of a method of the game to call when the mouse exits the board area, or
null . |
| onMouseOver
The name of a method of the game to call when the mouse enters the board area, or
null . |
| onMouseUp
The name of a method of the game to call when a mouse button is released over the board, or
null . |
| onRightMouseDown
The name of a method of the game to call when the right mouse button is pressed over the board, or
null . |
| onRightMouseUp
The name of a method of the game to call when the right mouse button is released over the board, or
null . |
| pieces
A collection of pieces of the class declared in the resource pack.
|
| previewing
Whether the game is in previewing mode (production) or is a real game.
|
static | resourcePack
Resources for most of the game. Override to add resources specific to game.
|
| rotation
The orientation of the board, in radians. Set to the current player's perspective.
|
| status
The status of the game.
|
| teams
The top level teams in the game.
|
| territories
A collection of territories of the class declared in the resource pack.
|
| testing
Whether the game is in testing mode (development) or is a real game.
|
| title
The title of the game.
|
| type
The type of game.
|
| verbose
The verbosity level to use throughout the game. Defaults to the player's verbose preference.
|
Fields inherited from Foundation.Elemental |
$Foundation_$registry_index |
Method Summary | |
|
Gets any HTML for an information row to be displayed above the top team titles.
|
|
Called when needing the accept-or-decline-draw prompts HTML (typically a short sentence and an Accept Draw button). Override to set. Internally uses the "acceptOrDeclineDraw" resource.
|
|
Accepts a draw. Ends the game and sends the move.
|
|
Creates HTML for an Accept Draw button.
|
|
Call to add a note in the game message when sending a move.
|
static |
Creates a new game and inserts the HTML into an existing element on the page.
|
|
Override to add additional player preferences.
|
|
Appends the HTML for the game board (usually an image) and the pieces or territories on it.
|
|
Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined:
drawDeclinedHtml , itsYourTurnHtml , pieHtml , acceptDeclineDrawHtml , offerDrawHtml , cancelGameHtml and resignHtml . |
|
Gets any HTML for an information row to be displayed below the bottom team titles.
|
|
Gets the board point from a screen point.
|
|
Gets the board point from a screen coordinates.
|
|
Gets the board point from the board value index.
|
|
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.
|
|
Creates HTML for a Cancel This Game button.
|
|
Called when needing the you-may-cancel-the-game prompts HTML (typically a short sentence about canceling before the first move is made, and a Cancel This Game button). Override to set. Internally uses the "youMayCancelTheGame" resource.
|
|
Checks to see if a move is legal. By default calls
isMoveLegal . |
|
Hides all images that were created with
hiliteImageHtml . |
|
Clears all mouse events of the game and its territories (if applicable).
|
|
Creates HTML for a Close Window button.
|
|
Called when needing the start-another-game prompt HTML (typically a short sentence with a Close Window button). Override to set. Internally uses the "youMayStartAnotherGame" resource.
|
|
Gets the color from a board value. By default, lower case characters return 0, uppercase 1, and everything else -1.
|
|
Gets the color of the value of a board string at a board point.
|
|
Gets the color of the value of a board string at an x,y coordinate.
|
|
Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined:
undoMoveHtml , completeYourTurnHtml , offerDrawHtml and sendMoveHtml . |
|
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.
|
|
Constrains a screen point by the
constrainer property (if set). |
|
Constrains a screen rectangle by the
constrainer property (if set). |
|
Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined:
undoMoveHtml , continueYourTurnHtml , offerDrawHtml and sendMoveHtml . |
|
Called when needing the continue-your-turn game prompt HTML (typically a short sentence about the move, no send move button yet). Override and set mouse events here. Internally uses the "continueYourTurn" resource.
|
|
Writes a message to the message area.
|
|
Returns die rolls from the Dice-O-Matic if in production, else pseudo-random integers from 1 to 6 inclusive.
|
|
Returns a pseudo-random integer from 1 to 6 inclusive.
|
|
|
|
Called when needing the draw-accepted header HTML. Override to set. Internally uses the "drawGameHeader" resource.
|
|
Called when needing the they-accepted-the-draw game prompts HTML. Override to set. Internally uses the "theyAcceptedTheDraw" resource.
|
|
Called when needing the draw-declined header HTML. Override to set. Internally uses the "drawDeclinedHeader" resource.
|
|
Called when needing the draw-declined prompt HTML (typically a short sentence about the draw being declined). Override to set. Internally uses the "theyDeclinedTheDraw" resource.
|
|
Called when needing the draw-offered header HTML. Override to set. Internally uses the "drawOfferedHeader" resource.
|
|
Generates HTML element attributes necessary to have an HTML hover title on an element.
|
|
Finds the next player.
|
|
Finds a player by their
GamesByEmail.Player.id . |
|
Finds the team that won the game.
|
|
Calls a method of the game for each point on the board, with the board point as the first parameter. The looping stops if the method returns an expression that evaluates to true.
|
|
Calls a method of the game for each team, with the team as the only parameter. The looping stops if the method returns an expression that evaluates to true.
|
|
Called when needing the game-in-progress header HTML. Override to set. Internally returns either
drawOfferedHeaderHtml , drawOfferedHeaderHtml or turnHeaderHtml . |
|
Called when needing the game-over header HTML. Override to set. Internally returns either
tieGameHeaderHtml , drawAcceptedHeaderHtml , resignedHeaderHtml or wonHeaderHtml . |
|
Called when needing the game-over game prompts HTML. Override to set. Internally returns one of the following:
theyResignedHtml , youResignedHtml , youTiedHtml , drawAcceptedHtml , youWinHtml or youLoseHtml . |
|
Creates HTML for a action links: Open log, open rules, open preferences, and report problem anchors.
|
|
Creates HTML for an <A ...> element.
|
|
Creates HTML for a <INPUT TYPE=BUTTON ...> element.
|
|
Creates HTML for a <INPUT TYPE=CHECKBOX ...> element.
|
|
Called when needing the game prompts HTML. Override to set. Internally clears the mouse events, then returns either
spectatingHtml , gameOverHtml , notYourTurnHtml or getTurnHtml . |
|
Called when needing the header HTML. Override to set. Internally returns either
gameInProgressHeaderHtml or gameOverHeaderHtml . |
|
Gets the HTML of the entire game.
|
|
Creates HTML for a <BUTTON ...> element.
|
|
Gets the fully qualified path for an image in the board folder.
|
|
Orders the players for the next game. By default the user information is reversed.
|
|
Gets the title for the next game. By default, the current game's title is appended with '- Round X'.
|
|
Creates HTML for an <OPTION ...> element.
|
|
Called when needing the new game type to pie a game. Internally finds the current game type in the first half of the array 'gameTypes' in the resourcePack, and returns the type in the same position in the second half of the array. Override to alter.
|
|
Gets the clipping rectangle for a piece.
|
|
Gets the fully qualified path for the piece image.
|
|
Creates HTML for a <INPUT TYPE=RADIO ...> element.
|
|
Creates HTML for a <SELECT ...> element.
|
|
Creates HTML for a Spectator anchor.
|
|
Gets the URL for spectating this game.
|
|
Gets the team that is a set number of places away in the parent teams colection, wrapping if necessary.
|
|
Gets the team display color, such as #ff0000.
|
|
Gets the team background-color for the game log, such as #ff8888.
|
|
Gets the team display color for the game log, such as #ff0000.
|
|
Gets the alignment for a team title. Defaults to "center".
|
|
Gets the HTML for the team title on the board. By default uses resources 'turnTeamTitle' or 'teamTitle'.
|
|
Gets the HTML for the team titles on the board.
|
|
Gets an array of teams to display either across the top or bottom of the board. Override to alter default behavior.
|
|
Creates HTML for a <INPUT TYPE=TEXT ...> element.
|
|
Creates HTML for a <TEXTAREA ...> element.
|
|
Called when needing the it-is-your-turn game prompts HTML. Override to set. Internally returns either
beginTurnHtml , continueTurnHtml or completeTurnHtml . |
|
Finds the first team whose turn it is.
|
|
Creates HTML for a vertical button, based on an <BUTTON ...> element.
|
|
Override to handle move collisions from concurrent turns.
|
|
Creates HTML for a highlight image.
|
|
The first method to be called when a game is created, override to set up teams, players and the game state.
|
|
Seeds the game form options with values from the current game.
|
|
Returns whether the board point is hidden from the current player, for games like Dark Chess.
|
|
Checks if the color of the value of a board string at a point is a color.
|
|
Checks if the color of the value of a board string at a coordinate is a color.
|
|
Checks to see if it is the current player's turn.
|
|
Checks to see if all blank values lie in between two points. The points must be separated in one of the 8 orthogonal or diagonal directions.
|
|
Checks to see if a board string is clear at an x,y coordinate.
|
|
Checks to see if a board point is on the board.
|
|
Checks if the color of the value of a board string at a point is a color.
|
|
Checks if the color of the value of a board string at a coordinate is a color.
|
|
Checks to see if a board string is clear at an x,y coordinate.
|
|
Checks to see if an x,y coordinate is on the board.
|
|
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 the Pie button is pressed, opening a confirmation box to proceed with the pie.
|
|
Called when the Resign button is pressed, opening a confirmation box to proceed with the resign.
|
|
Moves a value in a board string to another point.
|
|
Finds the next team from the current player.
|
|
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.
|
|
Counts the number of non-blank values lie in between two points. The points must be separated in one of the 8 orthogonal or diagonal directions.
|
|
Counts the number of teams still playing.
|
|
Creates HTML for an Offer Draw checkbox.
|
|
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.
|
|
Creates HTML for a Open Game Log anchor.
|
|
Creates HTML for a Open Chat anchor.
|
|
Creates HTML for a Open Prefereneces anchor.
|
|
Creates HTML for an Open Rules anchor.
|
|
Pies the game. Clears mouse events and sends.
|
|
Creates HTML for a Pie button.
|
|
Called when needing the you-may-pie game prompt HTML (typically a short sentence about pieing and a Pie button). Override and set. Internally uses the "youMayPie" resource.
|
|
Gets called when the sending moves, fir processing secure move data on the client. Override to process secure data.
|
|
Gets the latest game data from the server, also checks to make sure the game script files are up-to-date.
|
|
Creates HTML for a Refresh Game button.
|
|
Creates HTML for a Report Problem anchor.
|
|
Resignes the current player. Clears mouse events, sets the player as resigned, and sends the move.
|
|
Creates HTML for a Resign button.
|
|
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.
|
|
Called when needing the resigned header HTML. Override to set. Internally uses the "resignedHeader" resource.
|
|
Gets the screen rectangle from a board point.
|
|
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.
|
|
Creates HTML for a Send This Move button.
|
|
Called when needing the send-this-move prompts HTML (typically a short sentence and a Send This Move button). Override to set. Internally uses the "youMaySendYourMove" resource.
|
|
Creates HTML for a Send Reminder button.
|
|
Sets the
constrainer property. |
|
Sets the game as ended.
|
|
Shows HTML in a simple box centered over the board. Board mouse messages are suspended while box is shown.
|
|
Sets the inner HTML of an element.
|
|
Shows HTML in a simple box that follows the mouse around. The user will not be able to click on this box, it is for showing information only.
|
|
Called when synchronizing, sets the perspective of the board based on the player. By default sets the
rotation property to 0. |
|
|
|
Sets a board string at a board point to a value.
|
|
Sets a board string at a coordinate to a value.
|
|
Shows the a tranaction message (Sending Move, Initializing, etc.).
|
|
Called when needing the you-are-spectating game prompts HTML. Override to set. Internally returns the following combined:
refreshGameButtonHtml and closeWindowButtonHtml . |
|
Creates HTML for a Start Another Game button.
|
|
Called when needing the start-another-game prompt HTML (typically a short sentence with a Start Another Game button). Override to set. Internally uses the "youMayStartAnotherGame" resource.
|
|
Called when the game should synchronize with
info properties from the server. |
|
|
|
Gets the team color.
|
|
Called when needing the they-resigned game prompts HTML. Override to set. Internally uses the "theyResigned" resource.
|
|
Called when needing the tie-game header HTML. Override to set. Internally uses the "tieGameHeader" resource.
|
|
Gets the team title from a color.
|
|
|
|
Called when needing the it's-your-turn header HTML. Override to set. Internally uses the "turnHeader" resource.
|
|
|
|
Creates HTML for a Undo button.
|
|
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.
|
|
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.
|
|
Gets the board value at a board point.
|
|
Gets the board value at a coordinate.
|
|
Gets the board string index of a point.
|
|
Gets the board string index of a coordinate.
|
|
Called when needing the won-game header HTML. Override to set. Internally uses the "wonHeader" resource.
|
|
Called when needing the you-lose game prompts HTML. Override to set. Internally uses the "youLose" resource.
|
|
Called when needing the you-resigned game prompts HTML. Override to set. Internally uses the "youResigned" resource.
|
|
Called when needing the you-tied game prompts HTML. Override to set. Internally uses the "youTie" 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.Game()
Field Detail |
Object
board
The data from the board entry of the resourcePack
.
Boolean
canPie
Whether the game supports pieing.
Rectangle
constrainer
A rectangle to constrain piece movement.
String
font
The font to use throughout the game. Defaults to the player's font preference.
Number
id
The unique ID for a game.
Info
info
The game specific state data.
Boolean
isLog
Whether the game is a log (display only for a game log page) or a playing game .
Date
lastMove
The date and time of the last move made in the game.
LogSettings
logSettings
Various settings for altering the log display.
Number
maxMoveNumber
The number of moves made in the game.
String
message
The message between all the players of the game.
Move
move
The last move of the game.
GameNotify
notify
The notification types in the game.
String
onLeftMouseDown
The name of a method of the game to call when the left mouse button is pressed over the board, or null
.
String
onLeftMouseUp
The name of a method of the game to call when the left mouse button is released over the board, or null
.
String
onMiddleMouseDown
The name of a method of the game to call when the middle mouse button is pressed over the board, or null
.
String
onMiddleMouseUp
The name of a method of the game to call when the middle mouse released is pressed over the board, or null
.
String
onMouseDown
The name of a method of the game to call when a mouse button is pressed over the board, or null
.
String
onMouseMove
The name of a method of the game to call when the mouse moves over the board area, or null
.
String
onMouseOut
The name of a method of the game to call when the mouse exits the board area, or null
.
String
onMouseOver
The name of a method of the game to call when the mouse enters the board area, or null
.
String
onMouseUp
The name of a method of the game to call when a mouse button is released over the board, or null
.
String
onRightMouseDown
The name of a method of the game to call when the right mouse button is pressed over the board, or null
.
String
onRightMouseUp
The name of a method of the game to call when the right mouse button is released over the board, or null
.
Pieces
pieces
A collection of pieces of the class declared in the resource pack.
Boolean
previewing
Whether the game is in previewing mode (production) or is a real game.
static Object
resourcePack
Resources for most of the game. Override to add resources specific to game.
See Also:
Number
rotation
The orientation of the board, in radians. Set to the current player's perspective.
GameStatus
status
The status of the game.
Teams
teams
The top level teams in the game.
Territories
territories
A collection of territories of the class declared in the resource pack.
Boolean
testing
Whether the game is in testing mode (development) or is a real game.
String
title
The title of the game.
GAME_TYPE
type
The type of game.
Boolean
verbose
The verbosity level to use throughout the game. Defaults to the player's verbose preference.
Method Detail |
String
aboveTeamTitleRowHtml(/*Number
*/ numCols)
Gets any HTML for an information row to be displayed above the top team titles.
Parameters:numCols -The number of columns of the table the row will belong in, set colspan accordingly.
String
acceptDeclineDrawHtml(/*String
*/ resourceName)
Called when needing the accept-or-decline-draw prompts HTML (typically a short sentence and an Accept Draw button). Override to set. Internally uses the "acceptOrDeclineDraw" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
void
acceptDraw()
Accepts a draw. Ends the game and sends the move.
String
acceptDrawButtonHtml()
Creates HTML for an Accept Draw button.
Returns:
void
addNote(/*String
*/ note)
Call to add a note in the game message when sending a move.
Parameters:note -The note to add. The notes for the move will be combined and grouped in the game message window.
static Game
addToPage(/*String
*/ elementId,
/*String
*/ gameId)
Creates a new game and inserts the HTML into an existing element on the page.
Parameters:elementId -The container element to hold the game.
gameId -The id of the game to load.
StringBuilder
appendAdditionalPreferencesHtml(/*StringBuilder
*/ htmlBuilder)
Override to add additional player preferences.
Parameters:htmlBuilder -The string builder to add the extra player preference HTML to.
StringBuilder
appendBoardHtml(/*StringBuilder
*/ htmlBuilder)
Appends the HTML for the game board (usually an image) and the pieces or territories on it.
Parameters:htmlBuilder -The builder to append the HTML for the board.
String
beginTurnHtml()
Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined: drawDeclinedHtml
, itsYourTurnHtml
, pieHtml
, acceptDeclineDrawHtml
, offerDrawHtml
, cancelGameHtml
and resignHtml
.
String
belowTeamTitleRowHtml(/*Number
*/ numCols)
Gets any HTML for an information row to be displayed below the bottom team titles.
Parameters:numCols -The number of columns of the table the row will belong in, set colspan accordingly.
Point
boardPointFromScreenPoint(/*Point
*/ screenPoint)
Gets the board point from a screen point.
Parameters:screenPoint -The screen point.
Point
boardPointFromScreenXY(/*Number
*/ screenX,
/*Number
*/ screenY)
Gets the board point from a screen coordinates.
Parameters:screenX -The x coordinate, in screen space.
screenY -The y coordinate, in screen space.
Point
boardPointFromValueIndex(/*Number
*/ index)
Gets the board point from the board value index.
Parameters:index -The board value index.
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.
Parameters:value -The value.
color -The color.
String
cancelGameButtonHtml()
Creates HTML for a Cancel This Game button.
Returns:
String
cancelGameHtml(/*String
*/ resourceName)
Called when needing the you-may-cancel-the-game prompts HTML (typically a short sentence about canceling before the first move is made, and a Cancel This Game button). Override to set. Internally uses the "youMayCancelTheGame" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
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.
void
clearHilites(/*Boolean
*/ unclear)
Hides all images that were created with hiliteImageHtml
.
unclear -(Optional) Show the highlight images again. Defaults to
false
(hides the images).
void
clearMouseEvents()
Clears all mouse events of the game and its territories (if applicable).
See Also:
String
closeWindowButtonHtml()
Creates HTML for a Close Window button.
Returns:
String
closeWindowHtml()
Called when needing the start-another-game prompt HTML (typically a short sentence with a Close Window button). Override to set. Internally uses the "youMayStartAnotherGame" resource.
Returns:
Number
colorFromBoardValue(/*String
*/ boardValue)
Gets the color from a board value. By default, lower case characters return 0, uppercase 1, and everything else -1.
Parameters:boardValue -The value to check, by default a single character.
Number
colorFromPointBoard(/*Point
*/ point,
/*String
*/ board)
Gets the color of the value of a board string at a board point.
Parameters:point -The board point to check.
board -The board string (a representation of the board state as a string).
Number
colorFromXYBoard(/*Number
*/ x,
/*Number
*/ y,
/*String
*/ board)
Gets the color of the value of a board string at an x,y coordinate.
Parameters:x -The x coordinate, in board point space.
y -The y coordinate, in board point space.
board -The board string (a representation of the board state as a string).
String
completeTurnHtml()
Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined: undoMoveHtml
, completeYourTurnHtml
, offerDrawHtml
and sendMoveHtml
.
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.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
Point
constrainPoint(/*Point
*/ screenPoint)
Constrains a screen point by the constrainer
property (if set).
screenPoint -The screen point to constrain.
constrainer
property.
Rectangle
constrainRectangle(/*Rectangle
*/ screenRect)
Constrains a screen rectangle by the constrainer
property (if set).
screenRect -The screen rectangle to constrain.
constrainer
property.
String
continueTurnHtml()
Called when needing the begin-your-turn game prompts HTML. Override to set. Internally returns the following combined: undoMoveHtml
, continueYourTurnHtml
, offerDrawHtml
and sendMoveHtml
.
String
continueYourTurnHtml(/*String
*/ resourceName)
Called when needing the continue-your-turn game prompt HTML (typically a short sentence about the move, no send move button yet). Override and set mouse events here. Internally uses the "continueYourTurn" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
Boolean
debug(/*String
*/ value)
Writes a message to the message area.
Parameters:value -(Optional) The value to display. Call with no parameters to clear the message board.
true
.
Array
diceRolls(/*Number
*/ num)
Returns die rolls from the Dice-O-Matic if in production, else pseudo-random integers from 1 to 6 inclusive.
Parameters:num -The number of die rolls to return.
num
numbers number greater than or equal to 1 and less than or equal to 6, generated locally from Math.random.
Number
dieRoll()
Returns a pseudo-random integer from 1 to 6 inclusive.
Returns:
dispose()
dispose
in class Class
String
drawAcceptedHeaderHtml(/*String
*/ resourceName)
Called when needing the draw-accepted header HTML. Override to set. Internally uses the "drawGameHeader" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
drawAcceptedHtml(/*String
*/ resourceName)
Called when needing the they-accepted-the-draw game prompts HTML. Override to set. Internally uses the "theyAcceptedTheDraw" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
drawDeclinedHeaderHtml(/*String
*/ resourceName)
Called when needing the draw-declined header HTML. Override to set. Internally uses the "drawDeclinedHeader" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
drawDeclinedHtml(/*String
*/ resourceName)
Called when needing the draw-declined prompt HTML (typically a short sentence about the draw being declined). Override to set. Internally uses the "theyDeclinedTheDraw" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
drawOfferedHeaderHtml(/*String
*/ resourceName)
Called when needing the draw-offered header HTML. Override to set. Internally uses the "drawOfferedHeader" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
elementTitleAttributes(/*String
*/ title)
Generates HTML element attributes necessary to have an HTML hover title on an element.
Parameters:title -The HTML to dislpay when the user hovers the mouse over the element.
Example:
var title="<H1>Big bold hover title!</H1>"; html+="<div "+this.elementTitleAttributes(title)+">Hover here to see big text.</div>";
Player
findNextPlayer(/*Player
*/ player)
Finds the next player.
Parameters:player -The player to start looking from, or
null
to get the first player.
Player
findPlayer()
Finds a player by their GamesByEmail.Player.id
.
GamesByEmail.Player.id
s and team GamesByEmail.Team.id
s of all opponents will be 0.
Team
findWinningTeam()
Finds the team that won the game.
Returns:null
.
Variant
forEachBoardPoint(/*String
*/ methodName,
/*Variant
*/ parameters,
...)
Calls a method of the game for each point on the board, with the board point as the first parameter. The looping stops if the method returns an expression that evaluates to true.
Parameters:methodName -The name of the game method to call.
parameters -(Optional)(Repeatable) Additional parameters to pass to the method after the board point.
null
.
Variant
forEachTeam(/*String
*/ methodName)
Calls a method of the game for each team, with the team as the only parameter. The looping stops if the method returns an expression that evaluates to true.
Parameters:methodName -The name of the game method to call.
null
.
String
gameInProgressHeaderHtml(/*String
*/ resourceName)
Called when needing the game-in-progress header HTML. Override to set. Internally returns either drawOfferedHeaderHtml
, drawOfferedHeaderHtml
or turnHeaderHtml
.
resourceName -(Optional) A resource name to override the default resource to use when generating the final HTML.
String
gameOverHeaderHtml(/*String
*/ resourceName)
Called when needing the game-over header HTML. Override to set. Internally returns either tieGameHeaderHtml
, drawAcceptedHeaderHtml
, resignedHeaderHtml
or wonHeaderHtml
.
resourceName -(Optional) A resource name to override the default resource to use.
String
gameOverHtml()
Called when needing the game-over game prompts HTML. Override to set. Internally returns one of the following: theyResignedHtml
, youResignedHtml
, youTiedHtml
, drawAcceptedHtml
, youWinHtml
or youLoseHtml
.
String
getActionLinksHtml()
Creates HTML for a action links: Open log, open rules, open preferences, and report problem anchors.
Returns:
String
getAnchorHtml(/*String
*/ title,
/*String
*/ id,
/*String
*/ eventCode,
/*String
*/ attributes)
Creates HTML for an <A ...> element.
Parameters:title -The anchor's title, which will appear in the browser status bar when the mouse hovers over the anchor.
id -(Optional) The class-local id of the element.
eventCode -(Optional) The code to execute on the onclick event of the element.
attributes -(Optional) Additional HTML attributes of the element if desired.
Example:
html+=this.getHtmlButtonHtml(this.resource("MyAnchorTitle),"MyAnchor",this.event("myAnchorOnclick()")); html+="<b>PLEASE</b> click me!"; html+="</a>;See Also:
String
getButtonHtml(/*String
*/ title,
/*String
*/ id,
/*String
*/ eventCode,
/*String
*/ clickTitle,
/*String
*/ attributes,
/*String
*/ styles)
Creates HTML for a <INPUT TYPE=BUTTON ...> element.
Parameters:title -The button's title.
id -(Optional) The class-local id of the element.
eventCode -(Optional) The code to execute on the onclick event of the element.
clickTitle -(Optional) The title to show on the button when clicked.
attributes -(Optional) Additional HTML attributes of the element if desired.
styles -(Optional) Additional CSS style settings for the element if desired.
Example:
html+=this.getButtonHtml(this.resource("MyButtonTitle"),"MyButton",this.event("myButtonOnclick()"));See Also:
String
getCheckboxHtml(/*Boolean
*/ checked,
/*String
*/ id,
/*String
*/ eventCode,
/*String
*/ attributes)
Creates HTML for a <INPUT TYPE=CHECKBOX ...> element.
Parameters:checked -The initial state of the element.
id -The class-local id of the element.
eventCode -(Optional) The code to execute on the onclick event of the element.
attributes -(Optional) Additional HTML attributes of the element if desired.
Example:
html+=this.getCheckboxHtml(true,"MyCheckbox",this.event("myCheckboxOnclick()"));See Also:
String
getGamePromptsHtml()
Called when needing the game prompts HTML. Override to set. Internally clears the mouse events, then returns either spectatingHtml
, gameOverHtml
, notYourTurnHtml
or getTurnHtml
.
String
getHeaderHtml(/*String
*/ resourceName)
Called when needing the header HTML. Override to set. Internally returns either gameInProgressHeaderHtml
or gameOverHeaderHtml
.
resourceName -(Optional) A resource name to override the default resource to use when generating the final HTML.
String
getHtml()
Gets the HTML of the entire game.
Returns:
String
getHtmlButtonHtml(/*String
*/ id,
/*String
*/ eventCode,
/*String
*/ attributes)
Creates HTML for a <BUTTON ...> element.
Parameters:id -(Optional) The class-local id of the element.
eventCode -(Optional) The code to execute on the onclick event of the element.
attributes -(Optional) Additional HTML attributes of the element if desired.
Example:
html+=this.getHtmlButtonHtml("MyButton",this.event("myButtonOnclick()")); html+="<b>PLEASE</b><br>click<br>me!"; html+="</button>;See Also:
String
getImageSrc(String)
Gets the fully qualified path for an image in the board folder.
Parameters:String -(Optional) image The name of the image file relative to the board folder. If not supplied, the path to the board folder is returned.
Array
getNewGamePlayerOrder(/*Array
*/ userInfo)
Orders the players for the next game. By default the user information is reversed.
Parameters:userInfo -An array of user information as currently in this game.
String
getNextGamesTitle()
Gets the title for the next game. By default, the current game's title is appended with '- Round X'.
Returns:
String
getOptionHtml(/*String
*/ title,
/*String
*/ value,
/*String
*/ defaultValue)
Creates HTML for an <OPTION ...> element.
Parameters:title -The visible title of the OPTION element.
value -The value of the OPTION element.
defaultValue -If the value parameter equals this parameter, this OPTION will be selected.
Example:
var defaultValue=0; // This will be the initially selected option value. html+=this.getSelectHtml("MySelect",this.event("mySelectOnchange()")); html+=this.getOptionHtml(this.resource("MyOption1Title"),0,defaultValue); html+=this.getOptionHtml(this.resource("MyOption2Title"),1,defaultValue); html+="</select>"; //Note manual closing of the element!See Also:
Number
getPieType()
Called when needing the new game type to pie a game. Internally finds the current game type in the first half of the array 'gameTypes' in the resourcePack, and returns the type in the same position in the second half of the array. Override to alter.
Returns:
Rectangle
getPieceRect(/*String
*/ value,
/*Number
*/ color,
/*Point
*/ boardPoint)
Gets the clipping rectangle for a piece.
Parameters:value -The value of the piece.
color -(Optional) The color of the piece. Not used by default.
boardPoint -(Optional) The board point of the piece. Not used by default.
String
getPieceSrc()
Gets the fully qualified path for the piece image.
Returns:
String
getRadioHtml(/*Boolean
*/ checked,
/*String
*/ id,
/*Number
*/ index,
/*String
*/ eventCode,
/*String
*/ attributes)
Creates HTML for a <INPUT TYPE=RADIO ...> element.
Parameters:checked -The initial state of the element.
id -The class-local id of the element.
index -The index of the radio button in its group.
eventCode -(Optional) The code to execute on the onclick event of the element.
attributes -(Optional) Additional HTML attributes of the element if desired.
Example:
html+=this.getRadioHtml(true,"MyRadio",1,this.event("myRadioOnclick(1)")); html+=this.getRadioHtml(true,"MyRadio",2,this.event("myRadioOnclick(2)"));See Also:
String
getSelectHtml(/*String
*/ id,
/*String
*/ eventCode,
/*String
*/ attributes)
Creates HTML for a <SELECT ...> element.
Parameters:id -The class-local id of the element.
eventCode -The code to execute on the onchange event of the element.
attributes -(Optional) Additional HTML attributes of the element if desired.
Example:
var defaultValue=0; // This will be the initially selected option value. html+=this.getSelectHtml("MySelect",this.event("mySelectOnchange()")); html+=this.getOptionHtml(this.resource("MyOption1Title"),0,defaultValue); html+=this.getOptionHtml(this.resource("MyOption2Title"),1,defaultValue); html+="</select>"; //Note manual closing of the element!See Also:
String
getSpectatorAnchorHtml()
Creates HTML for a Spectator anchor.
Returns:
String
getSpectatorUrl()
Gets the URL for spectating this game.
Returns:
Team
getTeamAtDistance(/*Number
*/ distance)
Gets the team that is a set number of places away in the parent teams colection, wrapping if necessary.
Parameters:distance -The number of indices away to look. For example, 1 gets the next team in line.
String
getTeamFontColor(/*Team
*/ team)
Gets the team display color, such as #ff0000.
Parameters:team -The team to get the color for.
String
getTeamLogFontBgColor(/*Team
*/ team)
Gets the team background-color for the game log, such as #ff8888.
Parameters:team -The team to get the color for.
String
getTeamLogFontColor(/*Team
*/ team)
Gets the team display color for the game log, such as #ff0000.
Parameters:team -The team to get the color for.
String
getTeamTitleAlignment(/*Team
*/ team,
/*Boolean
*/ top,
/*Number
*/ index,
/*Number
*/ numTeams)
Gets the alignment for a team title. Defaults to "center".
Parameters:team -The team.
top -If the title is above the board.
index -The position of the team in the list on that side of the board.
numTeams -The number of team titles on that side of the board.
String
getTeamTitleHtml(/*Team
*/ team,
/*Boolean
*/ top)
Gets the HTML for the team title on the board. By default uses resources 'turnTeamTitle' or 'teamTitle'.
Parameters:team -The team to get the color for.
top -Whether this team's title will be displayed above the board or below.
String
getTeamTitlesHtml(/*Boolean
*/ top)
Gets the HTML for the team titles on the board.
Parameters:top -Whether this teams' titles will be displayed above the board or below.
Array
getTeamsForTitles(/*Boolean
*/ top)
Gets an array of teams to display either across the top or bottom of the board. Override to alter default behavior.
Parameters:top -Will be
true
if getting teams for the top, else false
for the bottom.
String
getTextHtml(/*String
*/ value,
/*String
*/ id,
/*String
*/ attributes)
Creates HTML for a <INPUT TYPE=TEXT ...> element.
Parameters:value -The initial value of the element, or
null
for blank.id -The class-local id of the element.
attributes -(Optional) Additional HTML attributes of the element if desired.
Example:
// First html+=this.getTextHtml("Some value","MyText"); //Then later.. var value=this.getElement("MyText").value;See Also:
String
getTextareaHtml(/*String
*/ id,
/*String
*/ attributes)
Creates HTML for a <TEXTAREA ...> element.
Parameters:id -The class-local id of the element.
attributes -(Optional) Additional HTML attributes of the element if desired.
Example:
// First html+=this.getTextareaHtml("MyTextArea"); html+="Here is the value"; html+="</textarea>"; //Note manual closing of the element! //Then later.. var value=this.getElement("MyTextArea").value;See Also:
String
getTurnHtml()
Called when needing the it-is-your-turn game prompts HTML. Override to set. Internally returns either beginTurnHtml
, continueTurnHtml
or completeTurnHtml
.
Team
getTurnTeam()
Finds the first team whose turn it is.
Returns:
String
getVButtonHtml(/*String
*/ title,
/*String
*/ id,
/*String
*/ eventCode,
/*String
*/ attributes,
/*String
*/ styles)
Creates HTML for a vertical button, based on an <BUTTON ...> element.
Parameters:title -The button's title, which will appear vertically in the center of the button.
id -(Optional) The class-local id of the element.
eventCode -(Optional) The code to execute on the onclick event of the element.
attributes -(Optional) Additional HTML attributes of the element if desired.
styles -(Optional) Additional CSS style settings for the element if desired.
Example:
html+=this.getVButtonHtml(this.resource("MyButtonTitle"),"MyButton",this.event("myButtonOnclick()"));See Also:
void
handleMoveCollision(/*Object
*/ gameData,
/*Array
*/ collisionMoves)
Override to handle move collisions from concurrent turns.
Parameters:gameData -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(); }
String
hiliteImageHtml(/*Point
*/ boardPoint,
/*Rectangle
*/ clipRect)
Creates HTML for a highlight image.
Parameters:boardPoint -The board point to center the highlight over.
clipRect -The clipping rectangle of the highlight image.
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.
Parameters: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); }
void
initializeNewGameForm(/*GameForm
*/ gameForm,
/*Array
*/ userInfo)
Seeds the game form options with values from the current game.
Parameters:gameForm -The game form to seed.
userInfo -An array of user information.
Point
isBoardPointHidden(/*Point
*/ boardPoint)
Returns whether the board point is hidden from the current player, for games like Dark Chess.
Parameters:boardPoint -The board point.
Number
isColorAtPoint(/*Point
*/ point,
/*String
*/ board,
/*Number
*/ color)
Checks if the color of the value of a board string at a point is a color.
Parameters:point -The board point to check.
board -The board string (a representation of the board state as a string).
color -The color to check.
Number
isColorAtXY(/*Number
*/ x,
/*Number
*/ y,
/*String
*/ board,
/*Number
*/ color)
Checks if the color of the value of a board string at a coordinate is a color.
Parameters:x -The x coordinate, in board point space.
y -The y coordinate, in board point space.
board -The board string (a representation of the board state as a string).
color -The color to check.
Boolean
isMyTurn(/*Boolean
*/ checkEverything)
Checks to see if it is the current player's turn.
Parameters:checkEverything -(Optional) Check everything, the game status, the spectating mode, and log mode too.
true
if it is the current player's turn.
Boolean
isPathClear(/*Point
*/ toPoint,
/*Point
*/ fromPoint,
/*String
*/ board)
Checks to see if all blank values lie in between two points. The points must be separated in one of the 8 orthogonal or diagonal directions.
Parameters:toPoint -One end of the straight line.
fromPoint -One end of the straight line.
board -The board string (a representation of the board state as a string).
toPoint
and fromPoint
.fromPoint
and toPoint
must be separated in one of the 8 orthogonal or diagonal directions. Pieces on fromPoint
or toPoint
are not included.
Boolean
isPointBoardClear(/*Point
*/ point,
/*String
*/ board)
Checks to see if a board string is clear at an x,y coordinate.
Parameters:point -The board point to check.
board -The board string (a representation of the board state as a string).
true
if the board string value is clear at the point.
Boolean
isPointOnBoard(/*Point
*/ point)
Checks to see if a board point is on the board.
Parameters:point -The board point to check.
true
if the point is on the board.
Number
isValueColorAtPoint(/*Point
*/ point,
/*String
*/ board,
/*String
*/ value,
/*Number
*/ color)
Checks if the color of the value of a board string at a point is a color.
Parameters:point -The board point to check.
board -The board string (a representation of the board state as a string).
value -The value to check.
color -The color to check.
Number
isValueColorAtXY(/*Number
*/ x,
/*Number
*/ y,
/*String
*/ board,
/*String
*/ value,
/*Number
*/ color)
Checks if the color of the value of a board string at a coordinate is a color.
Parameters:x -The x coordinate, in board point space.
y -The y coordinate, in board point space.
board -The board string (a representation of the board state as a string).
value -The value to check.
color -The color to check.
Boolean
isXYBoardClear(/*Number
*/ x,
/*Number
*/ y,
/*String
*/ board)
Checks to see if a board string is clear at an x,y coordinate.
Parameters:x -The x coordinate, in board point space.
y -The y coordinate, in board point space.
board -The board string (a representation of the board state as a string).
true
if the board string value is clear at the coordinate.
Boolean
isXYOnBoard(/*Number
*/ x,
/*Number
*/ y)
Checks to see if an x,y coordinate is on the board.
Parameters:x -The x coordinate, in board point space.
y -The y coordinate, in board point space.
true
if the coordinate is on the board.
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.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
void
maybePie()
Called when the Pie button is pressed, opening a confirmation box to proceed with the pie.
void
maybeResign()
Called when the Resign button is pressed, opening a confirmation box to proceed with the resign.
String
movePiece(/*Point
*/ toPoint,
/*Point
*/ fromPoint,
/*String
*/ board)
Moves a value in a board string to another point.
Parameters:toPoint -The board point to set the value at.
fromPoint -The board point to get the value from and set blank.
board -The board string (a representation of the board state as a string).
Team
nextTeam(/*Boolean
*/ playing)
Finds the next team from the current player.
Parameters:playing -Specifies that the team must be playing (not resigned, eliminated, or a non playing team).
null
.
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.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
Number
numInPath(/*Point
*/ toPoint,
/*Point
*/ fromPoint,
/*String
*/ board)
Counts the number of non-blank values lie in between two points. The points must be separated in one of the 8 orthogonal or diagonal directions.
Parameters:toPoint -One end of the straight line.
fromPoint -One end of the straight line.
board -The board string (a representation of the board state as a string).
toPoint
and fromPoint
.fromPoint
and toPoint
must be separated in one of the 8 orthogonal or diagonal directions. Pieces on fromPoint
or toPoint
are not counted.
Number
numTeamsPlaying()
Counts the number of teams still playing.
Returns:
String
offerDrawCheckBoxHtml()
Creates HTML for an Offer Draw checkbox.
Returns:
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.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
openLogAnchorHtml()
Creates HTML for a Open Game Log anchor.
Returns:
String
openPlayerChatAnchorHtml(/*String
*/ id,
/*String
*/ attributes,
/*Number
*/ chatId,
...)
Creates HTML for a Open Chat anchor.
Parameters:id -The element id for the anchor, or null.
attributes -Additional attributes the anchor, or null.
chatId -(Repeatable) Player chat ids to include in this chat.
String
openPreferencesAnchorHtml()
Creates HTML for a Open Prefereneces anchor.
Returns:
String
openRulesAnchorHtml(/*Number
*/ index)
Creates HTML for an Open Rules anchor.
Parameters:index -(Optional) The rule index to initially show, defaults to 0.
void
pie()
Pies the game. Clears mouse events and sends.
String
pieButtonHtml()
Creates HTML for a Pie button.
Returns:
String
pieHtml(/*String
*/ resourceName)
Called when needing the you-may-pie game prompt HTML (typically a short sentence about pieing and a Pie button). Override and set. Internally uses the "youMayPie" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
Boolean
processSecureMove(/*GamesByEmail
*/ game)
Gets called when the sending moves, fir processing secure move data on the client. Override to process secure data.
Parameters:game -The game object to process.
false
.
void
refreshGame()
Gets the latest game data from the server, also checks to make sure the game script files are up-to-date.
String
refreshGameButtonHtml()
Creates HTML for a Refresh Game button.
Returns:
String
reportProblemAnchorHtml()
Creates HTML for a Report Problem anchor.
Returns:
void
resign()
Resignes the current player. Clears mouse events, sets the player as resigned, and sends the move.
String
resignButtonHtml()
Creates HTML for a Resign button.
Returns:
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.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
resignedHeaderHtml(/*String
*/ resourceName)
Called when needing the resigned header HTML. Override to set. Internally uses the "resignedHeader" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
Rectangle
screenRectFromBoardPoint(/*Point
*/ boardPoint)
Gets the screen rectangle from a board point.
Parameters:boardPoint -The board point to get the screen rectangle of.
Rectangle
screenRectFromBoardXY(/*Number
*/ boardX,
/*Number
*/ boardY)
Gets the screen rectangle from board coordinates.
Parameters: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.
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
.
String
sendMoveButtonHtml()
Creates HTML for a Send This Move button.
Returns:
String
sendMoveHtml(/*String
*/ resourceName)
Called when needing the send-this-move prompts HTML (typically a short sentence and a Send This Move button). Override to set. Internally uses the "youMaySendYourMove" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
sendReminderButtonHtml()
Creates HTML for a Send Reminder button.
Returns:
void
setConstrainer()
Sets the constrainer
property.
void
setEnded(/*Team
*/ winningTeam)
Sets the game as ended.
Parameters:winningTeam -(Optional) The team to mark as the winner, or
null
.
void
setFloatHtml(/*String
*/ html,
/*Number
*/ width,
/*Number
*/ height)
Shows HTML in a simple box centered over the board. Board mouse messages are suspended while box is shown.
Parameters:html -The html to show in the box. Pass no parameters,
null
or empty string to hide the box.width -The width the box. If width>1, is the width of the box in pixels. If 0
height -The height the box. If height>1, is the height of the box in pixels. If 0
void
setInnerHtml(/*Element
|String
*/ element)
Sets the inner HTML of an element.
Parameters: Notes:
void
setMouseHtml(/*String
*/ html,
/*Number
*/ width,
/*Number
*/ height)
Shows HTML in a simple box that follows the mouse around. The user will not be able to click on this box, it is for showing information only.
Parameters:html -The html to show in the box. Pass no parameters,
null
or empty string to hide the box.width -The width the box. If width>1, is the width of the box in pixels. If 0
height -The height the box. If height>1, is the height of the box in pixels. If 0
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.
team -The team to synchronize.
void
setPlayerPrefs()
Extract the player's preferences from the player.info collection, and sets properties accordingly. By default, the font
and verbose
properties are extracted.
String
setValueAtPoint(/*Point
*/ point,
/*String
*/ board,
/*String
*/ value)
Sets a board string at a board point to a value.
Parameters:point -The board point to set at.
board -The board string (a representation of the board state as a string).
value -The board value.
String
setValueAtXY(/*Number
*/ x,
/*Number
*/ y,
/*String
*/ board,
/*String
*/ value)
Sets a board string at a coordinate to a value.
Parameters:x -The x coordinate, in board point space.
y -The y coordinate, in board point space.
board -The board string (a representation of the board state as a string).
value -The board value.
void
showTransactionPrompt(/*String
*/ resourceName)
Shows the a tranaction message (Sending Move, Initializing, etc.).
Parameters:resourceName -The resource to display.
String
spectatingHtml()
Called when needing the you-are-spectating game prompts HTML. Override to set. Internally returns the following combined: refreshGameButtonHtml
and closeWindowButtonHtml
.
String
startAnotherGameButtonHtml()
Creates HTML for a Start Another Game button.
Returns:
String
startAnotherGameHtml(/*String
*/ resourceName)
Called when needing the start-another-game prompt HTML (typically a short sentence with a Start Another Game button). Override to set. Internally uses the "youMayStartAnotherGame" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
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.
Number
teamColorFromTeam(/*Team
*/ team)
Gets the team color.
Parameters:team -The team to get the color of.
String
theyResignedHtml(/*String
*/ resourceName)
Called when needing the they-resigned game prompts HTML. Override to set. Internally uses the "theyResigned" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
tieGameHeaderHtml(/*String
*/ resourceName)
Called when needing the tie-game header HTML. Override to set. Internally uses the "tieGameHeader" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
titleFromTeamColor(/*Number
*/ color)
Gets the team title from a color.
Parameters:color -The color to get the title for.
transformHashLinksToOnClicks(html)
html -
String
turnHeaderHtml(/*String
*/ resourceName)
Called when needing the it's-your-turn header HTML. Override to set. Internally uses the "turnHeader" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
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
undoButtonHtml(/*String
*/ resourceName)
Creates HTML for a Undo button.
Parameters:resourceName -(Optional) Name of resource to use for button title. Defaults to 'Undo'.
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.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
void
update()
Updates the team titles, the game header, the game title, all prompts and action links.
void
updateTeamTitles()
Updates the top and bottom team title rows.
String
valueFromBoardValue(/*String
*/ boardValue)
Gets the value from a board value. By default, the lower case of the board value is returned.
Parameters:boardValue -The value to check, by default a single character.
String
valueFromPointBoard(/*Point
*/ point,
/*String
*/ board)
Gets the board value at a board point.
Parameters:point -The board point to get the value of.
board -The board string (a representation of the board state as a string).
String
valueFromXYBoard(/*Number
*/ x,
/*Number
*/ y,
/*String
*/ board)
Gets the board value at a coordinate.
Parameters:x -The x coordinate, in board point space.
y -The y coordinate, in board point space.
board -The board string (a representation of the board state as a string).
Number
valueIndexFromBoardPoint(/*Point
*/ point)
Gets the board string index of a point.
Parameters:point -The board point to get the index of.
Number
valueIndexFromBoardXY(/*Number
*/ x,
/*Number
*/ y)
Gets the board string index of a coordinate.
Parameters:x -The x coordinate, in board point space.
y -The y coordinate, in board point space.
String
wonHeaderHtml(/*String
*/ resourceName)
Called when needing the won-game header HTML. Override to set. Internally uses the "wonHeader" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
youLoseHtml(/*String
*/ resourceName)
Called when needing the you-lose game prompts HTML. Override to set. Internally uses the "youLose" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
youResignedHtml(/*String
*/ resourceName)
Called when needing the you-resigned game prompts HTML. Override to set. Internally uses the "youResigned" resource.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.
String
youTiedHtml(/*String
*/ resourceName)
Called when needing the you-tied game prompts HTML. Override to set. Internally uses the "youTie" resource.
Parameters: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.
Parameters:resourceName -(Optional) A resource name to override the default resource to use.