unc.cdva.renderingengine.gui
Class UIManager

java.lang.Object
  extended by unc.cdva.renderingengine.gui.UIManager
All Implemented Interfaces:
java.util.EventListener, UIEventListener

public class UIManager
extends java.lang.Object
implements UIEventListener

This manager takes care of the UI. It creates the windows removes the windows, update the UI elements, etc... Implemented as a singleton

Author:
Guillaume Conte

Method Summary
 void addFireReticleMenu(Id id)
          Display a dialog to let a user fire the gun
 void addReticleMenu(UIEvent event)
          Display a dialog to set the user input value for a problem
 java.lang.String createScoreString(long score, int size)
          Transform a number into a string of the specified length by adding as many 0 before the number
 void endGame(UIEvent event)
          Invoked when you set the game ends
 void endLevel(UIEvent event)
          Invoked when a level ends
 void freezeFireWindows(UIEvent event)
          Invoked when you fire, and block the other windows
 void gameMenu()
          Load the GUI elements of the Game Menu
static UIManager getInstance(org.fenggui.Display display, java.awt.Dimension screenResolution, FengGUIEventRouter fengGUIEventRouter)
          Initialize UIManager and return the singleton
 java.lang.String getMusicFolder()
           
 void mainMenu(UIEvent uiEvent)
          Load the GUI element of the Main Menu
 void optionMenu()
          Load the GUI element of the Option Menu
 void setHighScoreLabel(UIEvent event, long highScore)
          Invoked when you set the high score label
 void setLevelLabel(UIEvent event, long level)
          Invoked when you set the level label
 void setMusicFolder(UIEvent event, java.lang.String musicFolder)
           
 void setScoreLabel(UIEvent ui, long score)
          Invoked when you set the score label
protected  void showSoundOptionMenu()
          Load and show the sound option dialog
 void unfreezeFireWindows(UIEvent event)
          Invoked when you fire, and block the other windows
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static UIManager getInstance(org.fenggui.Display display,
                                    java.awt.Dimension screenResolution,
                                    FengGUIEventRouter fengGUIEventRouter)
Initialize UIManager and return the singleton

Parameters:
display - root element of the GUI
screenResolution - current screen resolution
fengGUIEventRouterGameEvent - source used to send events to the GameEventProcessor
Returns:
singleton UIManager

mainMenu

public void mainMenu(UIEvent uiEvent)
Load the GUI element of the Main Menu

Specified by:
mainMenu in interface UIEventListener
Parameters:
uiEvent - UIEvent sent by an UIEvent source
See Also:
UIEvent

optionMenu

public void optionMenu()
Load the GUI element of the Option Menu


gameMenu

public void gameMenu()
Load the GUI elements of the Game Menu


showSoundOptionMenu

protected void showSoundOptionMenu()
Load and show the sound option dialog


addReticleMenu

public void addReticleMenu(UIEvent event)
Display a dialog to set the user input value for a problem

Specified by:
addReticleMenu in interface UIEventListener
See Also:
UIEvent

addFireReticleMenu

public void addFireReticleMenu(Id id)
Display a dialog to let a user fire the gun

Parameters:
id - id of the current problem

setHighScoreLabel

public void setHighScoreLabel(UIEvent event,
                              long highScore)
Description copied from interface: UIEventListener
Invoked when you set the high score label

Specified by:
setHighScoreLabel in interface UIEventListener
highScore - new hi-score
See Also:
UIEventListener.setHighScoreLabel(unc.cdva.events.uievents.UIEvent,long)

setLevelLabel

public void setLevelLabel(UIEvent event,
                          long level)
Description copied from interface: UIEventListener
Invoked when you set the level label

Specified by:
setLevelLabel in interface UIEventListener
level - new level label
See Also:
UIEventListener.setLevelLabel(unc.cdva.events.uievents.UIEvent,long)

setScoreLabel

public void setScoreLabel(UIEvent ui,
                          long score)
Description copied from interface: UIEventListener
Invoked when you set the score label

Specified by:
setScoreLabel in interface UIEventListener
score - new score label
See Also:
UIEventListener.setScoreLabel(unc.cdva.events.uievents.UIEvent,long)

createScoreString

public java.lang.String createScoreString(long score,
                                          int size)
Transform a number into a string of the specified length by adding as many 0 before the number

Parameters:
score - value of the score
size - size of the resulting string
Returns:
String of score of length size

endGame

public void endGame(UIEvent event)
Description copied from interface: UIEventListener
Invoked when you set the game ends

Specified by:
endGame in interface UIEventListener
See Also:
UIEventListener.endGame(unc.cdva.events.uievents.UIEvent)

endLevel

public void endLevel(UIEvent event)
Description copied from interface: UIEventListener
Invoked when a level ends

Specified by:
endLevel in interface UIEventListener
See Also:
UIEventListener.endLevel(unc.cdva.events.uievents.UIEvent)

getMusicFolder

public java.lang.String getMusicFolder()
Returns:
the musicFolder

setMusicFolder

public void setMusicFolder(UIEvent event,
                           java.lang.String musicFolder)
Parameters:
musicFolder - the musicFolder to set

freezeFireWindows

public void freezeFireWindows(UIEvent event)
Description copied from interface: UIEventListener
Invoked when you fire, and block the other windows

Specified by:
freezeFireWindows in interface UIEventListener
See Also:
UIEventListener.freezeFireWindows(unc.cdva.events.uievents.UIEvent)

unfreezeFireWindows

public void unfreezeFireWindows(UIEvent event)
Description copied from interface: UIEventListener
Invoked when you fire, and block the other windows

Specified by:
unfreezeFireWindows in interface UIEventListener
See Also:
UIEventListener.unfreezeFireWindows(unc.cdva.events.uievents.UIEvent)