Blackjack

com.amoebacode.blackjack.display
Class GameDisplay

java.lang.Object
  |
  +--com.amoebacode.blackjack.display.DisplayElement
        |
        +--com.amoebacode.blackjack.display.GameDisplay
All Implemented Interfaces:
BlackjackEventListener, java.util.EventListener, GameEventListener

public class GameDisplay
extends DisplayElement
implements GameEventListener

GameDisplay manages the display of all game elements, including the round, deck preferences, basic strategy tutor, and house rules.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  ActionQueue actionQueue
          The list of display actions to perform
private  LabelWrapper balanceLabel
          The current balance text label
private  LabelWrapper betLabel
          The current bet text label
private  DeckDisplay deckDisplay
          The display for the set of cards to be dealt
private  DisplayManager display
          The current display manager
private  DisplayPreferences displayPrefs
          The display preferences
private  IGame game
          The game being displayed
private  GameButtonSet gameButtonSet
          The set of game buttons (deal, shuffle, raise bet, etc.)
private  HouseRulesDisplay houseRulesDisplay
          The display for the set of casino options
private  PreferencesDisplay prefsDisplay
          The display for the set of game preferences
private  RoundDisplay roundDisplay
          The display for current round of play
private  BasicStrategyDisplay stratDisplay
          The basic strategy tutor
 
Fields inherited from class com.amoebacode.blackjack.display.DisplayElement
parent
 
Constructor Summary
GameDisplay(DisplayManager display)
          Default public constructor.
 
Method Summary
 void deal()
          Executes a deal command.
protected  void executeCommand(ICommand command)
          Sends the specified command to the game object for execution.
 DisplayManager getDisplayManager()
          Returns the display manager from the game display.
protected  DisplayPreferences getDisplayPreferences()
          Returns the current set of display preferences.
 void hideBasicStrategy()
          Hides the basic strategy labels.
 void hideButtons()
          Hides the game buttons.
 void hideOptions()
          Hides the casino options and displays the game buttons.
 void hidePreferences()
          Hides the preferences options and displays the game buttons.
 void lowerBet()
          Executes a lower bet command.
 void performUpdateBalanceLabelAction()
          Updates the current balance label and resumes the action queue.
 void performUpdateCommandsAction(AvailableGameCommands availableCommands)
          Updates the game buttons with the specified set of available commands and resumes the action queue.
protected  void playClip(java.lang.String audioClip)
          Plays the specified audio clip.
protected  void queueAction(QueueableAction action)
          Sends the specified action to the action queue.
 void raiseBet()
          Executes a raise bet command.
protected  void resumeQueue()
          Resumes the game display queue.
 void saveOptions()
          Saves and hides the user-selected casino options.
 void setBasicStrategy(BlackjackEvent event)
          Sets the basic strategy tutor in this game display object.
 void setDeck(BlackjackEvent event)
          Sets the deck in this game display object.
 void setGame(IGame game)
          Sets the game to display
 void setHouseRules(BlackjackEvent event)
          Sets the casino options in this game display object.
 void setPreferences(BlackjackEvent event)
          Sets the user preferences in this game display object.
 void setRound(BlackjackEvent event)
          Sets the round in this game display object.
private  void setupDisplayElements()
          Sets up the various display elements, including the current round, the shoe of cards, the user preferences, the basic strategy tutor, the casino options, and the game buttons.
 void showOptions()
          Displays the casino options and hides the game buttons.
 void showPreferences()
          Displays the preferences options and hides the game buttons.
 void shuffle()
          Executes a shuffle command.
 void updateAvailableCommands(BlackjackEvent event)
          Updates the set of commands available to this game display object.
 void updateBalanceLabel(BlackjackEvent event)
          Updates the current balance label in this game display object.
 void updateBetLabel(BlackjackEvent event)
          Updates the initial bet label in this game display object.
 
Methods inherited from class com.amoebacode.blackjack.display.DisplayElement
executeGameCommand, getGameDisplay, getParent, hasParent, playGameClip
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

display

private DisplayManager display
The current display manager

game

private IGame game
The game being displayed

roundDisplay

private RoundDisplay roundDisplay
The display for current round of play

deckDisplay

private DeckDisplay deckDisplay
The display for the set of cards to be dealt

prefsDisplay

private PreferencesDisplay prefsDisplay
The display for the set of game preferences

displayPrefs

private DisplayPreferences displayPrefs
The display preferences

houseRulesDisplay

private HouseRulesDisplay houseRulesDisplay
The display for the set of casino options

stratDisplay

private BasicStrategyDisplay stratDisplay
The basic strategy tutor

actionQueue

private ActionQueue actionQueue
The list of display actions to perform

balanceLabel

private LabelWrapper balanceLabel
The current balance text label

betLabel

private LabelWrapper betLabel
The current bet text label

gameButtonSet

private GameButtonSet gameButtonSet
The set of game buttons (deal, shuffle, raise bet, etc.)
Constructor Detail

