map.MapController Class
Constructor
map.MapController
-
view
-
modalView
-
model
-
robView
Parameters:
-
view
MapView- The initialized map view
-
modalView
MapOverlay- The overlay to use for placing items on the board.
-
model
ClientModel- The client model
-
robView
RobberOverlay- The robber overlay to be used when the robber is being placed. This is undefined for the setup round.
Item Index
Methods
cancelMove
()
This method is called from the modal view when the cancel button is pressed. It should allow the user to continue gameplay without having to place a piece.
Returns:
void
doSoldierAction
()
Starts the robber movement on the map. The map should pop out and the player should be able move the robber. This is called when the user plays a "solider" development card.
Returns:
void
onDrag
-
loc
-
type
This method is called whenever the user is trying to place a piece on the map.
It is called by the view for each "mouse move" event.
The returned value tells the view whether or not to allow the piece to be "dropped" at the current location.
Parameters:
-
loc
MapLocationThe location being considered for piece placement
-
type
StringThe type of piece the player is trying to place ("robber","road","settlement","city")
Returns:
Whether or not the given piece can be placed at the current location.
onDrop
-
loc
-
type
This method is called when the user clicks the mouse to place a piece. This method should close the modal and possibly trigger the Rob View.
Parameters:
-
loc
MapLocationThe location where the piece is being placed
-
type
StringThe type of piece being placed ("robber","road","settlement","city")
robPlayer
-
orderID
This method is called by the Rob View when a player to rob is selected via a button click.
Parameters:
-
orderID
IntegerThe index (0-3) of the player who is to be robbed
startDoubleRoadBuilding
()
Pops the map out and prompts the player to place two roads. This is called when the user plays a "road building" progress development card.
Returns:
void
startMove
-
pieceType
-
free
-
disconnected
Pops the map out and prompts the player to place the appropriate piece
Parameters:
-
pieceType
String- "road", "settlement", or "city
-
free
Boolean- Set to true in road building and the initial setup
-
disconnected
Boolean- Whether or not the piece can be disconnected. Set to true only in initial setup
Returns:
void