|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.globalse.arena.frag.game.GameManager
The GameManager class handles the creation and joining of games. It provides the interface for interaction with the underlying layer (Network components or ARENA itself). The actual work of creating a game with objects etc. is delegated to a subclass of GameSetup. A GameManager creates three event dispatcher classes: a remote dispatcher that relays events to all other peers, a local dispatcher that relays events to the GameManager and the ObjectManager and a general dispatcher that relays events to both the local and the remote dispatcher. $Id: GameManager.html,v 1.1 2003/02/12 18:06:19 schoecke Exp $
Constructor Summary | |
GameManager(java.lang.String gameName,
java.lang.String playerName)
The constructor to create a instance of the GameManager. |
Method Summary | |
EventDistributor |
eventDistributor()
Returns the event distributor. |
EventDispatcher |
getEventDispatcher()
Returns the attribute eventDispatcher. |
java.lang.String |
getGameName()
Returns the name of the game. |
ObjectManager |
getObjectManager()
Returns the instance of the ObjectManager. |
PeerManager |
getPeerManager()
Returns the peerManager on the current peer. |
java.lang.String |
getPlayerName()
Returns the name of the player. |
GameSetup |
getSetup()
Returns the setup of the game |
TimerRegistry |
getTimerRegistry()
Gets the associated timer registry object. |
void |
initGame()
Is a foward call of initGame() on a GameSetup object. |
void |
joinGame(java.net.InetAddress[] inetad,
int[] port,
java.lang.String password)
This method is used, to join a game using inetadresses and ports. |
void |
joinGame(java.lang.String[] names,
java.net.Socket[] connections)
Adds the given peers to the PeerManager and creates a WorldStateRequestEvent. |
void |
loadCharacter(java.lang.String playerName,
java.io.File file)
Loads a saved character to continue with it in a new mission. |
void |
loadGame(java.io.File file)
Loads a saved game to resume a mission. |
void |
newPeer(java.net.InetAddress inetad,
int port,
java.lang.String password)
Adds a new peer with name, ip-address and portnumber to the PeerManager. |
void |
newPeer(java.lang.String name,
java.net.Socket connection)
Adds a new peer to the PeerManager with name and the socket |
void |
newPeerConnectionServer(int portNumber,
java.lang.String password)
Creates a new instance of a peer server list to given port. |
void |
processEvent(Event event)
The parameter event is the Event which is processed. |
void |
saveCharacter(java.lang.String playerName,
java.io.File file)
Saves the Character specified in playerName to the file. |
void |
saveGame(java.io.File file)
Saves the current game to the file. |
void |
setPlayerName(java.lang.String name)
Set the playerName of the current game. |
void |
setSetup(GameSetup setup)
Set's the Setup class of the Game ( GameSetup )
to the attribute "setup" which is used by many of the other methods in this class. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
Constructor Detail |
public GameManager(java.lang.String gameName, java.lang.String playerName)
gameName
- The name of the gameplayerName
- The name of the player which starts the gamegameName != "" and playerName != ""
Method Detail |
public void initGame()
setup != null
public void processEvent(Event event)
event
- The event which is processedsetup != null
Event != null
public void newPeerConnectionServer(int portNumber, java.lang.String password)
password
- String the password for joining the game. "" means no passwordportNumber
- the port number where the server should listen for connectionsportNumber != 0
public void newPeer(java.lang.String name, java.net.Socket connection)
name
- The name of the new peerconnection
- is the socket for the connectionname != ""
connection != null
public void newPeer(java.net.InetAddress inetad, int port, java.lang.String password) throws WrongPasswordException
password
- String password for the joining game. "" means no password.inetad
- InetAddress, to connect withport
- Portnumber of remote peername != ""
inetd != null
port != 0
public void joinGame(java.lang.String[] names, java.net.Socket[] connections)
names
- Array of new peersconnections
- Array of Socketsnames != null
connections != null
public void joinGame(java.net.InetAddress[] inetad, int[] port, java.lang.String password) throws WrongPasswordException
password
- String the password for joining a game. "" means no password.inetad
- Array of corresponding inetaddressesport
- Array of corresponding port-numbersnames.getLength()==inetad.getLength()==port.getLength()
names != null
inetad != null
port != null
public java.lang.String getGameName()
public java.lang.String getPlayerName()
public ObjectManager getObjectManager()
public void setSetup(GameSetup setup)
GameSetup
)
to the attribute "setup" which is used by many of the other methods in this class.setup
- A GameSetup objectsetup != null
self.setup != null
public EventDispatcher getEventDispatcher()
public TimerRegistry getTimerRegistry()
public void loadGame(java.io.File file)
file
- The file, with absolut path, from which the game should be loadedsetup != null
public void saveGame(java.io.File file)
file
- the file with absolute path to which the ddata is storedpublic void loadCharacter(java.lang.String playerName, java.io.File file)
playerName
- The name of the character to be loadedfile
- The file from which the character will be loadedsetup != null
gameName != ""
public void saveCharacter(java.lang.String playerName, java.io.File file)
playerName
- the name of the characterfile
- data is saved to this filepublic EventDistributor eventDistributor()
public void setPlayerName(java.lang.String name)
name
- String specifies the player name.public GameSetup getSetup()
public PeerManager getPeerManager()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |