Games\Mergers\Game.js
GamesByEmail
Object
GamesByEmail.Game
All Implemented Interfaces:
GamesByEmail.MergersGame
extendsGame
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 any HTML for an information row to be displayed below the bottom team titles.
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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.
|
|
|
|
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 Send Move button is pushed. Override and set the game state, then call Super.sendMove.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Called when needing the you-are-spectating game prompts HTML. Override to set. Internally returns the following combined:
refreshGameButtonHtml and closeWindowButtonHtml . |
|
Called when the game should synchronize with
info properties from the server. |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Gets the value from a board value. By default, the lower case of the board value is returned.
|
|
|
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.MergersGame()
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 |
addBoardMarker(point,
board,
htmlBuilder)
point -
board -
htmlBuilder -
addBoardMarkers(board)
board -
addOrderedTiles(point,
board,
orderedList)
point -
board -
orderedList -
addStaticMarker(htmlBuilder,
point,
value,
title)
htmlBuilder -
point -
value -
title -
addTempUnplayables(point,
board,
chains,
list)
point -
board -
chains -
list -
addUnplayables(point,
board,
chains,
list)
point -
board -
chains -
list -
anyPlayableTiles()
String
belowTeamTitleRowHtml(/*Number
*/ numCols)
Gets any HTML for an information row to be displayed below the bottom team titles.
Overrides:belowTeamTitleRowHtml
in class Game
numCols -The number of columns of the table the row will belong in, set colspan accordingly.
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 Game
value -The value.
color -The color.
buyShare(chainIndex,
buyIndex)
chainIndex -
buyIndex -
buyShareChanged(chainIndex,
buyIndex)
chainIndex -
buyIndex -
canGameBeEnded()
canTeamBuyShares(team)
team -
canTeamPlayATile(team)
team -
chainHtml(chain,
buy,
buttonId,
buttonEvent,
buttonTitleIndex)
chain -
buy -
buttonId -
buttonEvent -
buttonTitleIndex -
chainIndexFromXY(x,
y,
board,
chains)
x -
y -
board -
chains -
chainsHtml(buy)
buy -
chooseMoreTiles(team)
team -
completeMerger()
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.
createChain(chainIndex)
chainIndex -
createChainHtml()
decideWhatToDoNext(team,
depth)
team -
depth -
dispose()
dumpOrHoldShare()
endTheGame()
endTheGameHtml()
findChainPoint(chain)
chain -
findChainPointFromBoard(board,
boardChar)
board -
boardChar -
findMatchingChainPoint(point,
board,
boardChar)
point -
board -
boardChar -
getAvailableChainIndices()
getBonusHolders(chainIndex,
primary)
chainIndex -
primary -
getChainSize(board,
boardChar)
board -
boardChar -
getChainSizeAtPoint(boardPoint)
boardPoint -
getChainSizeAtPointBoard(point,
board)
point -
board -
getMarketShares()
getMergeIndices(boardPoint)
boardPoint -
getMergeIndicesFromPointBoardChain(boardPoint,
board,
chains)
boardPoint -
board -
chains -
Array
getNewGamePlayerOrder(/*Array
*/ userInfo)
Orders the players for the next game. By default the user information is reversed.
Overrides:getNewGamePlayerOrder
in class Game
userInfo -An array of user information as currently in this game.
getRandomTiles(numNeeded)
numNeeded -
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 Game
team -The team to get the color for.
top -Whether this team's title will be displayed above the board or below.
getTeamTitleHtmlPlain(team)
team -
getTempUnplayables(board,
chains)
board -
chains -
getUnplayables(board,
chains)
board -
chains -
handleMerge()
handleNewChain()
hideButton(point)
point -
hiliteButton(point)
point -
holdShares()
hotelPlaced()
indexInList(index,
list)
index -
list -
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); }
isChainValue(value,
chains)
value -
chains -
isHotelValue(value)
value -
isNewChainPoint(boardPoint)
boardPoint -
isNewChainPointBoard(boardPoint,
board)
boardPoint -
board -
isSafeChainValue(value,
chains)
value -
chains -
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.
logBoughtShares()
logStartOfMerge(mergeIndices)
mergeIndices -
mergeeOptionsHtml()
mergerCompleteHtml()
newChainHtml(chain,
buy,
buttonId,
buttonEvent,
buttonTitleIndex)
chain -
buy -
buttonId -
buttonEvent -
buttonTitleIndex -
nextTeamIndexToDealWithMerger()
normalButton(point)
point -
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.
numChainsOnBoard()
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 Game
resourceName -(Optional) A resource name to override the default resource to use.
payBonuses(holders,
amount,
chainIndex,
primary)
holders -
amount -
chainIndex -
primary -
payMajorities(chainIndex)
chainIndex -
pickMergeWinner(chainIndex)
chainIndex -
pickMergeWinnerHtml()
pickNextMergee(chainIndex)
chainIndex -
pickNextMergeeHtml()
placeHotel(boardPoint)
boardPoint -
placeHotelHtml()
placeHotelOnMouseDown(screenPoint)
screenPoint -
placeHotelOnMouseMove(screenPoint)
screenPoint -
placeHotelOnMouseOut(screenPoint)
screenPoint -
placeNewHotel(boardPoint)
boardPoint -
pointCanBePlayed(point)
point -
pointInList(point,
list)
point -
list -
pointIsInAnyPlayersHand(point)
point -
pointIsInPlayersHand(point)
point -
pointIsTempUnplayable(point)
point -
pointIsUnplayable(point)
point -
processEndGame()
readTeamInfo(team)
team -
removePointFromList(point,
list)
point -
list -
retire()
retireHtml()
retireTeam()
sellAllTeamsShares(team)
team -
sellShare()
sellShares(chainIndex,
team,
numShares)
chainIndex -
team -
numShares -
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
.
setToChain(point,
value)
point -
value -
sharesFromString(stringValue)
stringValue -
sharesToString(shares)
shares -
sharesToValueString(shares)
shares -
spaceNotation(x,
y)
x -
y -
spectateChainHtml(chain,
buy,
buttonId,
buttonEvent,
buttonTitleIndex)
chain -
buy -
buttonId -
buttonEvent -
buttonTitleIndex -
spectateChainsHtml()
String
spectatingHtml()
Called when needing the you-are-spectating game prompts HTML. Override to set. Internally returns the following combined: refreshGameButtonHtml
and closeWindowButtonHtml
.
spectatingHtml
in class Game
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.
teamAtIndexMustDealWithMerger(teamIndex)
teamIndex -
teamBonuses(team,
holders,
amount,
i,
primary)
team -
holders -
amount -
i -
primary -
teamTitleMouseoverHtml(team)
team -
teamsBonusWorth(team)
team -
teamsNetWorth(team)
team -
teamsShareHoldings(team)
team -
tilesFromString(stringValue)
stringValue -
tilesToString(tiles)
tiles -
topSendMoveHtml()
tradeShares()
updateChain(chain)
chain -
updateChainDisplay(chain)
chain -
updateChainsDisplay()
updateMarketTiles()
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 Game
boardValue -The value to check, by default a single character.
writeTeamInfo(team)
team -