public class EngineControl extends Object
Constructor and Description |
---|
EngineControl(GUIControl guiControl)
Initializes all needed Objects; starts the connecting process.
|
Modifier and Type | Method and Description |
---|---|
void |
abortGame(de.smarten.tsuro.shared.gamemodel.Game g)
Gets the GameControl of the game given by the parameter and sends the order to abort it.
|
void |
addClientToGame(de.smarten.tsuro.shared.gamemodel.Client client)
Calls the pool method to add the given Client to the current game.
|
void |
addNewGame(String roomName,
File configFile)
Creates a new game with the name and configuration given through
the parameters.
|
void |
addNewTournament(String name)
Creates a new tournament with the given name.
|
void |
addPlayersToTournament(javafx.collections.ObservableList<de.smarten.tsuro.shared.gamemodel.Client> observableList)
Adds the clients contained in the list given as players to
the current tournament.
|
void |
addSpectator(de.smarten.tsuro.shared.gamemodel.Client spectator)
Adds the Client-object given by the parameter as spectator to the current game.
|
void |
cancelGameCreation()
Cancels the creation of the current game or tournament by removing
all player and spectator clients from the game and moving them back to their
respective pools.
|
void |
continueGame(de.smarten.tsuro.shared.gamemodel.Game g)
Gets the GameControl of the game given by the parameter and sends the order to continue it.
|
void |
gameJoinRequestCallback(de.smarten.tsuro.shared.gamemodel.Client client,
int gameId)
Sends a JoinResponse to the given client when it s added to the pool.
|
List<de.smarten.tsuro.shared.gamemodel.Game> |
getGames() |
List<de.smarten.tsuro.shared.gamemodel.Client> |
getPlayers()
Gets the Client.objects which take part as players in the currently created game.
|
int |
getPlayersInThisConfig() |
Iterator<de.smarten.tsuro.shared.gamemodel.Client> |
getPoolPlayersIterator() |
Iterator<de.smarten.tsuro.shared.gamemodel.Client> |
getPoolSpectatorsIterator() |
List<de.smarten.tsuro.shared.gamemodel.Client> |
getSpectators()
Gets the Client.objects which take part as spectators in the currently created game.
|
List<de.smarten.tsuro.shared.gamemodel.Client> |
getTournamentPlayers() |
void |
pauseGame(de.smarten.tsuro.shared.gamemodel.Game g)
Gets the GameControl of the game given by the parameter and sends the order to pause it.
|
void |
removeClientFromGame(de.smarten.tsuro.shared.gamemodel.Client client)
Calls the pool method to remove the given client from the current game,
moving it from back to the connected-clients pool.
|
void |
removeClientFromPool(de.smarten.tsuro.shared.gamemodel.Client client)
Removes the Client-object given by the parameter from the pool of connected clients.
|
void |
setFirstConfiguration(File file)
Builds a configuration-object on base of the given file and
sets it as the configuration to be used in the first tournament level of the current tournament.
|
void |
setStartingPlayer(de.smarten.tsuro.shared.gamemodel.Client client)
Sets the given client as starting player in the current game.
|
void |
setTournamentConfigurations(ArrayList<File> configFile)
Converts the given configuration-files into configuration-objects and
adds them to the current tournament.
|
void |
shutdown()
Sends the order to shutdown to the ConnectionManager.
|
void |
startGame()
Starts the current game
|
void |
startTournament()
Starts the current tournament.
|
void |
updateFromTournament(TournamentControl sender,
Object o)
called from a
TournamentControl , when something important happens in the tournament |
public EngineControl(GUIControl guiControl)
guiControl
- the control class of the GUIpublic void addNewGame(String roomName, File configFile) throws IOException
roomName
- the name of the new gameconfigFile
- the file that contains the configurationIOException
- if the configFile is invalidpublic void addClientToGame(de.smarten.tsuro.shared.gamemodel.Client client)
client
- the given client that should be added to the poolpublic void removeClientFromGame(de.smarten.tsuro.shared.gamemodel.Client client)
client
- the client that should be removed from the gamepublic void setStartingPlayer(de.smarten.tsuro.shared.gamemodel.Client client) throws IncompleteInputException
client
- the client who should have the first turn in the gameIncompleteInputException
- if the client specified in the parameter isn't in the list of playerspublic void cancelGameCreation()
public void startGame()
public void addNewTournament(String name)
name
- the name the tournament should havepublic void addPlayersToTournament(javafx.collections.ObservableList<de.smarten.tsuro.shared.gamemodel.Client> observableList)
observableList
- an ArrayList of players who should be added to the gamepublic void setTournamentConfigurations(ArrayList<File> configFile)
configFile
- the configuration-files that should be converted into configuration-objectspublic void startTournament() throws IncompleteInputException, Exception
IncompleteInputException
- if the input added to the tournament is incompleteException
- if the game can't be startedpublic int getPlayersInThisConfig()
public List<de.smarten.tsuro.shared.gamemodel.Game> getGames()
public Iterator<de.smarten.tsuro.shared.gamemodel.Client> getPoolPlayersIterator()
public Iterator<de.smarten.tsuro.shared.gamemodel.Client> getPoolSpectatorsIterator()
public List<de.smarten.tsuro.shared.gamemodel.Client> getPlayers()
public List<de.smarten.tsuro.shared.gamemodel.Client> getSpectators()
public void gameJoinRequestCallback(de.smarten.tsuro.shared.gamemodel.Client client, int gameId)
client
- the clientgameId
- the ID of the game the client is added topublic void setFirstConfiguration(File file) throws IOException
file
- the given file that should be converted in a configuration-objectIOException
- if the selected configuration could not be set as first configurationpublic void shutdown()
public void addSpectator(de.smarten.tsuro.shared.gamemodel.Client spectator)
spectator
- The Client-object to be added as spectator.public void removeClientFromPool(de.smarten.tsuro.shared.gamemodel.Client client)
client
- The Client-object to be removed from the pool.public List<de.smarten.tsuro.shared.gamemodel.Client> getTournamentPlayers()
public void updateFromTournament(TournamentControl sender, Object o)
TournamentControl
, when something important happens in the tournamentsender
- TournamentControl
-Object that sends the updateo
- Object that has been changed and caused the updatepublic void pauseGame(de.smarten.tsuro.shared.gamemodel.Game g)
g
- The game which shall be paused.public void continueGame(de.smarten.tsuro.shared.gamemodel.Game g)
g
- The game which shall be continued.public void abortGame(de.smarten.tsuro.shared.gamemodel.Game g)
g
- The game which shall be aborted.Copyright © 2017 smarTen. All rights reserved.