net.sf.freecol.client.control
Class PreGameController

java.lang.Object
  extended by net.sf.freecol.client.control.PreGameController

public final class PreGameController
extends java.lang.Object

The controller that will be used before the game starts.


Field Summary
private  FreeColClient freeColClient
           
private  GUI gui
           
private static java.util.logging.Logger logger
           
 
Constructor Summary
PreGameController(FreeColClient freeColClient, GUI gui)
          The constructor to use.
 
Method Summary
private  void addPlayerResources(java.lang.String nationId)
          Add player-specific resources to the resource manager.
 void chat(java.lang.String message)
          Sends a chat message.
 void requestLaunch()
          Requests the game to be started.
 void sendGameOptions()
          Sends the GameOptions to the server.
 void sendMapGeneratorOptions()
          Sends the MapGeneratorOptions to the server.
 void setAvailable(Nation nation, NationOptions.NationState state)
           
 void setNation(Nation nation)
          Sets this client's player's nation.
 void setNationType(NationType nationType)
          Sets this client's player's nation type.
 void setReady(boolean ready)
          Sets this client to be (or not be) ready to start the game.
 void startGame()
          Starts the game.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

private static final java.util.logging.Logger logger

freeColClient

private FreeColClient freeColClient

gui

private GUI gui
Constructor Detail

PreGameController

public PreGameController(FreeColClient freeColClient,
                         GUI gui)
The constructor to use.

Parameters:
freeColClient - The main controller.
Method Detail

setReady

public void setReady(boolean ready)
Sets this client to be (or not be) ready to start the game.

Parameters:
ready - Indicates wether or not this client is ready to start the game.

setNation

public void setNation(Nation nation)
Sets this client's player's nation.

Parameters:
nation - Which nation this player wishes to set.

setNationType

public void setNationType(NationType nationType)
Sets this client's player's nation type.

Parameters:
nationType - Which nation this player wishes to set.

setAvailable

public void setAvailable(Nation nation,
                         NationOptions.NationState state)

requestLaunch

public void requestLaunch()
Requests the game to be started. This will only be successful if all players are ready to start the game.


chat

public void chat(java.lang.String message)
Sends a chat message.

Parameters:
message - The text of the message.

sendGameOptions

public void sendGameOptions()
Sends the GameOptions to the server. This method should be called after updating that object.


sendMapGeneratorOptions

public void sendMapGeneratorOptions()
Sends the MapGeneratorOptions to the server. This method should be called after updating that object.


addPlayerResources

private void addPlayerResources(java.lang.String nationId)
Add player-specific resources to the resource manager.

Parameters:
nationId - The player nation identifier.

startGame

public void startGame()
Starts the game.