|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--gecco.communication.client.ServerAmbassador
This is the class that implements gecco.client.Server, and is the only part of the communication the client knows of.
Field Summary | |
private int |
actionId
Description of the Field |
private Client |
cl
Description of the Field |
private int |
connectionstatus
Description of the Field |
private DataInputExchangeHandler |
DEHInput
Description of the Field |
private DataOutputExchangeHandler |
DEHOutput
Description of the Field |
private static int |
DISCONNECTED
Description of the Field |
private static int |
HANDSHAKING
Description of the Field |
private boolean |
joined
Description of the Field |
private static int |
JOINED
Description of the Field |
private ServerConnection |
sc
Description of the Field |
Constructor Summary | |
ServerAmbassador(Client cl)
|
Method Summary | |
void |
abortAction(long actionId)
Called by the client when it wants a unit to abort an action |
boolean |
connect(String host,
int port)
tries to connect to the server returns false if failed to connect |
void |
connectionLost()
Called whenever a communication error occurs. |
void |
disconnect()
Called by the client when it wants to disconnect |
long |
doAction(int pieceHandle,
Action a)
Description of the Method |
StringTokenizer |
getAvailableRoles()
asks the server which roles are available for this client to join as |
Image |
getMap()
Called by the client when it wants to get the whole map |
Dimension |
getMapSize()
Called by the client when it wants to know the size of the map |
Point |
getMapUpperLeft()
Called by the client to get the coordinates of the upper left corner of the map |
boolean |
joinAsRole(String role)
Tells the server that the client wants to join the game. |
void |
startGame()
Called by the client when it is ready to receive messages from the server |
Methods inherited from class java.lang.Object |
|
Field Detail |
private ServerConnection sc
private Client cl
private boolean joined
private DataInputExchangeHandler DEHInput
private DataOutputExchangeHandler DEHOutput
private int actionId
private int connectionstatus
private static final int DISCONNECTED
private static final int HANDSHAKING
private static final int JOINED
Constructor Detail |
public ServerAmbassador(Client cl)
cl
- The object that implements gecco.client.Client, and the only
part of the client that the communication part is aware ofMethod Detail |
public StringTokenizer getAvailableRoles()
getAvailableRoles
in interface Server
public Point getMapUpperLeft()
getMapUpperLeft
in interface Server
public Dimension getMapSize()
getMapSize
in interface Server
public Image getMap()
getMap
in interface Server
public boolean connect(String host, int port)
connect
in interface Server
host
- The name of the host where to find the serverport
- The port number to connect topublic boolean joinAsRole(String role)
joinAsRole
in interface Server
role
- The role this client wants to join aspublic void connectionLost()
public long doAction(int pieceHandle, Action a)
doAction
in interface Server
pieceHandle
- Description of Parametera
- Description of Parameterpublic void abortAction(long actionId)
abortAction
in interface Server
actionId
- Description of Parameterpublic void disconnect()
disconnect
in interface Server
public void startGame()
startGame
in interface Server
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |