|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectgames.strategy.triplea.delegate.PurchaseDelegate
public class PurchaseDelegate
Logic for purchasing units. Subclasses can override canAfford(...) to test if a purchase can be made Subclasses can over ride addToPlayer(...) and removeFromPlayer(...) to change how the adding or removing of resources is done.
| Constructor Summary | |
|---|---|
PurchaseDelegate()
|
|
| Method Summary | |
|---|---|
protected boolean |
canAfford(IntegerMap<Resource> costs,
PlayerID player)
subclasses can over ride this method to use different restrictions as to what a player can buy |
void |
end()
Called before the delegate will stop running. |
protected GameData |
getData()
|
java.lang.String |
getDisplayName()
|
java.lang.String |
getName()
|
java.lang.Class<? extends IRemote> |
getRemoteType()
Get the remote type of this delegate for use by a RemoteMessenger. |
void |
initialize(java.lang.String name,
java.lang.String displayName)
|
void |
loadState(java.io.Serializable state)
Loads the delegates state |
java.lang.String |
purchase(IntegerMap<ProductionRule> productionRules)
Returns an error code, or null if all is good. |
java.lang.String |
purchaseRepair(java.util.Map<Territory,IntegerMap<RepairRule>> repairRules)
Returns an error code, or null if all is good. |
protected java.lang.String |
removeFromPlayer(PlayerID player,
IntegerMap<Resource> costs,
CompositeChange changes,
java.util.Collection<Unit> totalUnits)
|
java.io.Serializable |
saveState()
Returns the state of the Delegate. |
void |
start(IDelegateBridge aBridge,
GameData gameData)
Called before the delegate will run. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PurchaseDelegate()
| Method Detail |
|---|
public void initialize(java.lang.String name,
java.lang.String displayName)
initialize in interface IDelegate
public void start(IDelegateBridge aBridge,
GameData gameData)
start in interface IDelegatepublic java.lang.String getName()
getName in interface IDelegatepublic java.lang.String getDisplayName()
getDisplayName in interface IDelegateprotected GameData getData()
protected boolean canAfford(IntegerMap<Resource> costs,
PlayerID player)
public java.lang.String purchase(IntegerMap<ProductionRule> productionRules)
purchase in interface IPurchaseDelegateproductionRules - - units maps ProductionRule -> count
public java.lang.String purchaseRepair(java.util.Map<Territory,IntegerMap<RepairRule>> repairRules)
purchaseRepair in interface IPurchaseDelegatepublic java.io.Serializable saveState()
saveState in interface IDelegatepublic void loadState(java.io.Serializable state)
loadState in interface IDelegatepublic void end()
end in interface IDelegatepublic java.lang.Class<? extends IRemote> getRemoteType()
IDelegate
getRemoteType in interface IDelegate
protected java.lang.String removeFromPlayer(PlayerID player,
IntegerMap<Resource> costs,
CompositeChange changes,
java.util.Collection<Unit> totalUnits)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||