public class ResourceBarController extends Controller implements IResourceBarController, ModelObserver
| Modifier and Type | Field and Description |
|---|---|
private java.util.Map<ResourceBarElement,IAction> |
elementActions |
| Constructor and Description |
|---|
ResourceBarController(IResourceBarView view) |
| Modifier and Type | Method and Description |
|---|---|
void |
alert()
Notifies an object that something has happened
|
void |
buildCity()
Called by the view then the user requests to build a city
|
void |
buildRoad()
Called by the view then the user requests to build a road
|
void |
buildSettlement()
Called by the view then the user requests to build a settlement
|
void |
buyCard()
Called by the view then the user requests to buy a card
|
private void |
executeElementAction(ResourceBarElement element) |
IResourceBarView |
getView()
View getter
|
void |
playCard()
Called by the view then the user requests to play a card
|
void |
setElementAction(ResourceBarElement element,
IAction action)
Sets the action to be executed when the specified resource bar element is clicked by the user
|
private void |
updateResources()
Update the resources on the bar
|
private java.util.Map<ResourceBarElement,IAction> elementActions
public ResourceBarController(IResourceBarView view)
public IResourceBarView getView()
IControllergetView in interface IControllergetView in class Controllerpublic void setElementAction(ResourceBarElement element, IAction action)
element - The resource bar element with which the action is associatedaction - The action to be executedpublic void buildRoad()
IResourceBarControllerbuildRoad in interface IResourceBarControllerpublic void buildSettlement()
IResourceBarControllerbuildSettlement in interface IResourceBarControllerpublic void buildCity()
IResourceBarControllerbuildCity in interface IResourceBarControllerpublic void buyCard()
IResourceBarControllerbuyCard in interface IResourceBarControllerpublic void playCard()
IResourceBarControllerplayCard in interface IResourceBarControllerprivate void executeElementAction(ResourceBarElement element)
private void updateResources()
public void alert()
ModelObserveralert in interface ModelObserver