public class TurnGameManagerDelegate extends GameManagerDelegate
TurnGameManager and either create
an instance of this class, or an instance of a derivation which customizes the behavior, either
of which would be passed to PlaceManager.addDelegate(com.threerings.crowd.server.PlaceManagerDelegate) to be activated.| Constructor and Description |
|---|
TurnGameManagerDelegate() |
TurnGameManagerDelegate(TurnGameManager tgmgr)
Deprecated.
use the zero-argument constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
didInit(com.threerings.crowd.data.PlaceConfig config) |
void |
didStartup(com.threerings.crowd.data.PlaceObject plobj) |
void |
endTurn()
Called to end the turn.
|
void |
gameDidStart()
This should be called from
GameManager.gameDidStart() to let the turn delegate perform
start of game processing. |
int |
getTurnHolderIndex()
Returns the index of the current turn holder as configured in the game object.
|
boolean |
isPlayersTurn(int playerIndex)
Test if it's the inputted player's turn.
|
void |
playerWasReplaced(int pidx,
com.threerings.util.Name oplayer,
com.threerings.util.Name nplayer)
Called when a player in the game has been replaced by a call to
GameManager.replacePlayer(int, com.threerings.util.Name). |
void |
startTurn()
Called to start the next turn.
|
gameDidEnd, gameWillEnd, gameWillReset, gameWillStart, setAI, tickAIpublic TurnGameManagerDelegate()
@Deprecated public TurnGameManagerDelegate(TurnGameManager tgmgr)
public int getTurnHolderIndex()
-1 if
there is no current turn holder.public boolean isPlayersTurn(int playerIndex)
public void startTurn()
TurnGameManager.turnWillStart() to allow our
owning manager to perform any pre-start turn processing, sets the turn holder that was
configured either when the game started or when finishing up the last turn, and then calls
TurnGameManager.turnDidStart() to allow the manager to perform any post-start turn
processing. This assumes that a valid turn holder has been assigned. If some pre-game
preparation needs to take place in a non-turn-based manner, this function should not be
called until it is time to start the first turn.public void endTurn()
If the game is no longer in play (see TurnGameObject.isInPlay()) after having called
TurnGameManager.turnDidEnd() and setNextTurnHolder(), then the next turn will
not automatically be started.
If the game is in play, but the next turn should not be started immediately, the game
manager should have setNextTurnHolder() set the _turnIdx field to
-1 which will cause us to not start the next turn. To start things back up
again it would set _turnIdx to the next turn holder and call startTurn()
itself.
public void didInit(com.threerings.crowd.data.PlaceConfig config)
didInit in class PlayManagerDelegatepublic void didStartup(com.threerings.crowd.data.PlaceObject plobj)
didStartup in class com.threerings.crowd.server.PlaceManagerDelegatepublic void playerWasReplaced(int pidx,
com.threerings.util.Name oplayer,
com.threerings.util.Name nplayer)
GameManagerDelegateGameManager.replacePlayer(int, com.threerings.util.Name).playerWasReplaced in class GameManagerDelegatepublic void gameDidStart()
GameManager.gameDidStart() to let the turn delegate perform
start of game processing.gameDidStart in class GameManagerDelegateCopyright © 2015. All rights reserved.