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()
IController
getView
in interface IController
getView
in class Controller
public void setElementAction(ResourceBarElement element, IAction action)
element
- The resource bar element with which the action is associatedaction
- The action to be executedpublic void buildRoad()
IResourceBarController
buildRoad
in interface IResourceBarController
public void buildSettlement()
IResourceBarController
buildSettlement
in interface IResourceBarController
public void buildCity()
IResourceBarController
buildCity
in interface IResourceBarController
public void buyCard()
IResourceBarController
buyCard
in interface IResourceBarController
public void playCard()
IResourceBarController
playCard
in interface IResourceBarController
private void executeElementAction(ResourceBarElement element)
private void updateResources()
public void alert()
ModelObserver
alert
in interface ModelObserver