Constructor and Description |
---|
GameControl(ConnectionManager cm,
int gameId,
String roomName,
de.smarten.tsuro.shared.gamemodel.Configuration config) |
Modifier and Type | Method and Description |
---|---|
void |
addClient(de.smarten.tsuro.shared.gamemodel.Client client)
Adds a client to the game.
|
void |
cancelGame()
Cancels the game by setting the game state accordingly and sending a notification
to all connected clients.
|
void |
connectionResetCallback(de.smarten.tsuro.shared.gamemodel.Client client) |
void |
continueGame()
Resumes the game by setting the game state accordingly and sending a notification
to all connected clients.
|
de.smarten.tsuro.shared.gamemodel.Game |
getGame()
Returns the Game object of the game managed by this GameControl
|
de.smarten.tsuro.shared.gamemodel.GameModel |
getGameModel()
Returns the game model.
|
de.smarten.tsuro.shared.gamemodel.GameState |
getGameState()
Returns the gameState of the game managed by this GameControl or NOT_RUNNING,
if the Game object is not yet initialized.
|
List<de.smarten.tsuro.shared.gamemodel.Client> |
getPlayers()
Creates a copy of the list of player
Client s |
List<de.smarten.tsuro.shared.gamemodel.Client> |
getSpectators()
Creates a copy of the list of spectator
Client s |
void |
pauseGame()
Pauses the game by setting the game state accordingly and sending a notification
to all connected clients.
|
boolean |
removeClient(de.smarten.tsuro.shared.gamemodel.Client client) |
void |
setStartingPlayer(de.smarten.tsuro.shared.gamemodel.Client client)
Sets the starting player of the game.
|
void |
setTileCallback(de.smarten.tsuro.shared.gamemodel.Client client,
de.upb.swt.swtpra2017.swtinterface.Placement ePlacement)
Moves the players token to it's new position depending on the tile he placed.
|
void |
setTokenCallback(de.smarten.tsuro.shared.gamemodel.Client client,
de.smarten.tsuro.shared.gamemodel.Gate gate)
Sets the gate of the player's token.
|
void |
startGame()
Starts and runs the game.
|
void |
update(Observable o,
Object changedObject) |
public GameControl(ConnectionManager cm, int gameId, String roomName, de.smarten.tsuro.shared.gamemodel.Configuration config)
public de.smarten.tsuro.shared.gamemodel.GameModel getGameModel()
public de.smarten.tsuro.shared.gamemodel.GameState getGameState()
public de.smarten.tsuro.shared.gamemodel.Game getGame()
public List<de.smarten.tsuro.shared.gamemodel.Client> getPlayers()
Client
sClient
spublic List<de.smarten.tsuro.shared.gamemodel.Client> getSpectators()
Client
sClient
spublic void addClient(de.smarten.tsuro.shared.gamemodel.Client client) throws GameFullException
client
- The client to be added.GameFullException
- if the game has already maximum number of clients for a gamepublic boolean removeClient(de.smarten.tsuro.shared.gamemodel.Client client)
public void setStartingPlayer(de.smarten.tsuro.shared.gamemodel.Client client) throws IncompleteInputException
client
- The client to be set as the starting player.IncompleteInputException
- if the client specified in the parameter is not in the
list of playerspublic void startGame()
First, the game and all spectators are added to the ConnectionManager
.
Then a GameStartNotification is sent to all clients. After that, rounds will be
played until there is only one player left in the game.
public void pauseGame()
public void continueGame()
public void cancelGame()
public void setTokenCallback(de.smarten.tsuro.shared.gamemodel.Client client, de.smarten.tsuro.shared.gamemodel.Gate gate)
client
- The client object of the playergate
- The gate on which the token should be placedpublic void setTileCallback(de.smarten.tsuro.shared.gamemodel.Client client, de.upb.swt.swtpra2017.swtinterface.Placement ePlacement)
client
- The client object of the playerplacement
- The placement that should be placed.public void connectionResetCallback(de.smarten.tsuro.shared.gamemodel.Client client)
public void update(Observable o, Object changedObject)
Copyright © 2017 smarTen. All rights reserved.