domestic.DomesticView Class
A view for setting up trades between players.
Constructor
domestic.DomesticView
()
Item Index
Methods
clearTradeView
()
Resets the view
Returns:
void
setController
-
controller
Attaches the controller to the view and builds the view on the page.
Parameters:
-
controller
domestic.Controller
Returns:
void
setPlayers
-
players
Sets the opponents to trade with for the player in the view. This should be called on initializing the controller, and only called once.
Parameters:
-
players
ArrayThe player's three opponents. Each must be of the form { name: the name of the player, color: the player's game color, index: the gameplay index of the player }
Returns:
void
setPlayerSelectionEnabled
-
shouldEnable
Turns on or off the ability to select a player to trade with
Parameters:
-
shouldEnable
Booleanwhether the player can trade or not
Returns:
void
setResourceAmount
-
resource
-
amount
Displays the amount for a resource
Parameters:
-
resource
Stringthe element to change (a resource: "wood","brick","sheep","wheat","ore")
-
amount
Intthe current amount the player wants to trade
Returns:
void
setResourceAmountChangeEnabled
-
resource
-
shouldIncrease
-
shouldDecrease
Turns on or off the ability to set amounts to trade for a reosurce
Parameters:
-
resource
Stringthe element to change (a resource: "wood","brick","sheep","wheat","ore")
-
shouldIncrease
Booleanwhether the player can set more of the resource
-
shouldDecrease
Booleanwhether the player can set less of the resource
Returns:
void
setResourceSelectionEnabled
-
shouldEnable
Turns on or off the ability to trade resources
Parameters:
-
shouldEnable
Booleanwhether the player can trade resources or not
Returns:
void
setStateMessage
-
message
Displays the message indicating the state of the trade
Parameters:
-
message
Stringthe message to display
Returns:
void
setTradeButtonEnabled
-
shouldEnable
Turns on or off the ability to trade
Parameters:
-
shouldEnable
Booleanwhether the player can trade or not
Returns:
void