|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.freecol.client.FreeColClient
public final class FreeColClient
The main control class for the FreeCol client. This class both starts and keeps references to the GUI and the control objects.
| Field Summary | |
|---|---|
private ActionManager |
actionManager
|
private Canvas |
canvas
|
private Client |
client
The network Client that can be used to send messages to
the server. |
private ClientOptions |
clientOptions
|
private ConnectController |
connectController
|
private javax.swing.JFrame |
frame
|
private FreeColServer |
freeColServer
The Server that has been started from the client-GUI. |
private Game |
game
|
private java.awt.GraphicsDevice |
gd
|
private GUI |
gui
|
private boolean |
headless
Describe headless here. |
private ImageLibrary |
imageLibrary
|
private InGameController |
inGameController
|
private InGameInputHandler |
inGameInputHandler
|
private boolean |
isRetired
|
private boolean |
loggedIn
Indicated whether or not there is an open connection to the server. |
private static java.util.logging.Logger |
logger
|
private boolean |
mapEditor
|
private MapEditorController |
mapEditorController
|
private ClientModelController |
modelController
|
private MusicLibrary |
musicLibrary
|
private SoundPlayer |
musicPlayer
|
private Player |
player
The player "owning" this client. |
private PreGameController |
preGameController
|
private PreGameInputHandler |
preGameInputHandler
|
private SfxLibrary |
sfxLibrary
|
private SoundPlayer |
sfxPlayer
|
private boolean |
singleplayer
|
private java.awt.Rectangle |
windowBounds
|
private boolean |
windowed
|
Worker |
worker
|
| Constructor Summary | |
|---|---|
FreeColClient(boolean windowed,
java.awt.Dimension innerWindowSize,
ImageLibrary imageLibrary,
MusicLibrary musicLibrary,
SfxLibrary sfxLibrary,
boolean showOpeningVideo)
Creates a new FreeColClient. |
|
| Method Summary | |
|---|---|
boolean |
canPlayMusic()
Verifies if the client can play music |
boolean |
canSaveCurrentGame()
Verifies if this client can save the current game Clients that do not have the server running, or that have not the required permissions cannot save and should have the menu entry disabled |
void |
changeWindowedMode(boolean windowed)
Change the windowed mode. |
void |
continuePlaying()
Continue playing after win the game |
ActionManager |
getActionManager()
Gets the object responsible for keeping and updating the actions. |
Canvas |
getCanvas()
Gets the Canvas this client uses to display the
GUI-components. |
Client |
getClient()
Gets the Client that can be used to send messages to the
server. |
ClientOptions |
getClientOptions()
Returns the object keeping the current client options. |
ConnectController |
getConnectController()
Gets the controller responsible for starting a server and connecting to it. |
javax.swing.JFrame |
getFrame()
Describe getFrame method here. |
FreeColServer |
getFreeColServer()
Gets the FreeColServer started by the client. |
Game |
getGame()
Gets the Game that we are currently playing. |
GUI |
getGUI()
Gets the GUI that is being used to draw the map on the
Canvas. |
ImageLibrary |
getImageLibrary()
Gets the ImageLibrary. |
InGameController |
getInGameController()
Gets the controller that will be used when the game has been started. |
InGameInputHandler |
getInGameInputHandler()
Gets the input handler that will be used when the game has been started. |
MapEditorController |
getMapEditorController()
|
ClientModelController |
getModelController()
Gets the ClientModelController. |
Player |
getMyPlayer()
Gets the Player that uses this client. |
PreGameController |
getPreGameController()
Gets the controller that will be used before the game has been started. |
PreGameInputHandler |
getPreGameInputHandler()
Gets the input handler that will be used before the game has been started. |
boolean |
isAdmin()
Checks if this client is the game admin. |
boolean |
isHeadless()
Get the Headless value. |
boolean |
isLoggedIn()
Returns true if this client is logged in to a server or false otherwise. |
boolean |
isMapEditor()
|
boolean |
isRetired()
Has the user retired the game. |
boolean |
isSingleplayer()
Is the user playing in singleplayer mode. |
boolean |
isWindowed()
Checks if the application is displayed in a window. |
void |
loadClientOptions()
Reads the ClientOptions from the given file. |
void |
loadClientOptions(java.io.File loadFile)
Reads the ClientOptions from the given file. |
void |
playMusic(java.lang.String music)
Plays the music. |
void |
playMusicOnce(java.lang.String music)
Plays a random music from the given playlist. |
void |
playMusicOnce(java.lang.String music,
int delay)
Plays a random music from the given playlist. |
void |
playSound(SoundLibrary.SoundEffect sound)
Plays the given sound effect. |
void |
playSound(java.lang.String sound)
Plays the given sound effect. |
void |
quit()
Quits the application without any questions. |
boolean |
retire()
Retires the player from the game. |
void |
saveClientOptions()
Writes the client options to the default location. |
void |
saveClientOptions(java.io.File saveFile)
Writes the client options to the given file. |
void |
setClient(Client client)
Sets the Client that shall be used to send messages to the
server. |
void |
setFreeColServer(FreeColServer freeColServer)
Sets the FreeColServer which has been started by the
client gui. |
void |
setGame(Game game)
Sets the Game that we are currently playing. |
void |
setHeadless(boolean newHeadless)
Set the Headless value. |
void |
setIsRetired(boolean isRetired)
Sets whether or not the user has retired the game. |
void |
setLoggedIn(boolean loggedIn)
Sets whether or not this client is logged in to a server. |
void |
setMapEditor(boolean mapEditor)
|
void |
setMyPlayer(Player player)
Sets the Player that uses this client. |
void |
setSingleplayer(boolean singleplayer)
Sets whether or not this game is a singleplayer game. |
private void |
startGUI(java.awt.Dimension innerWindowSize,
boolean showOpeningVideo)
Starts the GUI by creating and displaying the GUI-objects. |
void |
updateMenuBar()
Describe updateMenuBar method here. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
private ConnectController connectController
private PreGameController preGameController
private PreGameInputHandler preGameInputHandler
private InGameController inGameController
private InGameInputHandler inGameInputHandler
private ClientModelController modelController
private MapEditorController mapEditorController
private java.awt.GraphicsDevice gd
private javax.swing.JFrame frame
private Canvas canvas
private GUI gui
private ImageLibrary imageLibrary
private MusicLibrary musicLibrary
private SfxLibrary sfxLibrary
private SoundPlayer musicPlayer
private SoundPlayer sfxPlayer
private Client client
Client that can be used to send messages to
the server.
private Game game
private Player player
private boolean isRetired
private FreeColServer freeColServer
private boolean windowed
private boolean mapEditor
private boolean singleplayer
private final ActionManager actionManager
private ClientOptions clientOptions
public final Worker worker
private boolean loggedIn
private java.awt.Rectangle windowBounds
private boolean headless
| Constructor Detail |
|---|
public FreeColClient(boolean windowed,
java.awt.Dimension innerWindowSize,
ImageLibrary imageLibrary,
MusicLibrary musicLibrary,
SfxLibrary sfxLibrary,
boolean showOpeningVideo)
FreeColClient. Creates the control objects
and starts the GUI.
windowed - Determines if the Canvas should be
displayed within a JFrame (when
true) or in fullscreen mode (when
false).innerWindowSize - The inner size of the window (borders not included).imageLibrary - The object holding the images.musicLibrary - The object holding the music.sfxLibrary - The object holding the sound effects.showOpeningVideo - Display the opening video.| Method Detail |
|---|
private void startGUI(java.awt.Dimension innerWindowSize,
boolean showOpeningVideo)
public boolean isHeadless()
Headless value.
boolean valuepublic void setHeadless(boolean newHeadless)
Headless value.
newHeadless - The new Headless value.public boolean canSaveCurrentGame()
public javax.swing.JFrame getFrame()
getFrame method here.
JFrame valuepublic void updateMenuBar()
updateMenuBar method here.
public void changeWindowedMode(boolean windowed)
windowed - Use true for windowed mode
and false for fullscreen mode.public boolean isWindowed()
true if the application is currently
displayed in a frame, and false if
currently in fullscreen mode.changeWindowedMode(boolean)public void saveClientOptions()
ClientOptionspublic void setMapEditor(boolean mapEditor)
public boolean isMapEditor()
public void saveClientOptions(java.io.File saveFile)
saveFile - The file where the client options should be written.ClientOptionspublic ImageLibrary getImageLibrary()
ImageLibrary.
ImageLibrary.public void loadClientOptions()
ClientOptions from the given file.
public void loadClientOptions(java.io.File loadFile)
ClientOptions from the given file.
loadFile - The File to read the
ClientOptions from.public ActionManager getActionManager()
ActionManager.public ClientOptions getClientOptions()
ClientOptions.public MapEditorController getMapEditorController()
public Player getMyPlayer()
Player that uses this client.
Player made to represent this clients user.setMyPlayer(Player)public void setMyPlayer(Player player)
Player that uses this client.
player - The Player made to represent this clients
user.getMyPlayer()public void setFreeColServer(FreeColServer freeColServer)
FreeColServer which has been started by the
client gui.
freeColServer - The FreeColServer.getFreeColServer()public FreeColServer getFreeColServer()
FreeColServer started by the client.
FreeColServer or null if no
server has been started.public void setGame(Game game)
Game that we are currently playing.
game - The Game.getGame()public Game getGame()
Game that we are currently playing.
Game.setGame(net.sf.freecol.common.model.Game)public Canvas getCanvas()
Canvas this client uses to display the
GUI-components.
Canvas.public GUI getGUI()
GUI that is being used to draw the map on the
Canvas.
GUI.public void quit()
public boolean retire()
boolean valuepublic void continuePlaying()
public boolean isAdmin()
public void setSingleplayer(boolean singleplayer)
singleplayer - Indicates whether or not this game is a singleplayer
game.isSingleplayer()public boolean isSingleplayer()
setSingleplayer(boolean)public void setIsRetired(boolean isRetired)
singleplayer - Indicates whether or not the user has retired the game.public boolean isRetired()
public ConnectController getConnectController()
ConnectController.public PreGameController getPreGameController()
PreGameController.public PreGameInputHandler getPreGameInputHandler()
PreGameInputHandler.public InGameController getInGameController()
InGameController.public InGameInputHandler getInGameInputHandler()
InGameInputHandler.public ClientModelController getModelController()
ClientModelController.
ClientModelController.public void setClient(Client client)
Client that shall be used to send messages to the
server.
client - the ClientgetClient()public Client getClient()
Client that can be used to send messages to the
server.
ClientsetClient(net.sf.freecol.client.networking.Client)public void playMusic(java.lang.String music)
public void playMusicOnce(java.lang.String music)
public void playMusicOnce(java.lang.String music,
int delay)
delay - A delay before playing the sound (ms).public void playSound(java.lang.String sound)
sound - The key sound effect given by SfxLibrary.public void playSound(SoundLibrary.SoundEffect sound)
sound - The key sound effect given by SfxLibrary.public boolean canPlayMusic()
public boolean isLoggedIn()
public void setLoggedIn(boolean loggedIn)
loggedIn - An indication of whether or not this client is logged in
to a server.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||