public class MapController extends Controller implements IMapController
Constructor and Description |
---|
MapController(IMapView view,
IRobView robView) |
Modifier and Type | Method and Description |
---|---|
void |
cancelMove()
This method is called from the modal map overlay when the cancel button
is pressed.
|
boolean |
canPlaceCity(VertexLocation vertLoc)
This method is called whenever the user is trying to place a city on the
map.
|
boolean |
canPlaceRoad(EdgeLocation edgeLoc)
This method is called whenever the user is trying to place a road on the
map.
|
boolean |
canPlaceRobber(HexLocation hexLoc)
This method is called whenever the user is trying to place the robber on
the map.
|
boolean |
canPlaceSettlement(VertexLocation vertLoc)
This method is called whenever the user is trying to place a settlement
on the map.
|
IMapView |
getView()
View getter
|
protected void |
initFromModel() |
void |
placeCity(VertexLocation vertLoc)
This method is called when the user clicks the mouse to place a city.
|
void |
placeRoad(EdgeLocation edgeLoc)
This method is called when the user clicks the mouse to place a road.
|
void |
placeRobber(HexLocation hexLoc)
This method is called when the user clicks the mouse to place the robber.
|
void |
placeSettlement(VertexLocation vertLoc)
This method is called when the user clicks the mouse to place a
settlement.
|
void |
playRoadBuildingCard()
This method is called when the user plays a "road building" progress
development card.
|
void |
playSoldierCard()
This method is called when the user plays a "soldier" development card.
|
void |
robPlayer(RobPlayerInfo victim)
This method is called by the Rob View when a player to rob is selected
via a button click.
|
void |
startMove(PieceType pieceType,
boolean isFree,
boolean allowDisconnected)
This method is called when the user requests to place a piece on the map
(road, city, or settlement)
|
public IMapView getView()
IController
getView
in interface IController
getView
in class Controller
protected void initFromModel()
public boolean canPlaceRoad(EdgeLocation edgeLoc)
IMapController
canPlaceRoad
in interface IMapController
edgeLoc
- The proposed road locationpublic boolean canPlaceSettlement(VertexLocation vertLoc)
IMapController
canPlaceSettlement
in interface IMapController
vertLoc
- The proposed settlement locationpublic boolean canPlaceCity(VertexLocation vertLoc)
IMapController
canPlaceCity
in interface IMapController
vertLoc
- The proposed city locationpublic boolean canPlaceRobber(HexLocation hexLoc)
IMapController
canPlaceRobber
in interface IMapController
hexLoc
- The proposed robber locationpublic void placeRoad(EdgeLocation edgeLoc)
IMapController
placeRoad
in interface IMapController
edgeLoc
- The road locationpublic void placeSettlement(VertexLocation vertLoc)
IMapController
placeSettlement
in interface IMapController
vertLoc
- The settlement locationpublic void placeCity(VertexLocation vertLoc)
IMapController
placeCity
in interface IMapController
vertLoc
- The city locationpublic void placeRobber(HexLocation hexLoc)
IMapController
placeRobber
in interface IMapController
hexLoc
- The robber locationpublic void startMove(PieceType pieceType, boolean isFree, boolean allowDisconnected)
IMapController
startMove
in interface IMapController
pieceType
- The type of piece to be placedisFree
- true if the piece should not cost the player resources, false
otherwise. Set to true during initial setup and when a road
building card is played.allowDisconnected
- true if the piece can be disconnected, false otherwise. Set to
true only during initial setup.public void cancelMove()
IMapController
cancelMove
in interface IMapController
public void playSoldierCard()
IMapController
playSoldierCard
in interface IMapController
public void playRoadBuildingCard()
IMapController
playRoadBuildingCard
in interface IMapController
public void robPlayer(RobPlayerInfo victim)
IMapController
robPlayer
in interface IMapController
victim
- The player to be robbed