com.threerings.puzzle.client
Class PuzzleController

java.lang.Object
  extended by com.samskivert.swing.Controller
      extended by com.threerings.crowd.client.PlaceController
          extended by com.threerings.parlor.game.client.GameController
              extended by com.threerings.puzzle.client.PuzzleController
All Implemented Interfaces:
com.threerings.presents.data.InvocationCodes, com.threerings.presents.dobj.AttributeChangeListener, com.threerings.presents.dobj.ChangeListener, PuzzleCodes, ActionListener, EventListener

public abstract class PuzzleController
extends GameController
implements PuzzleCodes

The puzzle game controller handles logical actions for a puzzle game.


Nested Class Summary
static interface PuzzleController.ClearPender
          Used by fireWhenActionCleared(com.threerings.puzzle.client.PuzzleController.ClearPender).
 
Nested classes/interfaces inherited from class com.threerings.crowd.client.PlaceController
com.threerings.crowd.client.PlaceController.DelegateOp
 
Field Summary
static String TOGGLE_CHATTING
          The action command to toggle chatting mode.
 
Fields inherited from class com.samskivert.swing.Controller
DISPATCHER
 
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
PuzzleController()
           
 
Method Summary
 void addProgressEvent(int event, Board board)
          Adds the given progress event and a snapshot of the supplied board state to the set of progress events and associated board states for later transmission to the server.
 void attributeChanged(com.threerings.presents.dobj.AttributeChangedEvent event)
           
 void didLeavePlace(com.threerings.crowd.data.PlaceObject plobj)
          Removes our listener registration from the game object and cleans house.
 Board getBoard()
          Returns the board associated with the puzzle.
 int getEventCount()
          Returns the number of progress events currently queued up for sending to the server with the next progress update.
 String getPauseString()
          Get the (untranslated) string to display when the puzzle is paused.
 int getPlayerIndex()
          Returns the player's index in the list of players for the game.
 boolean handleAction(ActionEvent action)
          Handles basic game controller action events.
 boolean hasAction()
          Returns true if the puzzle has action, false if the action is cleared or it is suspended.
 boolean isChatting()
          Returns true if the puzzle has been defocused because the player is doing some chatting.
 void mayLeavePlace(com.threerings.crowd.data.PlaceObject plobj)
           
 void sendProgressUpdate()
          Sends the server a game progress update with the list of events, as well as board states if PuzzlePanel.isSyncingBoards() is true.
 void setBoard(Board board)
          Called when a new board is set.
 void setChatting(boolean chatting)
          Sets whether we're focusing on the chat window rather than the puzzle.
 void setGameOver(boolean gameOver)
          Sets the client game over override.
 void willEnterPlace(com.threerings.crowd.data.PlaceObject plobj)
          Adds this controller as a listener to the game object (thus derived classes need not do so) and lets the game manager know that we are now ready to go.
 
Methods inherited from class com.threerings.parlor.game.client.GameController
getMatchType, getSessionId, init, isGameOver, resetGame, systemMessage
 
Methods inherited from class com.threerings.crowd.client.PlaceController
getPlaceConfig, getPlaceView
 
Methods inherited from class com.samskivert.swing.Controller
actionPerformed, configureAction, createActionButton, handleAction, handleAction, handleAction, postAction, postAction, postAction, setControlledPanel, wasAdded, wasRemoved
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOGGLE_CHATTING

public static final String TOGGLE_CHATTING
The action command to toggle chatting mode.

See Also:
Constant Field Values
Constructor Detail

PuzzleController

public PuzzleController()
Method Detail

getBoard

public Board getBoard()
Returns the board associated with the puzzle.


getPlayerIndex

public int getPlayerIndex()
Returns the player's index in the list of players for the game.


setGameOver

public void setGameOver(boolean gameOver)
Description copied from class: GameController
Sets the client game over override. This is used in situations where we determine that the game is over before the server has informed us of such.

Overrides:
setGameOver in class GameController

hasAction

public boolean hasAction()
Returns true if the puzzle has action, false if the action is cleared or it is suspended.


setChatting

public void setChatting(boolean chatting)
Sets whether we're focusing on the chat window rather than the puzzle.


getPauseString

public String getPauseString()
Get the (untranslated) string to display when the puzzle is paused.


isChatting

public boolean isChatting()
Returns true if the puzzle has been defocused because the player is doing some chatting.


willEnterPlace

public void willEnterPlace(com.threerings.crowd.data.PlaceObject plobj)
Description copied from class: GameController
Adds this controller as a listener to the game object (thus derived classes need not do so) and lets the game manager know that we are now ready to go.

Overrides:
willEnterPlace in class GameController

mayLeavePlace

public void mayLeavePlace(com.threerings.crowd.data.PlaceObject plobj)
Overrides:
mayLeavePlace in class com.threerings.crowd.client.PlaceController

didLeavePlace

public void didLeavePlace(com.threerings.crowd.data.PlaceObject plobj)
Description copied from class: GameController
Removes our listener registration from the game object and cleans house.

Overrides:
didLeavePlace in class GameController

attributeChanged

public void attributeChanged(com.threerings.presents.dobj.AttributeChangedEvent event)
Specified by:
attributeChanged in interface com.threerings.presents.dobj.AttributeChangeListener
Overrides:
attributeChanged in class GameController

setBoard

public void setBoard(Board board)
Called when a new board is set.


handleAction

public boolean handleAction(ActionEvent action)
Description copied from class: GameController
Handles basic game controller action events. Derived classes should be sure to call super.handleAction for events they don't specifically handle.

Overrides:
handleAction in class GameController

getEventCount

public int getEventCount()
Returns the number of progress events currently queued up for sending to the server with the next progress update.


addProgressEvent

public void addProgressEvent(int event,
                             Board board)
Adds the given progress event and a snapshot of the supplied board state to the set of progress events and associated board states for later transmission to the server.


sendProgressUpdate

public void sendProgressUpdate()
Sends the server a game progress update with the list of events, as well as board states if PuzzlePanel.isSyncingBoards() is true.



Copyright © 2011. All Rights Reserved.