com.threerings.parlor.card.client
Class CardGameController

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.parlor.card.client.CardGameController
All Implemented Interfaces:
CardGameReceiver, CardCodes, TurnGameController, InvocationReceiver, InvocationCodes, AttributeChangeListener, ChangeListener, ActionListener, EventListener

public abstract class CardGameController
extends GameController
implements TurnGameController, CardCodes, CardGameReceiver

A controller class for card games. Handles common functions like accepting dealt hands.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.threerings.crowd.client.PlaceController
PlaceController.DelegateOp
 
Nested classes/interfaces inherited from class com.samskivert.swing.Controller
Controller.ActionInvoker
 
Nested classes/interfaces inherited from interface com.threerings.presents.client.InvocationReceiver
InvocationReceiver.Registration
 
Field Summary
 
Fields inherited from class com.threerings.parlor.game.client.GameController
_config, _ctx, _gameOver, _gobj
 
Fields inherited from class com.threerings.crowd.client.PlaceController
_delegates, _plobj, _view
 
Fields inherited from class com.samskivert.swing.Controller
DISPATCHER
 
Fields inherited from interface com.threerings.parlor.card.data.CardCodes
ACE, BLACK_JOKER, CLUBS, DIAMONDS, HEARTS, JACK, KING, QUEEN, RED_JOKER, SPADES
 
Fields inherited from interface com.threerings.presents.data.InvocationCodes
ACCESS_DENIED, E_ACCESS_DENIED, E_INTERNAL_ERROR, GLOBAL_GROUP, INTERNAL_ERROR
 
Constructor Summary
CardGameController()
           
 
Method Summary
 void cardsTransferredBetweenPlayers(int fromidx, int toidx, int cards)
          Dispatched to the client when a set of cards is transferred between two other players in the game.
 void didLeavePlace(PlaceObject plobj)
          Removes our listener registration from the game object and cleans house.
 void receivedCardsFromPlayer(int plidx, Card[] cards)
          Dispatched to the client when it has received a set of cards from another player.
 void receivedHand(Hand hand)
          Called when the server deals the client a new hand of cards.
 void receivedHand(int oid, Hand hand)
          Called by our sender to notify us of a received hand.
 void sentCardsToPlayer(int plidx, Card[] cards)
          Dispatched to the client when the server has forced it to send a set of cards to another player.
 void turnDidChange(Name turnHolder)
          Called when the turn changed.
 void willEnterPlace(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
attributeChanged, gameDidEnd, gameDidStart, gameWasCancelled, gameWillReset, getMatchType, getSessionId, handleAction, init, isGameOver, playerReady, resetGame, setGameOver, stateDidChange, systemMessage
 
Methods inherited from class com.threerings.crowd.client.PlaceController
addDelegate, applyToDelegates, createPlaceView, createPlaceView, didInit, getPlaceConfig, getPlaceView, mayLeavePlace
 
Methods inherited from class com.samskivert.swing.Controller
actionPerformed, configureAction, createActionButton, generateArguments, handleAction, handleAction, handleAction, postAction, postAction, postAction, setControlledPanel, wasAdded, wasRemoved
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CardGameController

public CardGameController()
Method Detail

willEnterPlace

public void willEnterPlace(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

didLeavePlace

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

Overrides:
didLeavePlace in class GameController

turnDidChange

public void turnDidChange(Name turnHolder)
Description copied from interface: TurnGameController
Called when the turn changed. This indicates the start of a turn and the user interface should adjust itself accordingly (activating controls if it is our turn and deactivating them if it is not).

Specified by:
turnDidChange in interface TurnGameController
Parameters:
turnHolder - the username of the new holder of the turn.

receivedHand

public final void receivedHand(int oid,
                               Hand hand)
Called by our sender to notify us of a received hand.

Specified by:
receivedHand in interface CardGameReceiver
Parameters:
oid - the oid of the game for which this hand applies
hand - the received hand

receivedHand

public void receivedHand(Hand hand)
Called when the server deals the client a new hand of cards. Default implementation does nothing.

Parameters:
hand - the hand dealt to the user

receivedCardsFromPlayer

public void receivedCardsFromPlayer(int plidx,
                                    Card[] cards)
Dispatched to the client when it has received a set of cards from another player. Default implementation does nothing.

Specified by:
receivedCardsFromPlayer in interface CardGameReceiver
Parameters:
plidx - the index of the player providing the cards
cards - the cards received

sentCardsToPlayer

public void sentCardsToPlayer(int plidx,
                              Card[] cards)
Dispatched to the client when the server has forced it to send a set of cards to another player. Default implementation does nothing.

Specified by:
sentCardsToPlayer in interface CardGameReceiver
Parameters:
plidx - the index of the player to which the cards were sent
cards - the cards sent

cardsTransferredBetweenPlayers

public void cardsTransferredBetweenPlayers(int fromidx,
                                           int toidx,
                                           int cards)
Dispatched to the client when a set of cards is transferred between two other players in the game. Default implementation does nothing.

Specified by:
cardsTransferredBetweenPlayers in interface CardGameReceiver
Parameters:
fromidx - the index of the player sending the cards
toidx - the index of the player receiving the cards
cards - the number of cards transferred