public class ObserverClientToServerConnection extends Connection implements IObserverClientToServerConnection
Modifier and Type | Field and Description |
---|---|
protected GameModel |
gameModel |
dataOutputStream
Constructor and Description |
---|
ObserverClientToServerConnection(IClientToServerConnectionCallable callbackObject,
String networkAddress) |
Modifier and Type | Method and Description |
---|---|
protected void |
connectionResetCallback()
Is called by the InputListener if the connection was reset.
|
String |
getNetworkAddress() |
protected void |
processInputObject(org.eclipse.emf.ecore.EObject inputObject)
Reacts to an incoming object and passes the information to the GameModel and
the callbackObject.
|
void |
sendGameJoinRequest(int gameId,
String clientName)
Sends a GameJoinRequest to the server.
|
protected void |
sendGameJoinRequestWithRole(int gameId,
String clientName,
Role role)
Sends a GameJoinRequest to the server.
|
void |
sendGameListRequest()
Sends a GameListRequest to the server.
|
close, sendObject, setSocket
protected GameModel gameModel
public ObserverClientToServerConnection(IClientToServerConnectionCallable callbackObject, String networkAddress) throws IOException
IOException
public String getNetworkAddress()
getNetworkAddress
in interface IObserverClientToServerConnection
getNetworkAddress
in class Connection
public void sendGameListRequest()
IObserverClientToServerConnection
sendGameListRequest
in interface IObserverClientToServerConnection
public void sendGameJoinRequest(int gameId, String clientName)
IObserverClientToServerConnection
sendGameJoinRequest
in interface IObserverClientToServerConnection
gameId
- the Id of the game the client would like to join (-1 if client wants to join the general game pool)clientName
- the name the user wants to takeprotected void sendGameJoinRequestWithRole(int gameId, String clientName, Role role)
gameId
- the gameId that should be set to the GameJoinRequestclientName
- the clientName that should be set to the GameJoinRequestrole
- the role that should be set to the GameJoinRequestprotected void processInputObject(org.eclipse.emf.ecore.EObject inputObject)
processInputObject
in class Connection
inputObject
- the EMF object that was receivedprotected void connectionResetCallback()
Connection
connectionResetCallback
in class Connection
Copyright © 2017 smarTen. All rights reserved.