|
||||||||||
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 | |
---|---|
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. |
void |
updateMenuBar()
Describe updateMenuBar method here. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public final Worker worker
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 |
---|
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()
ClientOptions
public void setMapEditor(boolean mapEditor)
public boolean isMapEditor()
public void saveClientOptions(java.io.File saveFile)
saveFile
- The file where the client options should be written.ClientOptions
public 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 Client
getClient()
public Client getClient()
Client
that can be used to send messages to the
server.
Client
setClient(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 |