public class GUIControl extends Object
Constructor and Description |
---|
GUIControl(GUI gui)
Constructor
sets GUI and creates new EngineControl.
|
Modifier and Type | Method and Description |
---|---|
void |
abortGame(de.smarten.tsuro.shared.gamemodel.Game g)
Sends the order to abort the Game given as parameter.
|
void |
addClientsToGame(javafx.collections.ObservableList<de.smarten.tsuro.shared.gamemodel.Client> clients)
Calls the EngineControl to add the given clients to the
current game.
|
void |
addClientsToTournament(javafx.collections.ObservableList<de.smarten.tsuro.shared.gamemodel.Client> observableList)
Sends an observableList with Client-objects to the EngineControl in
order to add them to the tournament.
|
void |
addGame()
Calls the EngineControl to create a new game with the saved name and configuration file.
|
void |
addSpectators(javafx.collections.ObservableList<de.smarten.tsuro.shared.gamemodel.Client> spectators)
Extracts each Client-object out of the given list to send them one-after-one to the
EngineControl in order to be added to a game as spectator.
|
void |
addTournament()
Calls the GameEngine to create a new tournament with the saved name.
|
void |
cancelCreation()
Cancels game and tournament creation.
|
void |
configurateTournament()
Calls the EngineControl to set the saved coonfiguration files as
configurations for the current tournament.
|
void |
continueGame(de.smarten.tsuro.shared.gamemodel.Game g)
Sends the order to continue the Game given as parameter.
|
ArrayList<File> |
getChosenConfigurations() |
String |
getConfigurationName() |
List<de.smarten.tsuro.shared.gamemodel.Game> |
getGames()
Calls the EngineControl to get the List of currentlx active games.
|
String |
getName() |
List<de.smarten.tsuro.shared.gamemodel.Client> |
getPlayers() |
int |
getPlayersInConfig()
Calls the EngineControl to get the number of players
defined in the current Configuration.
|
Iterator<de.smarten.tsuro.shared.gamemodel.Client> |
getPoolPlayersIterator()
Requests the Iterator over clients who are connected and want to play.
|
Iterator<de.smarten.tsuro.shared.gamemodel.Client> |
getPoolSpectatorsIterator()
Requests the Iterator over clients who are connected and want to spectate.
|
List<de.smarten.tsuro.shared.gamemodel.Client> |
getSpectators() |
List<de.smarten.tsuro.shared.gamemodel.Client> |
getTournamentPlayers() |
Boolean |
isConfigurated(int mode)
Returns true if a single configuration file (in case of single game creation)
or a list of configuration files is set (in case of tournament creation); false
if not.
|
void |
main(String[] args) |
void |
pauseGame(de.smarten.tsuro.shared.gamemodel.Game g)
Sends the order to pause the Game given as parameter.
|
void |
removeClientFromGame(de.smarten.tsuro.shared.gamemodel.Client back)
Calls the EngineControl to remove the given client from the current game.
|
void |
removeFileFromList(String del)
Removes the file with the given name from the saved list of configuration files.
|
void |
sendError(String errorMessage,
String errorHead,
int errorType)
Sends call to the GUI to show an error message wth the given parameters.
|
void |
setFile(File config)
Sets the given file for the single game creation.
|
void |
setFirstConfiguration(String selectedItem)
Gets the given configuration file from the list of files and calls
the EngineControl to set it as starting configuration for the current tournament.
|
boolean |
setGameName(String gameName)
Saves the given name for the single game and tournament creation.
|
void |
setStartingPlayer(de.smarten.tsuro.shared.gamemodel.Client player)
Calls the EngineContol to set the given client as the starting
player of the current game.
|
void |
setTournamentFile(ArrayList<File> configFiles)
Saves the given list of configuration files to be used in the tournament creation.
|
void |
shutdown()
Forwards the order to shutdown the GameEngine to the EngineControl.
|
void |
startGame()
Calls the EngineControl to start the current single game.
|
void |
startTournament()
Calls the EngineControl to start the current tournament.
|
public GUIControl(GUI gui)
gui
- the GUI that should be controlledpublic void main(String[] args)
public void cancelCreation()
public Boolean isConfigurated(int mode)
mode
- Indicates if check is for single game (1) or tournament (2).public String getConfigurationName()
public void sendError(String errorMessage, String errorHead, int errorType)
errorMessage
- Message shown in the error.errorHead
- Header of the error.errorType
- Error-window layout.public boolean setGameName(String gameName)
gameName
- the string contains the name of the gamepublic ArrayList<File> getChosenConfigurations()
public Iterator<de.smarten.tsuro.shared.gamemodel.Client> getPoolPlayersIterator()
public Iterator<de.smarten.tsuro.shared.gamemodel.Client> getPoolSpectatorsIterator()
public void removeClientFromGame(de.smarten.tsuro.shared.gamemodel.Client back)
back
- the client that should be removedpublic void addGame() throws IOException
IOException
- if the configuration file is invalidpublic void startGame()
public void setStartingPlayer(de.smarten.tsuro.shared.gamemodel.Client player) throws IncompleteInputException
player
- Client selected to be the starting player.IncompleteInputException
- if the client specified in the parameter is not in the player listpublic void addClientsToGame(javafx.collections.ObservableList<de.smarten.tsuro.shared.gamemodel.Client> clients)
clients
- Clients to be added.public void setFile(File config) throws IOException
config
- the given configuration fileIOException
- if the configuration is invalidpublic int getPlayersInConfig()
public List<de.smarten.tsuro.shared.gamemodel.Game> getGames()
public void setTournamentFile(ArrayList<File> configFiles) throws IOException
configFiles
- an ArrayList of configuration files that that should be saved so they can be used in the tournament creationIOException
- if the given configuration files are invalidpublic void configurateTournament()
public void startTournament() throws IncompleteInputException, Exception
IncompleteInputException
- if the input added to the tournament is incompleteException
- if the game can't be startedpublic void addTournament()
public void addClientsToTournament(javafx.collections.ObservableList<de.smarten.tsuro.shared.gamemodel.Client> observableList)
observableList
- Contains the Client-objects which shall be added to the tournament.public void removeFileFromList(String del)
del
- Name of the file to be deleted.public void setFirstConfiguration(String selectedItem) throws IOException
selectedItem
- the selected ItemIOException
- if the selected configuration couldn't be set as first configurationpublic void shutdown()
public String getName()
public void addSpectators(javafx.collections.ObservableList<de.smarten.tsuro.shared.gamemodel.Client> spectators)
spectators
- The ObservableList which contains the Client-objects.public List<de.smarten.tsuro.shared.gamemodel.Client> getPlayers()
public List<de.smarten.tsuro.shared.gamemodel.Client> getSpectators()
public List<de.smarten.tsuro.shared.gamemodel.Client> getTournamentPlayers()
public void pauseGame(de.smarten.tsuro.shared.gamemodel.Game g)
g
- The Game-object to be paused.public void continueGame(de.smarten.tsuro.shared.gamemodel.Game g)
g
- The Game-object to be continued.public void abortGame(de.smarten.tsuro.shared.gamemodel.Game g)
g
- The Game-object to be aborted.Copyright © 2017 smarTen. All rights reserved.