games.strategy.engine.framework
Class ServerGame
java.lang.Object
games.strategy.engine.framework.ServerGame
- All Implemented Interfaces:
- IGame
public class ServerGame
- extends java.lang.Object
- implements IGame
- Author:
- Sean Bridges
Represents a running game.
Lookups to get a GamePlayer from PlayerId and the current Delegate.
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
DISPLAY_CHANNEL
public static final java.lang.String DISPLAY_CHANNEL
- See Also:
- Constant Field Values
SERVER_REMOTE
public static final RemoteName SERVER_REMOTE
ServerGame
public ServerGame(GameData data,
java.util.Set<IGamePlayer> localPlayers,
java.util.Map<java.lang.String,INode> remotePlayerMapping,
Messengers messengers)
- Parameters:
localPlayers - Set - A set of GamePlayersmessenger - IServerMessengerremotePlayerMapping - Map
getDisplayChannel
public static RemoteName getDisplayChannel(GameData data)
addObserver
public void addObserver(IObserverWaitingToJoin observer)
addDelegateMessenger
public void addDelegateMessenger(IDelegate delegate)
getRemoteName
public static RemoteName getRemoteName(IDelegate delegate)
getRemoteName
public static RemoteName getRemoteName(PlayerID id,
GameData data)
getRemoteRandomName
public static RemoteName getRemoteRandomName(PlayerID id)
getData
public GameData getData()
- Specified by:
getData in interface IGame
startGame
public void startGame()
- And here we go.
Starts the game in a new thread
stopGame
public void stopGame()
saveGame
public void saveGame(java.io.File f)
- Description copied from interface:
IGame
- Save the game to the given directory.
The file should exist and be writeable.
- Specified by:
saveGame in interface IGame
saveGame
public void saveGame(java.io.OutputStream out)
throws java.io.IOException
- Throws:
java.io.IOException
addGameStepListener
public void addGameStepListener(GameStepListener listener)
- Specified by:
addGameStepListener in interface IGame
removeGameStepListener
public void removeGameStepListener(GameStepListener listener)
- Specified by:
removeGameStepListener in interface IGame
getMessenger
public IMessenger getMessenger()
- Specified by:
getMessenger in interface IGame
getChannelMessenger
public IChannelMessenger getChannelMessenger()
- Specified by:
getChannelMessenger in interface IGame
getRemoteMessenger
public IRemoteMessenger getRemoteMessenger()
- Specified by:
getRemoteMessenger in interface IGame
addChange
public void addChange(Change aChange)
- Description copied from interface:
IGame
- Should not be called outside of engine code.
- Specified by:
addChange in interface IGame
canSave
public boolean canSave()
- Specified by:
canSave in interface IGame
getRandomSource
public IRandomSource getRandomSource()
- Specified by:
getRandomSource in interface IGame
setRandomSource
public void setRandomSource(IRandomSource randomSource)
getVault
public Vault getVault()
- Specified by:
getVault in interface IGame
addDisplay
public void addDisplay(IDisplay display)
- Description copied from interface:
IGame
- add a display that will recieve broadcasts from the IDelegateBridge.getDisplayBroadvaster
- Specified by:
addDisplay in interface IGame
removeDisplay
public void removeDisplay(IDisplay display)
- Description copied from interface:
IGame
- remove a display
- Specified by:
removeDisplay in interface IGame
isGameOver
public boolean isGameOver()
- Description copied from interface:
IGame
- Is the game over. Game over does not relate to the state of the game (eg check-mate in chess)
but to the game being shut down and all players have left.
- Specified by:
isGameOver in interface IGame
getPlayerManager
public PlayerManager getPlayerManager()
- Specified by:
getPlayerManager in interface IGame
- Returns:
- a listing of who is playing who.
getInGameLobbyWatcher
public InGameLobbyWatcher getInGameLobbyWatcher()
setInGameLobbyWatcher
public void setInGameLobbyWatcher(InGameLobbyWatcher inGameLobbyWatcher)
stopGameSequence
public void stopGameSequence()
isGameSequenceRunning
public boolean isGameSequenceRunning()