|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjfreerails.network.FreerailsClient
public class FreerailsClient
A client for FreerailsGameServer.
| Nested Class Summary |
|---|
| Nested classes/interfaces inherited from interface jfreerails.controller.ClientControlInterface |
|---|
ClientControlInterface.ClientProperty |
| Field Summary | |
|---|---|
private MovePrecommitter |
committer
|
protected Connection2Server |
connection2Server
|
private static java.util.logging.Logger |
logger
|
private MoveChainFork |
moveFork
|
private java.util.HashMap<java.lang.String,java.io.Serializable> |
properties
|
private World |
world
|
| Constructor Summary | |
|---|---|
FreerailsClient()
|
|
| Method Summary | |
|---|---|
protected void |
clientUpdates()
Empty method called by update(), subclasses should override this method instead of overriding update(). |
LogOnResponse |
connect(GameServer server,
java.lang.String username,
java.lang.String password)
Connects this client to a local server. |
LogOnResponse |
connect(java.lang.String address,
int port,
java.lang.String username,
java.lang.String password)
Connects this client to a remote server. |
void |
disconnect()
Disconnect the client from the server. |
protected long |
getLastTickTime()
|
MoveChainFork |
getMoveFork()
|
java.io.Serializable |
getProperty(ClientControlInterface.ClientProperty propertyName)
|
World |
getWorld()
|
protected void |
newWorld(World w)
Subclasses should override this method if they need to respond the the world being changed. |
(package private) void |
processMessage(FreerailsSerializable message)
Processes a message received from the server. |
void |
processMove(Move move)
Sends move to the server. |
void |
processPreMove(PreMove pm)
|
(package private) FreerailsSerializable |
read()
|
void |
resetProperties(java.util.HashMap newProperties)
|
void |
sendCommand(Message2Server c)
|
void |
setGameModel(FreerailsMutableSerializable o)
Called when a new game is started or a game is loaded. |
void |
setProperty(ClientControlInterface.ClientProperty propertyName,
java.io.Serializable value)
Sets a property, for example, the list of saved games. |
MoveStatus |
tryDoMove(Move move)
Tests a move before sending it to the server. |
void |
update()
Reads and deals with all outstanding messages from the server. |
(package private) void |
write(FreerailsSerializable fs)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final java.util.logging.Logger logger
protected Connection2Server connection2Server
private final java.util.HashMap<java.lang.String,java.io.Serializable> properties
private final MoveChainFork moveFork
private World world
private MovePrecommitter committer
| Constructor Detail |
|---|
public FreerailsClient()
| Method Detail |
|---|
public final MoveChainFork getMoveFork()
public final LogOnResponse connect(java.lang.String address,
int port,
java.lang.String username,
java.lang.String password)
public final LogOnResponse connect(GameServer server,
java.lang.String username,
java.lang.String password)
public final void disconnect()
public final void setGameModel(FreerailsMutableSerializable o)
ClientControlInterface
setGameModel in interface ClientControlInterfaceprotected void newWorld(World w)
public void setProperty(ClientControlInterface.ClientProperty propertyName,
java.io.Serializable value)
ClientControlInterface
setProperty in interface ClientControlInterfacepublic final java.io.Serializable getProperty(ClientControlInterface.ClientProperty propertyName)
public final void resetProperties(java.util.HashMap newProperties)
final FreerailsSerializable read()
final void write(FreerailsSerializable fs)
public final void update()
update in interface GameModelprotected void clientUpdates()
final void processMessage(FreerailsSerializable message)
throws java.io.IOException
java.io.IOExceptionpublic final World getWorld()
public final void processMove(Move move)
processMove in interface MoveReceiverpublic final MoveStatus tryDoMove(Move move)
tryDoMove in interface UntriedMoveReceiverpublic void sendCommand(Message2Server c)
sendCommand in interface ServerCommandReceiverpublic void processPreMove(PreMove pm)
processPreMove in interface UntriedMoveReceiverprotected long getLastTickTime()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||