public class GameManager extends Object implements BoardListener, PlayerListener, CommandListener
| Constructor and Description |
|---|
GameManager()
Creates an instance of
GameManager. |
| Modifier and Type | Method and Description |
|---|---|
void |
action(int key)
This method notifies the game server that the client has pressed some
key that signifies an action in the game.
|
void |
addBoardListener(BoardListener listener)
Registers a listener for board-related events.
|
void |
addPlayerListener(PlayerListener listener)
Registers a listener for player-related events.
|
void |
changeBoard(Board board)
Notifies the manager that the board has changed.
|
void |
hearMessage(String message)
Notifies the manager of a message.
|
void |
setCharacter(int id,
CharacterStats stats)
Called to tell the manager about the character that the client is
currently using.
|
void |
setClient(com.sun.sgs.client.simple.SimpleClient simpleClient)
Sets the client that this class uses for all communication with
the game server.
|
void |
setSpriteMap(int spriteSize,
Map<Integer,Image> spriteMap)
Notifies the manager of the sprite map that should be used.
|
void |
updateCharacter()
Called to update aspects of the player's currrent character.
|
void |
updateSpaces(BoardSpace[] spaces)
Notifies the manager that some set of spaces on the board have changed.
|
public void addBoardListener(BoardListener listener)
listener - the listenerpublic void addPlayerListener(PlayerListener listener)
listener - the listenerpublic void setClient(com.sun.sgs.client.simple.SimpleClient simpleClient)
client - the clientpublic void action(int key)
action in interface CommandListenerkey - the key, as defined in java.awt.event.KeyEventpublic void setSpriteMap(int spriteSize,
Map<Integer,Image> spriteMap)
setSpriteMap in interface BoardListenerspriteSize - the size, in pixels, of the spritesspriteMap - a map from sprite identifier to sprite imagepublic void changeBoard(Board board)
changeBoard in interface BoardListenerboard - the new board where the player is playingpublic void updateSpaces(BoardSpace[] spaces)
updateSpaces in interface BoardListenerspaces - the changed space detailpublic void hearMessage(String message)
hearMessage in interface BoardListenermessage - the message that the player should "hear"public void setCharacter(int id,
CharacterStats stats)
setCharacter in interface PlayerListenerid - the character's identifier, which specifies their spritestats - the characters's statisticspublic void updateCharacter()
updateCharacter in interface PlayerListenerCopyright © 2013. All Rights Reserved.