|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.crowd.server.PlaceManagerDelegate
com.threerings.parlor.server.PlayManagerDelegate
com.threerings.parlor.game.server.GameManagerDelegate
com.threerings.parlor.turn.server.TurnGameManagerDelegate
public class TurnGameManagerDelegate
Performs the server-side turn-based game processing for a turn based game. Game managers which
wish to make use of the turn services must implement 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.
| Field Summary | |
|---|---|
protected TurnGameManager |
_tgmgr
The game manager for which we are delegating. |
protected TurnGameObject |
_turnGame
A reference to our game object. |
protected int |
_turnIdx
The player index of the current turn holder or -1 if it's no one's turn. |
| Fields inherited from class com.threerings.parlor.server.PlayManagerDelegate |
|---|
_gmgr |
| Fields inherited from class com.threerings.crowd.server.PlaceManagerDelegate |
|---|
_invmgr, _omgr, _plmgr |
| Constructor Summary | |
|---|---|
TurnGameManagerDelegate()
|
|
TurnGameManagerDelegate(TurnGameManager tgmgr)
Deprecated. use the zero-argument constructor. |
|
| Method Summary | |
|---|---|
protected void |
assignTurnRandomly()
Convenience function to randomly assign the turn. |
void |
didInit(PlaceConfig config)
|
void |
didStartup(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,
Name oplayer,
Name nplayer)
Called when a player in the game has been replaced by a call to GameManager.replacePlayer(int, com.threerings.util.Name). |
protected void |
setFirstTurnHolder()
This is called to determine which player will take the first turn. |
protected void |
setNextTurnHolder()
This is called to determine which player will next hold the turn. |
void |
startTurn()
Called to start the next turn. |
| Methods inherited from class com.threerings.parlor.game.server.GameManagerDelegate |
|---|
gameDidEnd, gameWillEnd, gameWillReset, gameWillStart, setAI, tickAI |
| Methods inherited from class com.threerings.parlor.server.PlayManagerDelegate |
|---|
isAgent, isPlayer, verifyIsPlayer, verifyIsPlayerOrAgent, verifyWritePermission |
| Methods inherited from class com.threerings.crowd.server.PlaceManagerDelegate |
|---|
addDispatcher, addProvider, bodyEntered, bodyLeft, bodyUpdated, didShutdown, init, placeBecameEmpty, where |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected TurnGameManager _tgmgr
protected TurnGameObject _turnGame
protected int _turnIdx
-1 if it's no one's turn.
| Constructor Detail |
|---|
public TurnGameManagerDelegate()
@Deprecated public TurnGameManagerDelegate(TurnGameManager tgmgr)
| Method Detail |
|---|
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(PlaceConfig config)
didInit in class PlayManagerDelegatepublic void didStartup(PlaceObject plobj)
didStartup in class PlaceManagerDelegate
public void playerWasReplaced(int pidx,
Name oplayer,
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 GameManagerDelegateprotected void setFirstTurnHolder()
protected void setNextTurnHolder()
_turnIdx field, not set
the turn holder field in the game object directly.
protected void assignTurnRandomly()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||