com.threerings.parlor.turn.client
Class TurnGameControllerDelegate

java.lang.Object
  extended by com.threerings.crowd.client.PlaceControllerDelegate
      extended by com.threerings.parlor.game.client.GameControllerDelegate
          extended by com.threerings.parlor.turn.client.TurnGameControllerDelegate
All Implemented Interfaces:
AttributeChangeListener, ChangeListener
Direct Known Subclasses:
TrickCardGameControllerDelegate

public class TurnGameControllerDelegate
extends GameControllerDelegate
implements AttributeChangeListener

Performs the client-side processing for a turn-based game. Games which wish to make use of these services must construct a delegate and call out to it at the appropriate times (see the method documentation for which methods should be called when). The game's controller must also implement the TurnGameController interface so that it can be notified when turn-based game events take place.


Field Summary
protected  CrowdContext _ctx
          A reference to our client context.
protected  GameObject _gameObj
          A reference to our game object.
protected  TurnGameController _tgctrl
          The turn game controller for whom we are delegating.
protected  String _thfield
          The name of the turn holder field.
protected  TurnGameObject _turnGame
          A casted reference to our game object as a turn game.
 
Fields inherited from class com.threerings.crowd.client.PlaceControllerDelegate
_controller
 
Constructor Summary
TurnGameControllerDelegate(TurnGameController tgctrl)
          Constructs a delegate which will call back to the supplied TurnGameController implementation wen turn-based game related things happen.
 
Method Summary
 void attributeChanged(AttributeChangedEvent event)
           
 void didLeavePlace(PlaceObject plobj)
           
 int getTurnHolderIndex()
          Returns the index of the current turn holder as configured in the game object.
 void init(CrowdContext ctx, PlaceConfig config)
           
 boolean isOurTurn()
          Returns true if the game is in progress and it is our turn; false otherwise.
 void willEnterPlace(PlaceObject plobj)
           
 
Methods inherited from class com.threerings.parlor.game.client.GameControllerDelegate
gameDidEnd, gameDidStart, gameWasCancelled, gameWillReset
 
Methods inherited from class com.threerings.crowd.client.PlaceControllerDelegate
handleAction, mayLeavePlace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_tgctrl

protected TurnGameController _tgctrl
The turn game controller for whom we are delegating.


_ctx

protected CrowdContext _ctx
A reference to our client context.


_gameObj

protected GameObject _gameObj
A reference to our game object.


_turnGame

protected TurnGameObject _turnGame
A casted reference to our game object as a turn game.


_thfield

protected String _thfield
The name of the turn holder field.

Constructor Detail

TurnGameControllerDelegate

public TurnGameControllerDelegate(TurnGameController tgctrl)
Constructs a delegate which will call back to the supplied TurnGameController implementation wen turn-based game related things happen.

Method Detail

isOurTurn

public boolean isOurTurn()
Returns true if the game is in progress and it is our turn; false otherwise.


getTurnHolderIndex

public int getTurnHolderIndex()
Returns the index of the current turn holder as configured in the game object.

Returns:
the index into the players array of the current turn holder or -1 if there is no current turn holder.

init

public void init(CrowdContext ctx,
                 PlaceConfig config)
Overrides:
init in class PlaceControllerDelegate

willEnterPlace

public void willEnterPlace(PlaceObject plobj)
Overrides:
willEnterPlace in class PlaceControllerDelegate

didLeavePlace

public void didLeavePlace(PlaceObject plobj)
Overrides:
didLeavePlace in class PlaceControllerDelegate

attributeChanged

public void attributeChanged(AttributeChangedEvent event)
Specified by:
attributeChanged in interface AttributeChangeListener