|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectbluegammon.io.PlayerListenerProxy
This class serializes all events from sent to a PlayerListener
and
sends them to specified output stream.
In this game there is a RemotePlayer
on the other side of the connection. The RemotePlayer
is also a
PlayerListener
and will get same listener events as this proxy via
streams.
Relies on that specified outstream delivers and handles all fuzziness with I/O.
Field Summary | |
static byte |
EXIT
Identification byte for reporting a player's shutdown. |
static byte |
MOVE
Identification byte for reporting a piece movement. |
static byte |
MSG
Identification byte for sending a message to remote player. |
static byte |
TURN
Identification byte for reporting a committed turn. |
static byte |
UNDO
Identification byte for reporting an undo. |
Fields inherited from interface bluegammon.logic.PlayerListener |
LOCAL_GIVE_UP, LOCAL_QUIT, REMOTE_GIVE_UP, REMOTE_QUIT |
Constructor Summary | |
PlayerListenerProxy(java.io.DataOutputStream out)
Creates a new PlayerListenerProxy that
sends received PlayerListener |
Method Summary | |
void |
gameExited(int id,
int reason)
Called when player exits the game for some reason. |
void |
messageSent(int id,
char[] msg)
Called when player sent a message. |
void |
moveMade(int id,
int moveIndex)
Called when a player performs a move. |
void |
turnCommit(int id)
Called when player is finished with his/her turn. |
void |
undoPerformed(int id)
Called when player performs an undo. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final byte MOVE
public static final byte UNDO
public static final byte TURN
public static final byte MSG
public static final byte EXIT
Constructor Detail |
public PlayerListenerProxy(java.io.DataOutputStream out)
PlayerListenerProxy
that
sends received PlayerListener events via
specified output stream.
- Parameters:
out
- The stream to send events to.
Method Detail |
public void moveMade(int id, int moveIndex)
PlayerListener
moveMade
in interface PlayerListener
id
- Player id.moveIndex
- The moveindex in possible move array used for move.public void undoPerformed(int id)
PlayerListener
undoPerformed
in interface PlayerListener
id
- Player id.public void turnCommit(int id)
PlayerListener
turnCommit
in interface PlayerListener
id
- Player id.public void messageSent(int id, char[] msg)
PlayerListener
messageSent
in interface PlayerListener
id
- Player id.msg
- The message.public void gameExited(int id, int reason)
PlayerListener
gameExited
in interface PlayerListener
id
- Player id.reason
- The reason for exiting game.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |