public interface IObserverClientControl
extends de.smarten.tsuro.shared.network.client.IClientToServerConnectionCallable
IObserverClientControl
defines methods for
handling objects and method calls between IObserverGUIControl
and IObserverClientToServerConnection
Modifier and Type | Method and Description |
---|---|
void |
connectionResetCallback()
Is called upon a connection reset (i.e.
|
boolean |
disconnect()
Disconnects from the server and returns true if it was successful.
|
void |
gameListResponseCallback(List<de.smarten.tsuro.shared.gamemodel.Game> pGameList)
Is called when a GameListResponse has been received.
|
void |
gameStartNotificationCallback()
Is used when a GameStartNotification has been sent.
|
String |
getClientName()
Returns the name of the client.
|
int |
getConnectionState()
Returns the current connection state,
1 stands for "connected", 0 for "not connected".
|
String |
getNetworkAddress()
Returns the networkAddress of the server the client is connected to
|
void |
joinGame(int gameId,
String clientName,
de.smarten.tsuro.shared.gamemodel.Role role)
Sends a GameJoinRequest with the information passed.
|
void |
register(String pNetworkAddress)
Is called when a user entered a network address and clicked register.
|
void |
requestGameList()
Forwards the request for a GameList to the ObserverClientToServerConnection
|
void |
setError(String pError,
String errorSource)
Forwards an error message to the GUIControl and the source of the error, e.g.
|
void |
setMessage(String pMessage,
String messageSource)
Forwards a message to the GUIControl and the source of the message, e.g.
|
void |
startGame(de.smarten.tsuro.shared.gamemodel.GameModel gameModel)
Starts a game by setting the game model and telling the GUI to start displaying the game.
|
void |
turnNotificationCallback(boolean placeToken)
The method is needed for the PlayerClient but not for the ObserverClient.
|
void register(String pNetworkAddress)
pNetworkAddress
- The network address to be connected toboolean disconnect()
void setError(String pError, String errorSource)
pError
- the error message to be displayederrorSource
- the source where the error occuredvoid setMessage(String pMessage, String messageSource)
pMessage
- the message to be displayedmessageSource
- source where the message came fromString getNetworkAddress()
int getConnectionState()
String getClientName()
void requestGameList()
void joinGame(int gameId, String clientName, de.smarten.tsuro.shared.gamemodel.Role role)
gameId
- the id of the game to be joined (-1 for the pool)clientName
- the name the client would like to takevoid gameListResponseCallback(List<de.smarten.tsuro.shared.gamemodel.Game> pGameList)
gameListResponseCallback
in interface de.smarten.tsuro.shared.network.client.IClientToServerConnectionCallable
pGameList
- The list to be displayed by the GUIvoid gameStartNotificationCallback()
gameStartNotificationCallback
in interface de.smarten.tsuro.shared.network.client.IClientToServerConnectionCallable
void turnNotificationCallback(boolean placeToken)
turnNotificationCallback
in interface de.smarten.tsuro.shared.network.client.IClientToServerConnectionCallable
placeToken
- boolean variable if the token or a tile has to be setvoid startGame(de.smarten.tsuro.shared.gamemodel.GameModel gameModel)
startGame
in interface de.smarten.tsuro.shared.network.client.IClientToServerConnectionCallable
gameModel
- The game model linked to the game to be startedvoid connectionResetCallback()
connectionResetCallback
in interface de.smarten.tsuro.shared.network.client.IClientToServerConnectionCallable
Copyright © 2017 smarTen. All rights reserved.