|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--uk.org.redfelineninja.risk.client.RiskServerHandler
This class provides all the tools for a client to get data to and from the Server.
Constructor Summary | |
RiskServerHandler(RiskClientInterface inter)
Create a new RiskServerHandler. |
Method Summary | |
void |
cards(Card[] cards)
Turn the the supplied cards and exchange them for armies. |
void |
closeConnection()
Close the current connection. |
void |
countryClicked(java.lang.String country)
Tell the server that the client has clicked on a country. |
void |
finishTurn()
The the server that the client wants to finish their go. |
void |
fortify()
Tell the server that the client wants to fortify. |
boolean |
isConnected()
Test whether or not we are connected to the server. |
void |
joinGame(java.lang.String name)
Join an existing game. |
void |
message(java.lang.String msg)
Send a mesage to all parties. |
void |
message(java.lang.String message,
Player player)
Send a message to the supplied player. |
void |
newGame(java.lang.String name,
boolean random,
boolean privacy)
Start a new game. |
void |
openConnection(java.lang.String hostname,
int port,
Player player)
Open a connection to the server and identify yourself as player. |
void |
run()
This method runs in a daemon Thread parsing data from the server. |
void |
startGame()
Stop waiting for new players and start playing the game. |
void |
stopGame(java.lang.String reason)
Halt the current game. |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public RiskServerHandler(RiskClientInterface inter)
Method Detail |
public void openConnection(java.lang.String hostname, int port, Player player) throws java.io.IOException
openConnection
in interface RiskServerInterface
java.io.IOException
public void closeConnection() throws java.io.IOException
closeConnection
in interface RiskServerInterface
java.io.IOException
public boolean isConnected()
isConnected
in interface RiskServerInterface
public void newGame(java.lang.String name, boolean random, boolean privacy)
newGame
in interface RiskServerInterface
random
- start with randomly owned countriesprivacy
- permit private talking on the message systempublic void joinGame(java.lang.String name)
joinGame
in interface RiskServerInterface
public void startGame()
startGame
in interface RiskServerInterface
public void stopGame(java.lang.String reason)
stopGame
in interface RiskServerInterface
reason
- the reason for the game being haltedpublic void message(java.lang.String msg)
message
in interface RiskServerInterface
msg
- the messagepublic void message(java.lang.String message, Player player)
message
in interface RiskServerInterface
message
- the messageplayer
- the player to send the message topublic void countryClicked(java.lang.String country)
countryClicked
in interface RiskServerInterface
country
- string giving the country that was clicked on.public void cards(Card[] cards)
cards
in interface RiskServerInterface
cards
- the card to be exchangedpublic void fortify()
fortify
in interface RiskServerInterface
public void finishTurn()
finishTurn
in interface RiskServerInterface
public void run()
run
in interface java.lang.Runnable
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |