|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
This is the interface that represents the client from the server's point of view. The client should keep a list of the pieces added, and their handles, as other methods should affect the pieces, and these methods use the handle as a reference to the pieces.
Method Summary | |
void |
actionReply(long id,
boolean ok)
Call this to indicate that the executed action with the given id has been finished. |
void |
addPiece(int handle,
String name,
Position pos,
Set actions,
Map properties,
String type)
Creates a new Piece and adds it to the game. |
void |
addPieceAction(int handle,
Action a)
Adds the given action to the list of actions that a piece can do. |
void |
connectionLost()
Called to indicate that the connection to the server has been lost. |
void |
destroyPiece(int handle)
This method is called to indicate that a piece has permanantly left the game. |
void |
hideMapPoint(int x,
int y)
Makes the given point (automaton) of the map invisible. |
void |
hideMapPoints(int[] x,
int[] y)
Makes the given points (automatons) of the map invisible. |
void |
mapLoadingProgressUpdate(double progress)
The server calls this method as the initilizing loading of the map progresses. |
void |
mapUpdate(int[] x,
int[] y,
int[] colors)
Update the given points to the corresponding colors. |
void |
mapUpdate(int x,
int y,
int color)
Update the given point to the given color. |
void |
removePiece(int handle)
Call this method to indicate that a piece is no longer visible and should be removed. |
void |
removePieceAction(int handle,
Action a)
Removes the given action from the list of actions the a piece can do. |
void |
timeUpdate(String time)
This is called every now and then to tell the client what time it is. |
void |
unitMessage(int handle,
String message)
Sends a message that that describes that something has happened to the piece with the given handle. |
void |
updatePiece(int handle,
Position newPosition)
Sets a new position for the piece with the given handle. |
void |
updatePiece(int handle,
Property[] newProperties)
Adds/changed the given properties of the piece with the given handle. |
Method Detail |
public void mapUpdate(int[] x, int[] y, int[] colors)
x
- Description of Parametery
- Description of Parametercolors
- Description of Parameterpublic void mapUpdate(int x, int y, int color)
x
- Description of Parametery
- Description of Parametercolor
- Description of Parameterpublic void hideMapPoints(int[] x, int[] y)
x
- The x coordinates of the points.y
- The y coordinates of the points.public void hideMapPoint(int x, int y)
x
- The x coordinate of the point.y
- The y coordinate of the point.public void addPiece(int handle, String name, Position pos, Set actions, Map properties, String type)
handle
- The unique handle of the new Piece.name
- The name of the Piece.pos
- The position of the new Piece.actions
- The actions of the Piece.properties
- The properties of the Piece.type
- The type of Piece. Type is not a property of a Piece,
but the type is used to determine the symbol to use. Make sure the
SymbolFactory has a symbol for this type of Piece.public void updatePiece(int handle, Property[] newProperties)
handle
- Description of ParameternewProperties
- Description of Parameterpublic void updatePiece(int handle, Position newPosition)
handle
- Description of ParameternewPosition
- Description of Parameterpublic void removePiece(int handle)
handle
- Description of Parameterpublic void destroyPiece(int handle)
handle
- Description of Parameterpublic void addPieceAction(int handle, Action a)
handle
- The feature to be added to the PieceAction attributea
- The feature to be added to the PieceAction attributepublic void removePieceAction(int handle, Action a)
handle
- Description of Parametera
- Description of Parameterpublic void actionReply(long id, boolean ok)
id
- The id of the executing action (as returned by the
server, see Server.java).ok
- Did the action execute correctly, or was there an error?public void unitMessage(int handle, String message)
handle
- Description of Parametermessage
- Description of Parameterpublic void timeUpdate(String time)
time
- The current timepublic void connectionLost()
public void mapLoadingProgressUpdate(double progress)
progress
- A number between 0 and 1 indicating how much of the map
that has been loaded. (0 = nothing, 1 = all).
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |