|
Blackjack | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--com.amoebacode.blackjack.display.DisplayElement
|
+--com.amoebacode.blackjack.display.HandDisplay
HandDisplay handles the display of a dealer or player hand, including the cards and current score label.
| Field Summary | |
private java.util.List |
cardDisplays
The list of card displays |
protected LabelWrapper |
currentScore
The wrapper for the label that draws the current score |
private IHand |
hand
The hand being displayed |
private boolean |
isAnimating
Indicates whether this hand is currently animating a card |
protected int |
xPos
The horizontal position of this hand |
protected int |
yPos
The vertical position of this hand |
| Fields inherited from class com.amoebacode.blackjack.display.DisplayElement |
parent |
| Constructor Summary | |
protected |
HandDisplay(ParticipantDisplay display)
Default protected constructor. |
| Method Summary | |
void |
addCard(BlackjackEvent event)
Adds a card to this hand display object. |
void |
clear(BlackjackEvent event)
Clears this hand display object. |
void |
clearCards()
Removes this hand's cards from the primary layered pane. |
void |
clearCurrentScore()
Removes this hand's score label from the primary layered pane. |
private void |
drawCard(CardDisplay aCard,
int index)
Draws the specified card at the specified index. |
protected void |
drawCard(IHand hand,
int index)
Draws the specified card in this hand. |
void |
drawCards(int cardIndex)
Draws the cards in this hand up to the specified index. |
protected CardDisplay |
getCardDisplay(ICard card)
Returns the card display corresponding to the specified card. |
protected CardDisplay |
getCardDisplayAt(int index)
Returns the card display at the specified index. |
protected abstract Coordinate |
getCoordinates()
Returns the horizontal and vertical position of this hand. |
int |
getCurrentScoreXPos()
Returns the horizontal position of the current score label. |
abstract int |
getCurrentScoreYPos()
Returns the vertical position of the current score label. |
protected IHand |
getHand()
Returns the hand being displayed. |
protected int |
getNumberOfCardDisplays()
Returns the number of card displays in this hand. |
void |
performAddCardAction(CardDisplay cd)
Adds the specified card to this hand and starts the card animation. |
void |
removeCard(BlackjackEvent event)
Removes a card from this hand display object. |
void |
resume(int cardIndex)
Draws the card at the specified index and when appropriate, plays the corresponding audio clip (called when card animation finishes). |
private void |
setCoordinates()
Sets the horizontal and vertical position of this hand. |
protected void |
setHand(IHand hand)
Sets the hand to display. |
protected void |
setupDisplay()
Sets up this hand's location and current score label. |
protected void |
startAnimatedCard()
Sets up the animation for the most recently added card. |
protected void |
stopAnimatedCard()
Turns off the card animation. |
| Methods inherited from class com.amoebacode.blackjack.display.DisplayElement |
executeGameCommand, getDisplayManager, getGameDisplay, getParent, hasParent, playGameClip, queueAction, resumeQueue |
| Methods inherited from class java.lang.Object |
|
| Field Detail |
protected int xPos
protected int yPos
private boolean isAnimating
protected LabelWrapper currentScore
private IHand hand
private java.util.List cardDisplays
| Constructor Detail |
protected HandDisplay(ParticipantDisplay display)
display - the parent ParticipantDisplay| Method Detail |
protected void setupDisplay()
protected void startAnimatedCard()
protected void stopAnimatedCard()
private void drawCard(CardDisplay aCard,
int index)
aCard - CardDisplay the card to drawindex - the index of the card to drawprivate void setCoordinates()
public int getCurrentScoreXPos()
protected abstract Coordinate getCoordinates()
public void drawCards(int cardIndex)
cardIndex - the index of the last card to draw
protected void drawCard(IHand hand,
int index)
index - the index of the card to drawpublic void addCard(BlackjackEvent event)
HandEventListeneraddCard in interface HandEventListenerHandEventListener.addCard(BlackjackEvent)public void performAddCardAction(CardDisplay cd)
cd - the CardDisplay to addpublic void clear(BlackjackEvent event)
HandEventListenerclear in interface HandEventListenerHandEventListener.clear(BlackjackEvent)public void clearCurrentScore()
public void clearCards()
public abstract int getCurrentScoreYPos()
protected IHand getHand()
protected void setHand(IHand hand)
hand - the IHand to displayprotected CardDisplay getCardDisplayAt(int index)
index - the index of the card display to returnprotected CardDisplay getCardDisplay(ICard card)
card - the ICard to matchpublic void removeCard(BlackjackEvent event)
HandEventListenerremoveCard in interface HandEventListenerHandEventListener.removeCard(BlackjackEvent)public void resume(int cardIndex)
cardIndex - the card to drawprotected int getNumberOfCardDisplays()
|
Blackjack | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||