com.threerings.puzzle.client
Class PuzzleControllerDelegate

java.lang.Object
  extended by com.threerings.crowd.client.PlaceControllerDelegate
      extended by com.threerings.parlor.game.client.GameControllerDelegate
          extended by com.threerings.puzzle.client.PuzzleControllerDelegate
All Implemented Interfaces:
InvocationCodes, PuzzleCodes, PuzzleGameCodes
Direct Known Subclasses:
DropControllerDelegate

public class PuzzleControllerDelegate
extends GameControllerDelegate
implements PuzzleCodes, PuzzleGameCodes

A base class for puzzle controller delegates. Provides access to some delegated puzzle controller methods (startAction(), clearAction(), etc.) and provides a casted reference to the puzzle object.


Field Summary
protected  PuzzleController _ctrl
          Our puzzle controller.
protected  PuzzleObject _puzobj
          The puzzle distributed object.
 
Fields inherited from class com.threerings.crowd.client.PlaceControllerDelegate
_controller
 
Fields inherited from interface com.threerings.puzzle.data.PuzzleCodes
DEBUG_PUZZLE, DEFAULT_DIFFICULTY, PUZZLE_MESSAGE_BUNDLE
 
Fields inherited from interface com.threerings.presents.data.InvocationCodes
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR
 
Constructor Summary
PuzzleControllerDelegate(PuzzleController ctrl)
          Constructs a puzzle controller delegate.
 
Method Summary
protected  boolean canClearAction()
          Delegates that wish to postpone action clearing can override this method to return false until such time as the action can be cleared.
protected  boolean canStartChatting()
          Can we start chatting at the instant that this method is called?
protected  void clearAction()
          Puzzles should override this method and clear out any action on the board and generally clean up anything that was going on because the game was in play.
 void didLeavePlace(PlaceObject plobj)
           
protected  void maybeClearAction()
          Calls PuzzleController.maybeClearAction(), preserving its protected access but making the method available to all PuzzleControllerDelegate derivations.
 void playerKnockedOut(int pidx)
          Called when a player is knocked out of the game.
 void setBoard(Board board)
          Called when the puzzle controller sets up a new board for the player.
 void setChatting(boolean chatting)
          Called when the user toggles chatting mode.
protected  void startAction()
          Derived classes should override this method and do whatever is necessary to start up the action for their puzzle.
 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, init, mayLeavePlace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_ctrl

protected PuzzleController _ctrl
Our puzzle controller.


_puzobj

protected PuzzleObject _puzobj
The puzzle distributed object.

Constructor Detail

PuzzleControllerDelegate

public PuzzleControllerDelegate(PuzzleController ctrl)
Constructs a puzzle controller delegate.

Method Detail

willEnterPlace

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

didLeavePlace

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

playerKnockedOut

public void playerKnockedOut(int pidx)
Called when a player is knocked out of the game.


setChatting

public void setChatting(boolean chatting)
Called when the user toggles chatting mode.


canStartChatting

protected boolean canStartChatting()
Can we start chatting at the instant that this method is called?


startAction

protected void startAction()
Derived classes should override this method and do whatever is necessary to start up the action for their puzzle. This could be called when the user is already in the "room" and the game starts, or immediately upon entering the room if the game is already started (for example if they disconnected and reconnected to a game already in progress).


canClearAction

protected boolean canClearAction()
Delegates that wish to postpone action clearing can override this method to return false until such time as the action can be cleared. They must, however, call maybeClearAction() when conditions become such that they would once again allow action to be cleared.


maybeClearAction

protected void maybeClearAction()
Calls PuzzleController.maybeClearAction(), preserving its protected access but making the method available to all PuzzleControllerDelegate derivations.


clearAction

protected void clearAction()
Puzzles should override this method and clear out any action on the board and generally clean up anything that was going on because the game was in play. This is called when the game has ended or when it is going to reset and when the client leaves the game "room". Anything that is cleared out here should be recreated in startAction().


setBoard

public void setBoard(Board board)
Called when the puzzle controller sets up a new board for the player.

Parameters:
board - the newly initialized and ready-to-go board.