Games\GamesByEmail.js
GamesByEmail
Object
All Implemented Interfaces:
GamesByEmail.Territory
implementsFoundation.Class
A territory class for games like Gambit. May be used directly or extended.
See Also:
Constructor Summary |
Creates a territory.
|
Field Summary | |
| adjacent
The territories that are adjacent to this territory.
|
| adjacentIndices
The indices of territories that are adjacent to this territory.
|
| color
The color of the owner of this territory.
|
| game
The game this territory belongs to.
|
| index
The position of this territory in the parent territores collection.
|
| indexString
A zero-padded index string, automatically padded to accomodate the number of territories in the collection.
|
| polygon
The polygon of this territory.
|
| territories
The parent territories object.
|
| title
The name of this territory.
|
Method Summary | |
|
Appends the HTML necessary for the territory. By default adds an image element and calls the
appendOverlayHtml method. |
|
Override to add HTML that shows above the territory.
|
|
Checks to see if a point is inside the territory's polygon.
|
|
|
|
Returns code that can be used in DOM events to invoke methods and properties of the territory.
|
|
Turns the territory's highlight off.
|
|
Checks to see if a territory is a color.
|
|
Checks to see if a territory belongs to the current player. By default, checks to see if the color matches the team color.
|
|
Turns the territory's blinking on or off.
|
|
Turns the territory's highlight on.
|
|
Highlights the territory if it belongs to the current player based on the
isOurs method. |
Methods inherited from Foundation.Class |
getTypePath , isInstanceOf |
Constructor Detail |
GamesByEmail.Territory(/*Territories
*/ territories,
/*Number
*/ index,
/*String
*/ indexString,
/*Game
*/ game,
/*Object
*/ territory)
Creates a territory.
Parameters:territories -The parent territories collection.
index -The position of this piece in the parent pieces object.
indexString -The zero-padded index string of the position of this piece in the parent pieces object.
game -The game this territory is in.
territory -The data for this territory to inherit.
Field Detail |
Array
adjacent
The territories that are adjacent to this territory.
Array
adjacentIndices
The indices of territories that are adjacent to this territory.
Number
color
The color of the owner of this territory.
Game
game
The game this territory belongs to.
Number
index
The position of this territory in the parent territores collection.
Number
indexString
A zero-padded index string, automatically padded to accomodate the number of territories in the collection.
Polygon
polygon
The polygon of this territory.
Territories
territories
The parent territories object.
String
title
The name of this territory.
Method Detail |
StringBuilder
appendHtml(/*StringBuilder
*/ htmlBuilder)
Appends the HTML necessary for the territory. By default adds an image element and calls the appendOverlayHtml
method.
htmlBuilder -The builder to append the HTML for the territory.
StringBuilder
appendOverlayHtml(/*StringBuilder
*/ htmlBuilder)
Override to add HTML that shows above the territory.
Parameters:htmlBuilder -The builder to append the HTML for the territory.
Boolean
containsPoint(/*Point
*/ point)
Checks to see if a point is inside the territory's polygon.
Parameters:point -The point to check.
dispose()
dispose
in class Class
String
event(/*String
*/ code,
/*Boolean
*/ delayed)
Returns code that can be used in DOM events to invoke methods and properties of the territory.
Parameters:code -The code of this territory to be executed. If no parameters passed, returns the fully qualified territory (to this).
delayed -Delay the event using window.setTimeout. Set to true if the HTML element invoking the event will be destroyed during the event.
Example:
// The following div will call the reset method of the territory when clicked. htmlBuilder.append("<div onclick=\""+this.event("reset()")+"\">click here to reset territory</div>");
Boolean
hideHilite()
Turns the territory's highlight off.
Returns:true
Boolean
isColor(/*Boolean
*/ color)
Checks to see if a territory is a color.
Parameters:color -The color to check.
true
if the territory's color matches.
Boolean
isOurs()
Checks to see if a territory belongs to the current player. By default, checks to see if the color matches the team color.
Returns:true
if the territory belongs to the current player.
void
setBlink(/*Boolean
*/ show)
Turns the territory's blinking on or off.
Parameters:show -Starts or stops the blinking.
Boolean
showHilite()
Turns the territory's highlight on.
Returns:true
Boolean
showHiliteIfOurs()
Highlights the territory if it belongs to the current player based on the isOurs
method.
true
if the territory belongs to the current player.