com.threerings.puzzle.drop.client
Class DropControllerDelegate

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
              extended by com.threerings.puzzle.drop.client.DropControllerDelegate
All Implemented Interfaces:
com.threerings.media.FrameParticipant, com.threerings.presents.data.InvocationCodes, PuzzleCodes, PuzzleGameCodes, DropCodes, DropPieceCodes, com.threerings.util.DirectionCodes

public abstract class DropControllerDelegate
extends PuzzleControllerDelegate
implements DropCodes, DropPieceCodes, com.threerings.media.FrameParticipant

Games that wish to make use of the drop puzzle services will need to create an extension of this delegate class, customizing it for their particular game and then adding it via PlaceController.addDelegate(com.threerings.crowd.client.PlaceControllerDelegate).

It handles logical actions for a puzzle game that generally consists of a two-dimensional board containing pieces, with new pieces either falling into the board as a "drop block", or rising into the bottom of the board in new piece rows.

Derived classes must implement getPieceVelocity(boolean) and evolveBoard().

Block-dropping puzzles will likely want to override createNextBlock(), blockDidLand(), and getPieceDropLogic().

Board-rising puzzles will likely want to override getRiseVelocity(), getRiseDistance(), getPieceDropLogic(), and boardDidRise().


Field Summary
static String END_DROP_BLOCK
          The action command for ending dropping the block.
static String MOVE_BLOCK_LEFT
          The action command for moving the block to the left.
static String MOVE_BLOCK_RIGHT
          The action command for moving the block to the right.
static String RAISE_ROW
          The action command for raising the next rising row.
static String ROTATE_BLOCK_CCW
          The action command for rotating the block counter-clockwise.
static String ROTATE_BLOCK_CW
          The action command for rotating the block clockwise.
static String START_DROP_BLOCK
          The action command for starting to dropping the block.
 
Fields inherited from interface com.threerings.puzzle.drop.data.DropCodes
DROP_MESSAGE_BUNDLE, DROP_STREAM, RISE_STREAM
 
Fields inherited from interface com.threerings.puzzle.drop.data.DropPieceCodes
DROP_BLOCK_PIECE_COUNT, PIECE_NONE
 
Fields inherited from interface com.threerings.util.DirectionCodes
CARDINAL_DIRECTIONS, CCW, CW, DIRECTION_COUNT, DOWN, EAST, EASTNORTHEAST, EASTSOUTHEAST, FINE_DIRECTION_COUNT, HORIZONTAL, LEFT, NONE, NORTH, NORTHEAST, NORTHNORTHEAST, NORTHNORTHWEST, NORTHWEST, RIGHT, SOUTH, SOUTHEAST, SOUTHSOUTHEAST, SOUTHSOUTHWEST, SOUTHWEST, UP, VERTICAL, WEST, WESTNORTHWEST, WESTSOUTHWEST
 
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
DropControllerDelegate(PuzzleController ctrl, DropLogic logic)
          Creates a delegate with the specified drop game logic and controller.
 
Method Summary
 void gameDidEnd()
          Called when the game transitions to the GAME_OVER state.
 Component getComponent()
           
 boolean handleAction(ActionEvent action)
           
 void init(com.threerings.crowd.util.CrowdContext ctx, com.threerings.crowd.data.PlaceConfig config)
           
 boolean needsPaint()
           
 void setBoard(Board board)
          Called when the puzzle controller sets up a new board for the player.
 void setRisingPaused(boolean paused)
          Sets whether the board rising is paused.
 void tick(long tickStamp)
           
 void updateSelfSummary()
          Updates the player's own local board summary to reflect the local copy of the player's board which is likely to be more up to date than the server-side board from which all other player board summaries originate.
 void zipToNextRow()
          Causes the board to zip quickly to the next row.
 
Methods inherited from class com.threerings.puzzle.client.PuzzleControllerDelegate
didLeavePlace, playerKnockedOut, setChatting, willEnterPlace
 
Methods inherited from class com.threerings.parlor.game.client.GameControllerDelegate
gameDidStart, gameWasCancelled, gameWillReset
 
Methods inherited from class com.threerings.crowd.client.PlaceControllerDelegate
mayLeavePlace
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MOVE_BLOCK_LEFT

public static final String MOVE_BLOCK_LEFT
The action command for moving the block to the left.

See Also:
Constant Field Values

MOVE_BLOCK_RIGHT

public static final String MOVE_BLOCK_RIGHT
The action command for moving the block to the right.

See Also:
Constant Field Values

ROTATE_BLOCK_CCW

public static final String ROTATE_BLOCK_CCW
The action command for rotating the block counter-clockwise.

See Also:
Constant Field Values

ROTATE_BLOCK_CW

public static final String ROTATE_BLOCK_CW
The action command for rotating the block clockwise.

See Also:
Constant Field Values

START_DROP_BLOCK

public static final String START_DROP_BLOCK
The action command for starting to dropping the block.

See Also:
Constant Field Values

END_DROP_BLOCK

public static final String END_DROP_BLOCK
The action command for ending dropping the block.

See Also:
Constant Field Values

RAISE_ROW

public static final String RAISE_ROW
The action command for raising the next rising row.

See Also:
Constant Field Values
Constructor Detail

DropControllerDelegate

public DropControllerDelegate(PuzzleController ctrl,
                              DropLogic logic)
Creates a delegate with the specified drop game logic and controller.

Method Detail

init

public void init(com.threerings.crowd.util.CrowdContext ctx,
                 com.threerings.crowd.data.PlaceConfig config)
Overrides:
init in class com.threerings.crowd.client.PlaceControllerDelegate

gameDidEnd

public void gameDidEnd()
Description copied from class: GameControllerDelegate
Called when the game transitions to the GAME_OVER state. This happens when the game reaches some end condition by normal means (is not cancelled or aborted).

Overrides:
gameDidEnd in class GameControllerDelegate

handleAction

public boolean handleAction(ActionEvent action)
Overrides:
handleAction in class com.threerings.crowd.client.PlaceControllerDelegate

setBoard

public void setBoard(Board board)
Description copied from class: PuzzleControllerDelegate
Called when the puzzle controller sets up a new board for the player.

Overrides:
setBoard in class PuzzleControllerDelegate
Parameters:
board - the newly initialized and ready-to-go board.

updateSelfSummary

public void updateSelfSummary()
Updates the player's own local board summary to reflect the local copy of the player's board which is likely to be more up to date than the server-side board from which all other player board summaries originate.


tick

public void tick(long tickStamp)
Specified by:
tick in interface com.threerings.media.FrameParticipant

getComponent

public Component getComponent()
Specified by:
getComponent in interface com.threerings.media.FrameParticipant

needsPaint

public boolean needsPaint()
Specified by:
needsPaint in interface com.threerings.media.FrameParticipant

setRisingPaused

public void setRisingPaused(boolean paused)
Sets whether the board rising is paused.


zipToNextRow

public void zipToNextRow()
Causes the board to zip quickly to the next row.



Copyright © 2011. All Rights Reserved.