GameDisplay

public GameDisplay(DisplayManager display)
Default public constructor.
Parameters:
display - the current DisplayManager
Method Detail

setupDisplayElements

private void setupDisplayElements()
Sets up the various display elements, including the current round, the shoe of cards, the user preferences, the basic strategy tutor, the casino options, and the game buttons.

getDisplayManager

public DisplayManager getDisplayManager()
Description copied from class: DisplayElement
Returns the display manager from the game display.
Overrides:
getDisplayManager in class DisplayElement
See Also:
DisplayElement.getDisplayManager()

setGame

public void setGame(IGame game)
Sets the game to display
Parameters:
game - the IGame to display

setDeck

public void setDeck(BlackjackEvent event)
Description copied from interface: GameEventListener
Sets the deck in this game display object.
Specified by:
setDeck in interface GameEventListener
See Also:
GameEventListener.setDeck(BlackjackEvent)

setPreferences

public void setPreferences(BlackjackEvent event)
Description copied from interface: GameEventListener
Sets the user preferences in this game display object.
Specified by:
setPreferences in interface GameEventListener
See Also:
GameEventListener.setPreferences(BlackjackEvent)

setHouseRules

public void setHouseRules(BlackjackEvent event)
Description copied from interface: GameEventListener
Sets the casino options in this game display object.
Specified by:
setHouseRules in interface GameEventListener
See Also:
GameEventListener.setHouseRules(BlackjackEvent)

setBasicStrategy

public void setBasicStrategy(BlackjackEvent event)
Description copied from interface: GameEventListener
Sets the basic strategy tutor in this game display object.
Specified by:
setBasicStrategy in interface GameEventListener
See Also:
GameEventListener.setBasicStrategy(BlackjackEvent)

getDisplayPreferences

protected DisplayPreferences getDisplayPreferences()
Returns the current set of display preferences.
Returns:
the current DisplayPreferences

hidePreferences

public void hidePreferences()
Hides the preferences options and displays the game buttons.

showPreferences

public void showPreferences()
Displays the preferences options and hides the game buttons.

hideBasicStrategy

public void hideBasicStrategy()
Hides the basic strategy labels.

deal

public void deal()
Executes a deal command.

lowerBet

public void lowerBet()
Executes a lower bet command.

raiseBet

public void raiseBet()
Executes a raise bet command.

saveOptions

public void saveOptions()
Saves and hides the user-selected casino options.

shuffle

public void shuffle()
Executes a shuffle command.

updateAvailableCommands

public void updateAvailableCommands(BlackjackEvent event)
Description copied from interface: GameEventListener
Updates the set of commands available to this game display object.
Specified by:
updateAvailableCommands in interface GameEventListener
See Also:
GameEventListener.updateAvailableCommands(BlackjackEvent)

performUpdateCommandsAction

public void performUpdateCommandsAction(AvailableGameCommands availableCommands)
Updates the game buttons with the specified set of available commands and resumes the action queue.
Parameters:
availableCommands - the available game commands

hideOptions

public void hideOptions()
Hides the casino options and displays the game buttons.

showOptions

public void showOptions()
Displays the casino options and hides the game buttons.

updateBetLabel

public void updateBetLabel(BlackjackEvent event)
Description copied from interface: GameEventListener
Updates the initial bet label in this game display object.
Specified by:
updateBetLabel in interface GameEventListener
See Also:
GameEventListener.updateBetLabel(BlackjackEvent)

updateBalanceLabel

public void updateBalanceLabel(BlackjackEvent event)
Description copied from interface: GameEventListener
Updates the current balance label in this game display object.
Specified by:
updateBalanceLabel in interface GameEventListener
See Also:
GameEventListener.updateBalanceLabel(BlackjackEvent)

performUpdateBalanceLabelAction

public void performUpdateBalanceLabelAction()
Updates the current balance label and resumes the action queue.

executeCommand

protected void executeCommand(ICommand command)
Sends the specified command to the game object for execution.
Parameters:
command - the ICommand to execute

queueAction

protected void queueAction(QueueableAction action)
Sends the specified action to the action queue.
Overrides:
queueAction in class DisplayElement
Parameters:
action - the QueueableAction to perform

resumeQueue

protected void resumeQueue()
Description copied from class: DisplayElement
Resumes the game display queue.
Overrides:
resumeQueue in class DisplayElement
See Also:
DisplayElement.resumeQueue()

playClip

protected void playClip(java.lang.String audioClip)
Plays the specified audio clip.
Parameters:
audioClip - the name of the clip to play

hideButtons

public void hideButtons()
Hides the game buttons.

setRound

public void setRound(BlackjackEvent event)
Description copied from interface: GameEventListener
Sets the round in this game display object.
Specified by:
setRound in interface GameEventListener
See Also:
GameEventListener.setRound(BlackjackEvent)

Blackjack

Copyright © 2002 amoebacode.com.