|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.crowd.server.PlaceManager
com.threerings.parlor.game.server.GameManager
com.threerings.parlor.card.server.CardGameManager
public class CardGameManager
A manager class for card games. Handles common functions like dealing hands of cards to all players.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from class com.threerings.crowd.server.PlaceManager |
|---|
PlaceManager.DelegateOp, PlaceManager.MessageHandler |
| Field Summary | |
|---|---|
protected CardGameObject |
_cardgameobj
The card game object. |
protected int[] |
_oldPlayerOids
The oids of the players from our now-ended game. |
| Fields inherited from class com.threerings.parlor.game.server.GameManager |
|---|
_AIs, _aiTicker, _committedState, _gameconfig, _gameEndTracker, _gameobj, _noShowInterval, _pendingOids, _playerCount, _playerOids, _postponedStart, _startmsgs, _stateListener, _tickInterval, AI_TICK_DELAY, DEFAULT_NOSHOW_DELAY, TICK_DELAY |
| Fields inherited from class com.threerings.crowd.server.PlaceManager |
|---|
_bodyUpdater, _config, _deathListener, _delegates, _dispatcher, _dispatcherFinders, _injector, _invmgr, _locator, _marshallers, _msghandlers, _occInfo, _occListener, _omgr, _plobj, _registry, _shutdownInterval |
| 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 |
| Fields inherited from interface com.threerings.parlor.data.ParlorCodes |
|---|
ALREADY_AT_TABLE, BANNED_FROM_TABLE, GAME_ALREADY_STARTED, INVALID_TABLE_POSITION, INVITATION_ACCEPTED, INVITATION_COUNTERED, INVITATION_REFUSED, INVITEE_NOT_ONLINE, MUST_BE_CREATOR, NO_SELF_BOOT, NO_SUCH_TABLE, NOT_AT_TABLE, PARLOR_GROUP, TABLE_POSITION_OCCUPIED |
| Fields inherited from interface com.threerings.parlor.game.data.GameCodes |
|---|
GAME_CHAT_TYPE, GAME_MESSAGE_BUNDLE, PLAYER_KNOCKED_OUT, WINNERS_AND_LOSERS |
| Constructor Summary | |
|---|---|
CardGameManager()
|
|
| Method Summary | |
|---|---|
Hand |
dealHand(Deck deck,
int size,
int playerIndex)
Deals a hand of cards to the player at the specified index from the given Deck. |
Hand[] |
dealHands(Deck deck,
int size)
Deals a hand of cards to each player from the specified Deck. |
protected void |
didStartup()
|
protected void |
gameDidEnd()
Called after the game has transitioned to the GameObject.GAME_OVER state. |
protected boolean |
gameWillRematch()
Derived classes can override this method and take any action needed prior to a game rematch. |
ClientObject |
getClientObject(int pidx)
Returns the client object corresponding to the specified player index, or null if the position is not occupied by a player. |
int |
getPlayerIndex(ClientObject client)
Gets the player index of the specified client object, or -1 if the client object does not represent a player. |
protected void |
notifyCardsTransferred(int fromPlayerIdx,
int toPlayerIdx,
int cards)
Notifies everyone in the room (other than the sender and the receiver) that a set of cards have been transferred. |
void |
rematchGame()
This should be called to start a rematched game. |
void |
transferCardsBetweenPlayers(int[] toPlayerIndices,
Card[][] cards)
Sends sets of cards between players simultaneously. |
void |
transferCardsBetweenPlayers(int fromPlayerIdx,
int toPlayerIdx,
Card[] cards)
Sends a set of cards from one player to another. |
void |
turnDidEnd()
Called when the turn was ended. |
void |
turnDidStart()
Called when we have started the next turn. |
void |
turnWillStart()
Called when we are about to start the next turn. |
| Methods inherited from class com.threerings.crowd.server.PlaceManager |
|---|
addDelegate, addDispatcher, addOccupantInfo, addProvider, applyToDelegates, applyToOccupants, bodyEntered, bodyUpdated, bodyWillEnter, bodyWillLeave, cancelShutdowner, checkPermissions, createPlaceObject, createSpeakHandler, getAccessController, getConfig, getLocation, getPlaceObject, getPlaceObjectClass, idleUnloadPeriod, init, isValidSpeaker, messageReceived, permissionsFailed, ratifyBodyEntry, registerMessageHandler, shouldCreateSpeakService, shouldDeclareEmpty, shutdown, startup, toString, toString, updateOccupantInfo, where |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Methods inherited from interface com.threerings.parlor.turn.server.TurnGameManager |
|---|
getPlayerCount, getPlayerIndex, getPlayerName, isActivePlayer |
| Field Detail |
|---|
protected CardGameObject _cardgameobj
protected int[] _oldPlayerOids
| Constructor Detail |
|---|
public CardGameManager()
| Method Detail |
|---|
protected void didStartup()
didStartup in class GameManagerpublic void turnWillStart()
TurnGameManager
turnWillStart in interface TurnGameManagerpublic void turnDidStart()
TurnGameManager
turnDidStart in interface TurnGameManagerpublic void turnDidEnd()
TurnGameManager
turnDidEnd in interface TurnGameManagerprotected void gameDidEnd()
GameManagerGameObject.GAME_OVER state. Derived
classes should override this to perform any post-game activities, but should be sure to call
super.gameDidEnd().
gameDidEnd in class GameManagerpublic void rematchGame()
protected boolean gameWillRematch()
public Hand dealHand(Deck deck,
int size,
int playerIndex)
deck - the deck from which to dealsize - the size of the hand to dealplayerIndex - the index of the target player
public Hand[] dealHands(Deck deck,
int size)
deck - the deck from which to dealsize - the size of the hands to deal
public int getPlayerIndex(ClientObject client)
public ClientObject getClientObject(int pidx)
public void transferCardsBetweenPlayers(int fromPlayerIdx,
int toPlayerIdx,
Card[] cards)
fromPlayerIdx - the index of the player sending the cardstoPlayerIdx - the index of the player receiving the cardscards - the cards to be exchanged
public void transferCardsBetweenPlayers(int[] toPlayerIndices,
Card[][] cards)
toPlayerIndices - for each player, the index of the player to transfer cards tocards - for each player, the cards to transfer
protected void notifyCardsTransferred(int fromPlayerIdx,
int toPlayerIdx,
int cards)
fromPlayerIdx - the index of the player sending the cardstoPlayerIdx - the index of the player receiving the cardscards - the number of cards sent
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||