public class DomesticTradeController extends Controller implements IDomesticTradeController
Constructor and Description |
---|
DomesticTradeController(IDomesticTradeView tradeView,
IDomesticTradeOverlay tradeOverlay,
IWaitView waitOverlay,
IAcceptTradeOverlay acceptOverlay)
DomesticTradeController constructor
|
Modifier and Type | Method and Description |
---|---|
void |
acceptTrade(boolean willAccept)
Called by the accept trade overlay when the user either accepts or
rejects a trade.
|
void |
cancelTrade()
Called by the domestic trade overlay when the user cancels a trade.
|
void |
decreaseResourceAmount(ResourceType resource)
Called by the domestic trade overlay when the user decreases the amount
of a resource.
|
IAcceptTradeOverlay |
getAcceptOverlay() |
IDomesticTradeOverlay |
getTradeOverlay() |
IDomesticTradeView |
getTradeView() |
IWaitView |
getWaitOverlay() |
void |
increaseResourceAmount(ResourceType resource)
Called by the domestic trade overlay when the user increases the amount
of a resource.
|
void |
sendTradeOffer()
Called by the domestic trade overlay when the user clicks the trade
button.
|
void |
setAcceptOverlay(IAcceptTradeOverlay acceptOverlay) |
void |
setPlayerToTradeWith(int playerIndex)
Called by the domestic trade overlay when the user selects a player to
trade with.
|
void |
setResourceToReceive(ResourceType resource)
Called by the domestic trade overlay when the user selects a resource to
be received.
|
void |
setResourceToSend(ResourceType resource)
Called by the domestic trade overlay when the user selects a resource to
be sent.
|
void |
setTradeOverlay(IDomesticTradeOverlay tradeOverlay) |
void |
setWaitOverlay(IWaitView waitView) |
void |
startTrade()
Called by the domestic trade view when the user clicks the domestic trade
button.
|
void |
unsetResource(ResourceType resource)
Called by the domestic trade overlay when user selects "none" for a
resource.
|
getView
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getView
public DomesticTradeController(IDomesticTradeView tradeView, IDomesticTradeOverlay tradeOverlay, IWaitView waitOverlay, IAcceptTradeOverlay acceptOverlay)
tradeView
- Domestic trade view (i.e., view that contains the "Domestic Trade" button)tradeOverlay
- Domestic trade overlay (i.e., view that lets the user propose a domestic trade)waitOverlay
- Wait overlay used to notify the user they are waiting for another player to accept a tradeacceptOverlay
- Accept trade overlay which lets the user accept or reject a proposed tradepublic IDomesticTradeView getTradeView()
public IDomesticTradeOverlay getTradeOverlay()
public void setTradeOverlay(IDomesticTradeOverlay tradeOverlay)
public IWaitView getWaitOverlay()
public void setWaitOverlay(IWaitView waitView)
public IAcceptTradeOverlay getAcceptOverlay()
public void setAcceptOverlay(IAcceptTradeOverlay acceptOverlay)
public void startTrade()
IDomesticTradeController
startTrade
in interface IDomesticTradeController
public void decreaseResourceAmount(ResourceType resource)
IDomesticTradeController
decreaseResourceAmount
in interface IDomesticTradeController
resource
- The resource whose amount is being decreasedpublic void increaseResourceAmount(ResourceType resource)
IDomesticTradeController
increaseResourceAmount
in interface IDomesticTradeController
resource
- The resource whose amount is being increasedpublic void sendTradeOffer()
IDomesticTradeController
sendTradeOffer
in interface IDomesticTradeController
public void setPlayerToTradeWith(int playerIndex)
IDomesticTradeController
setPlayerToTradeWith
in interface IDomesticTradeController
playerIndex
- The index [0, 3] of the selected trading partner, or -1 if
"None" was selectedpublic void setResourceToReceive(ResourceType resource)
IDomesticTradeController
setResourceToReceive
in interface IDomesticTradeController
resource
- The resource to be receivedpublic void setResourceToSend(ResourceType resource)
IDomesticTradeController
setResourceToSend
in interface IDomesticTradeController
resource
- The resource to be sentpublic void unsetResource(ResourceType resource)
IDomesticTradeController
unsetResource
in interface IDomesticTradeController
resource
- The resource for which "none" was selectedpublic void cancelTrade()
IDomesticTradeController
cancelTrade
in interface IDomesticTradeController
public void acceptTrade(boolean willAccept)
IDomesticTradeController
acceptTrade
in interface IDomesticTradeController
willAccept
- Whether or not the user accepted the trade