|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.asdf.common.GameController
public abstract class GameController
GameController is an abstract class which implements some basic functionality necessary for client side game controllers. It defines few abstract methods which are used as an interface to communicate with our client program and this client side game controller. If you wish to implement a new client side game controller to be used with game implemented at server side, you must use this class (or some other sub-class of this class) as super class of your own implementation.
Constructor Summary | |
---|---|
GameController()
Default constructor for GameController which sets a random id for itself. |
Method Summary | |
---|---|
ConnectionHandler |
getConnectionHandler()
Returns ConnectionHandler associated with this GameController. |
long |
getGameID()
Gets this games gameID. |
long |
getID()
Gets this games sessionID. |
abstract void |
init(GameResponse joinResponse,
java.lang.String accountName,
AccountType accountType)
Since GameControllers are loaded dynamically in lobby it is not possible to use a constructor with parameters, which GameController implementations might need. |
void |
setConnectionHandler(ConnectionHandler connection)
Sets this games ConnectionHandler and registers this GameController as a listener for messages received from server for this GameControllers sessionID. |
void |
setGameID(long id)
Sets this games gameID. |
void |
setID(long id)
Sets this games sessionID. |
abstract void |
start()
Start is called from lobby when this GameController is ready to be started. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.asdf.client.MessageHandler |
---|
handleRequest, handleResponse, handleStateUpdate |
Constructor Detail |
---|
public GameController()
Method Detail |
---|
public abstract void init(GameResponse joinResponse, java.lang.String accountName, AccountType accountType)
joinResponse
- Parameters received from server required to initialize thisaccountName
- Account name of the user who is associated with this GameController.accountType
- Type of the user account. Some users might have more privileges than
others.
GameControllerpublic abstract void start()
public final long getID()
getID
in interface MessageHandler
public final void setID(long id)
setID
in interface MessageHandler
id
- Semi-Unique sessionID.public final void setGameID(long id)
id
- GameID received from server.public final long getGameID()
public void setConnectionHandler(ConnectionHandler connection)
setConnectionHandler
in interface MessageHandler
connection
- ConnectionHandler to be used.public ConnectionHandler getConnectionHandler()
getConnectionHandler
in interface MessageHandler
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |