com.threerings.parlor.card.trick.server
Class TrickCardGameManagerDelegate

java.lang.Object
  extended by com.threerings.crowd.server.PlaceManagerDelegate
      extended by com.threerings.parlor.server.PlayManagerDelegate
          extended by com.threerings.parlor.game.server.GameManagerDelegate
              extended by com.threerings.parlor.turn.server.TurnGameManagerDelegate
                  extended by com.threerings.parlor.card.trick.server.TrickCardGameManagerDelegate
All Implemented Interfaces:
TrickCardGameProvider, com.threerings.presents.server.InvocationProvider

public class TrickCardGameManagerDelegate
extends TurnGameManagerDelegate
implements TrickCardGameProvider

A card game manager delegate for trick-based card games, such as Spades and Hearts.


Constructor Summary
TrickCardGameManagerDelegate()
           
TrickCardGameManagerDelegate(CardGameManager manager)
          Deprecated. use the zero-argument constructor.
 
Method Summary
 void didInit(com.threerings.crowd.data.PlaceConfig config)
           
 void didStartup(com.threerings.crowd.data.PlaceObject plobj)
           
 void endHand()
          Ends the hand of cards.
 void endTrick()
          Ends the trick.
 void endTurn()
          Called to end the turn.
 void gameDidEnd()
          Called by the game manager after the game ended.
 void gameDidStart()
          Called when the game has started.
 void gameWillStart()
          Called by the game manager when the game is about to start.
 void init(com.threerings.crowd.server.PlaceManager plmgr, com.threerings.presents.dobj.RootDObjectManager omgr, com.threerings.presents.server.InvocationManager invmgr)
           
 void playCard(com.threerings.presents.data.ClientObject client, Card card, int handSize)
          Handles a TrickCardGameService.playCard(com.threerings.parlor.card.data.Card, int) request.
 void requestRematch(com.threerings.presents.data.ClientObject client)
          Handles a TrickCardGameService.requestRematch() request.
 void sendCardsToPlayer(com.threerings.presents.data.ClientObject client, int toidx, Card[] cards)
          Handles a TrickCardGameService.sendCardsToPlayer(int, com.threerings.parlor.card.data.Card[]) request.
 void startHand()
          Starts a hand of cards.
 void startTrick()
          Starts a trick.
 void startTurn()
          Called to start the next turn.
 
Methods inherited from class com.threerings.parlor.turn.server.TurnGameManagerDelegate
getTurnHolderIndex, isPlayersTurn, playerWasReplaced
 
Methods inherited from class com.threerings.parlor.game.server.GameManagerDelegate
gameWillEnd, gameWillReset, setAI, tickAI
 
Methods inherited from class com.threerings.crowd.server.PlaceManagerDelegate
bodyEntered, bodyLeft, bodyUpdated, didShutdown, placeBecameEmpty, where
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TrickCardGameManagerDelegate

public TrickCardGameManagerDelegate()

TrickCardGameManagerDelegate

@Deprecated
public TrickCardGameManagerDelegate(CardGameManager manager)
Deprecated. use the zero-argument constructor.

Method Detail

init

public void init(com.threerings.crowd.server.PlaceManager plmgr,
                 com.threerings.presents.dobj.RootDObjectManager omgr,
                 com.threerings.presents.server.InvocationManager invmgr)
Overrides:
init in class com.threerings.crowd.server.PlaceManagerDelegate

didInit

public void didInit(com.threerings.crowd.data.PlaceConfig config)
Overrides:
didInit in class TurnGameManagerDelegate

didStartup

public void didStartup(com.threerings.crowd.data.PlaceObject plobj)
Overrides:
didStartup in class TurnGameManagerDelegate

gameWillStart

public void gameWillStart()
Description copied from class: GameManagerDelegate
Called by the game manager when the game is about to start.

Overrides:
gameWillStart in class GameManagerDelegate

gameDidStart

public void gameDidStart()
Called when the game has started. Default implementation starts the first hand.

Overrides:
gameDidStart in class TurnGameManagerDelegate

gameDidEnd

public void gameDidEnd()
Description copied from class: GameManagerDelegate
Called by the game manager after the game ended.

Overrides:
gameDidEnd in class GameManagerDelegate

startTurn

public void startTurn()
Description copied from class: TurnGameManagerDelegate
Called to start the next turn. It calls 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.

Overrides:
startTurn in class TurnGameManagerDelegate

endTurn

public void endTurn()
Description copied from class: TurnGameManagerDelegate
Called to end the turn. Whatever indication a game manager has that the turn has ended (probably the submission of a valid move of some sort by the turn holding player), it should call this function to cause this turn to end and the next to begin.

If the game is no longer in play (see TurnGameObject.isInPlay()) after having called TurnGameManager.turnDidEnd() and TurnGameManagerDelegate.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 TurnGameManagerDelegate.setNextTurnHolder() set the TurnGameManagerDelegate._turnIdx field to -1 which will cause us to not start the next turn. To start things back up again it would set TurnGameManagerDelegate._turnIdx to the next turn holder and call TurnGameManagerDelegate.startTurn() itself.

Overrides:
endTurn in class TurnGameManagerDelegate

startHand

public void startHand()
Starts a hand of cards. Calls handWillStart(), sets the trick state to PLAYING_HAND, and calls handDidStart().


endHand

public void endHand()
Ends the hand of cards. Calls handWillEnd(), sets the trick state to BETWEEN_HANDS, and calls handDidEnd().


startTrick

public void startTrick()
Starts a trick. Calls trickWillStart(), sets the trick state to PLAYING_TRICK, and calls trickDidStart().


endTrick

public void endTrick()
Ends the trick. Calls trickWillEnd(), sets the trick state to PLAYING_HAND, and calls trickDidEnd().


sendCardsToPlayer

public void sendCardsToPlayer(com.threerings.presents.data.ClientObject client,
                              int toidx,
                              Card[] cards)
Description copied from interface: TrickCardGameProvider
Handles a TrickCardGameService.sendCardsToPlayer(int, com.threerings.parlor.card.data.Card[]) request.

Specified by:
sendCardsToPlayer in interface TrickCardGameProvider

playCard

public void playCard(com.threerings.presents.data.ClientObject client,
                     Card card,
                     int handSize)
Description copied from interface: TrickCardGameProvider
Handles a TrickCardGameService.playCard(com.threerings.parlor.card.data.Card, int) request.

Specified by:
playCard in interface TrickCardGameProvider

requestRematch

public void requestRematch(com.threerings.presents.data.ClientObject client)
Description copied from interface: TrickCardGameProvider
Handles a TrickCardGameService.requestRematch() request.

Specified by:
requestRematch in interface TrickCardGameProvider


Copyright © 2011. All Rights Reserved.