new View(game, turnMap)
The View class
Parameters:
Name | Type | Description |
---|---|---|
game |
Game | the game state |
turnMap |
TurnMap | the state machine |
Extends
Methods
createTileView(tileNum, x, y, width, height) → {PIXI.Graphics}
Create a view for a tile, place it at the right location
Parameters:
Name | Type | Description |
---|---|---|
tileNum |
int | index of the tile on the board |
x |
int | x location of the tile |
y |
int | y location of the tile |
width |
int | width of the tile |
height |
int | height of the tile |
Returns:
tileView
- Type
- PIXI.Graphics
destroyTokenView(tokenView)
Remove the token view from the view
Parameters:
Name | Type | Description |
---|---|---|
tokenView |
Dictionary |
destroyTokenViewForToken(token)
Remove a token view from the view
Parameters:
Name | Type | Description |
---|---|---|
token |
Token | the token to be destroyed |
drawArrayBoard() → {void}
Draw the array board type
Returns:
- Type
- void
drawArrayTiles() → {void}
draw the tiles for an Array Board
Returns:
- Type
- void
drawBoard() → {void}
Draw the board for the given board type
Returns:
- Type
- void
drawGridBoard() → {void}
Draw the grid board type
Returns:
- Type
- void
drawTile(tile, size) → {PIXI.Graphics}
Draw a single tile
Override this method in your subclass to customize the board
Parameters:
Name | Type | Description |
---|---|---|
tile |
Tile | the tile model object |
size |
Dictionary | The width and height for the tile |
Returns:
tileView
- Type
- PIXI.Graphics
drawTiles() → {void}
Draw tile for the grid board
Returns:
- Type
- void
drawToken(token, size)
Draw a tokens
Override this method in subclass to customize token drawing
Parameters:
Name | Type | Description |
---|---|---|
token |
Token | token model data |
size |
Dictionary | width and height of token |
drawTokens() → {void}
Draw all the tokens on the board
Returns:
- Type
- void
getTileViewForToken(token) → {PIXI.Graphics}
Get the tile view that a token is on
Parameters:
Name | Type | Description |
---|---|---|
token |
Token | A game token |
Returns:
tileView
- Type
- PIXI.Graphics
sendMessage(message) → {void}
Method to broadcast a message out to the other components
Parameters:
Name | Type | Description |
---|---|---|
message |
string | Message to send |
- Inherited From:
- Source:
Returns:
- Type
- void
subscribe(callback) → {void}
Method to subscribe to messages
Parameters:
Name | Type | Description |
---|---|---|
callback |
func | A callback method to pass the message to |
- Inherited From:
- Source:
Returns:
- Type
- void
updateTokens()
Update all of the tokens on the board
updateTokenView(tokenView) → {void}
Update the token view if the token moved
Parameters:
Name | Type | Description |
---|---|---|
tokenView |
Dictionary |
Returns:
- Type
- void