|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.crowd.server.PlaceManagerDelegate
com.threerings.parlor.server.PlayManagerDelegate
com.threerings.parlor.game.server.GameManagerDelegate
com.threerings.parlor.turn.server.TurnGameManagerDelegate
com.threerings.parlor.card.trick.server.TrickCardGameManagerDelegate
public class TrickCardGameManagerDelegate
A card game manager delegate for trick-based card games, such as Spades and Hearts.
| Field Summary | |
|---|---|
protected CardGameObject |
_cardGame
The game object as card game. |
protected CardGameManager |
_cgmgr
The card game manager. |
protected Deck |
_deck
The deck from which cards are dealt. |
protected long |
_endTrickDelay
The amount of time to wait before ending the trick. |
protected Interval |
_endTrickInterval
Calls endTrick() upon expiration. |
protected Hand[] |
_hands
The hands of each player. |
protected TrickCardGameObject |
_trickCardGame
The game object as trick card game. |
protected boolean |
_turnTimedOut
Whether or not the turn timed out. |
protected Interval |
_turnTimeoutInterval
The all-purpose turn timeout interval. |
protected static float |
MINIMUM_TURN_DURATION_SCALE
Don't let turn duration scales get below this level. |
protected static float |
TURN_DURATION_SCALE_INCREASE
Turn duration scales increase by this amount each time the player doesn't time out. |
protected static float |
TURN_DURATION_SCALE_REDUCTION
Reduce turn duration scales by this amount each time the player times out. |
| Fields inherited from class com.threerings.parlor.turn.server.TurnGameManagerDelegate |
|---|
_tgmgr, _turnGame, _turnIdx |
| Fields inherited from class com.threerings.parlor.server.PlayManagerDelegate |
|---|
_gmgr |
| Fields inherited from class com.threerings.crowd.server.PlaceManagerDelegate |
|---|
_invmgr, _omgr, _plmgr |
| Constructor Summary | |
|---|---|
TrickCardGameManagerDelegate()
|
|
TrickCardGameManagerDelegate(CardGameManager manager)
Deprecated. use the zero-argument constructor. |
|
| Method Summary | |
|---|---|
protected boolean |
anyHandsEmpty()
Checks whether any hands are empty. |
protected void |
dealHands()
Deals hands to the players. |
void |
didInit(PlaceConfig config)
|
void |
didStartup(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. |
protected int |
getRematchRequestCount()
Returns the number of players currently requesting or accepting a rematch. |
protected void |
handDidEnd()
Notifies the object that the hand has ended. |
protected void |
handDidStart()
Notifies the object that a new hand has just started. |
protected void |
handWillEnd()
Notifies the object that the hand is about to end. |
protected void |
handWillStart()
Notifies the object that a new hand is about to start. |
protected void |
increaseTurnDurationScale(int pidx)
Increases the specified player's turn duration due to avoiding a time-out. |
void |
init(PlaceManager plmgr,
RootDObjectManager omgr,
InvocationManager invmgr)
|
protected boolean |
isTrickComplete()
Checks whether the trick is complete--that is, whether each player has played a card. |
protected Card |
pickRandomPlayableCard(Hand hand)
Returns a random playable card from the specified hand. |
void |
playCard(ClientObject client,
Card card,
int handSize)
Handles a TrickCardGameService.playCard(com.threerings.parlor.card.data.Card, int) request. |
protected void |
playCard(int pidx,
Card card)
Plays a card for a player without error checking. |
protected void |
prepareDeck()
Prepares the deck for a new hand of cards. |
protected void |
reduceTurnDurationScale(int pidx)
Reduces the specified player's turn duration due to a time-out. |
void |
requestRematch(ClientObject client)
Handles a TrickCardGameService.requestRematch() request. |
void |
sendCardsToPlayer(ClientObject client,
int toidx,
Card[] cards)
Handles a TrickCardGameService.sendCardsToPlayer(int, com.threerings.parlor.card.data.Card[]) request. |
protected void |
sendCardsToPlayer(int fromidx,
int toidx,
Card[] cards)
Sends cards between players without error checking. |
protected void |
setFirstTurnHolder()
This is called to determine which player will take the first turn. |
protected void |
setNextTurnHolder()
This is called to determine which player will next hold the turn. |
void |
startHand()
Starts a hand of cards. |
void |
startTrick()
Starts a trick. |
void |
startTurn()
Called to start the next turn. |
protected void |
trickDidEnd()
Notifies the object that the trick has ended. |
protected void |
trickDidStart()
Notifies the object that a new trick has started. |
protected void |
trickWillEnd()
Notifies the object that the trick is about to end. |
protected void |
trickWillStart()
Notifies the object that a new trick is about to start. |
protected void |
turnTimedOut()
Called when the current turn times out. |
| Methods inherited from class com.threerings.parlor.turn.server.TurnGameManagerDelegate |
|---|
assignTurnRandomly, getTurnHolderIndex, isPlayersTurn, playerWasReplaced |
| Methods inherited from class com.threerings.parlor.game.server.GameManagerDelegate |
|---|
gameWillEnd, gameWillReset, setAI, tickAI |
| Methods inherited from class com.threerings.parlor.server.PlayManagerDelegate |
|---|
isAgent, isPlayer, verifyIsPlayer, verifyIsPlayerOrAgent, verifyWritePermission |
| Methods inherited from class com.threerings.crowd.server.PlaceManagerDelegate |
|---|
addDispatcher, addProvider, bodyEntered, bodyLeft, bodyUpdated, didShutdown, placeBecameEmpty, where |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Interval _turnTimeoutInterval
protected Interval _endTrickInterval
endTrick() upon expiration.
protected CardGameManager _cgmgr
protected TrickCardGameObject _trickCardGame
protected CardGameObject _cardGame
protected long _endTrickDelay
protected Deck _deck
protected Hand[] _hands
protected boolean _turnTimedOut
protected static final float TURN_DURATION_SCALE_REDUCTION
protected static final float TURN_DURATION_SCALE_INCREASE
protected static final float MINIMUM_TURN_DURATION_SCALE
| Constructor Detail |
|---|
public TrickCardGameManagerDelegate()
@Deprecated public TrickCardGameManagerDelegate(CardGameManager manager)
| Method Detail |
|---|
public void init(PlaceManager plmgr,
RootDObjectManager omgr,
InvocationManager invmgr)
init in class PlaceManagerDelegatepublic void didInit(PlaceConfig config)
didInit in class TurnGameManagerDelegatepublic void didStartup(PlaceObject plobj)
didStartup in class TurnGameManagerDelegatepublic void gameWillStart()
GameManagerDelegate
gameWillStart in class GameManagerDelegatepublic void gameDidStart()
gameDidStart in class TurnGameManagerDelegatepublic void gameDidEnd()
GameManagerDelegate
gameDidEnd in class GameManagerDelegatepublic void startTurn()
TurnGameManagerDelegateTurnGameManager.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.
startTurn in class TurnGameManagerDelegatepublic void endTurn()
TurnGameManagerDelegate
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.
endTurn in class TurnGameManagerDelegatepublic void startHand()
handWillStart(), sets the trick
state to PLAYING_HAND, and calls handDidStart().
public void endHand()
handWillEnd(), sets the trick
state to BETWEEN_HANDS, and calls handDidEnd().
public void startTrick()
trickWillStart(), sets the trick
state to PLAYING_TRICK, and calls trickDidStart().
public void endTrick()
trickWillEnd(), sets the trick
state to PLAYING_HAND, and calls trickDidEnd().
public void sendCardsToPlayer(ClientObject client,
int toidx,
Card[] cards)
TrickCardGameProviderTrickCardGameService.sendCardsToPlayer(int, com.threerings.parlor.card.data.Card[]) request.
sendCardsToPlayer in interface TrickCardGameProvider
public void playCard(ClientObject client,
Card card,
int handSize)
TrickCardGameProviderTrickCardGameService.playCard(com.threerings.parlor.card.data.Card, int) request.
playCard in interface TrickCardGameProviderpublic void requestRematch(ClientObject client)
TrickCardGameProviderTrickCardGameService.requestRematch() request.
requestRematch in interface TrickCardGameProvider
protected void sendCardsToPlayer(int fromidx,
int toidx,
Card[] cards)
CardGameManager.transferCardsBetweenPlayers(int, int, Card[]).
protected void playCard(int pidx,
Card card)
protected int getRematchRequestCount()
protected boolean isTrickComplete()
protected void setFirstTurnHolder()
TurnGameManagerDelegate
setFirstTurnHolder in class TurnGameManagerDelegateprotected void setNextTurnHolder()
TurnGameManagerDelegate_turnIdx field, not set
the turn holder field in the game object directly.
setNextTurnHolder in class TurnGameManagerDelegateprotected void turnTimedOut()
protected void reduceTurnDurationScale(int pidx)
protected void increaseTurnDurationScale(int pidx)
protected Card pickRandomPlayableCard(Hand hand)
protected void handWillStart()
protected void handDidStart()
protected void prepareDeck()
protected void dealHands()
protected void handWillEnd()
protected void handDidEnd()
protected void trickWillStart()
protected void trickDidStart()
protected void trickWillEnd()
protected void trickDidEnd()
protected boolean anyHandsEmpty()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||