PETStockFunctions
- class modules.js.Utility.PETStockFunctions()
- modules.js.Utility.PETStockFunctions.PETStockFunctions
constructor
- modules.js.Utility.PETStockFunctions.connectOnDeckDiscardSelectionChangeHandlerAndSetSelectionMode(action)
Function called upon entering states where the player can draw cards. The function binds handlers on the onChangeSelection event for the decks and discards
- Arguments
action (
string()
) –
- modules.js.Utility.PETStockFunctions.connectOnDiscoverSelectionChangeHandlerAndSetSelectionMode()
Function to connect a handler to the player’s token reserve onSelectionChange event
- modules.js.Utility.PETStockFunctions.createStockComponent(type, divId)
Function used to create a Stock component with the given parameters
- Arguments
type (
string()
) – type of the stock, can be one of ‘activecard’, ‘deck’, ‘card’, ‘cube’, ‘token’, ‘agetoken’.divId (
string()
) – id of the container for the Stock
- Returns
PETStock –
- modules.js.Utility.PETStockFunctions.disconnectOnDeckDiscardSelectionChangeHandlerAndSetSelectionMode()
Function called upon leaving states where the player can draw cards. The function unbinds the handlers set upon entering the state
- modules.js.Utility.PETStockFunctions.disconnectOnDiscoverSelectionChangeHandlerAndSetSelectionMode()
Function to unbind the handler set upon entering the state
- modules.js.Utility.PETStockFunctions.onTokenStockSelectionChangeHandler(controlName, itemId)
Callback for player’s token reserve selection change
- Arguments
controlName (
string()
) –itemId (
string()
) –
- modules.js.Utility.PETStockFunctions.placeCardInActiveCardStock(card, playerId, from)
Add a card the the player’s active cards
- Arguments
card (
Object()
) –playerId (
int()
) –from (
string()
) –
- modules.js.Utility.PETStockFunctions.placeTokenInStock(token, playerId)
Add a token to the player’s Stock
- Arguments
token (
Object()
) –playerId (
int()
) –
- modules.js.Utility.PETStockFunctions.populateActiveCardsStocks()
Populate the active cards stocks with each player’s cards
- modules.js.Utility.PETStockFunctions.populateDecksDiscardsStocks(decksDiscardsArray)
Populate the deck and discard stocks
- Arguments
decksDiscardsArray (
Object()
) – deckDiscardsArray sent by the back-end
- modules.js.Utility.PETStockFunctions.populateTokenStocks()
Populate each player’s token Stock
- modules.js.Utility.PETStockFunctions.setSelectionModeForAllStocks(selectionMode)
Sets the selection mode for all the stocks components in the UI
- Arguments
selectionMode (
int()
) –