java.lang.Object
javafx.application.Application
it.polimi.ingsw.view.gui.GUI
- All Implemented Interfaces:
ViewInterface
public class GUI extends javafx.application.Application implements ViewInterface
-
Nested Class Summary
-
Field Summary
-
Constructor Summary
Constructors Constructor Description GUI()
-
Method Summary
Modifier and Type Method Description void
askIP()
Asks the user the server address to connect tovoid
askLobbyName()
Asks the user the name for the lobby to be createdvoid
askLobbySize()
Asks the user the number of players for its lobbyvoid
askToReloadLastSettings(java.util.List<java.lang.String> savedUsers)
Asks the user if it wants to reload a previously saved address/username combovoid
askUsername()
Asks the user the username it wants to usevoid
buildAction(java.util.List<Cell> gameBoard, java.util.List<Cell> buildableCells)
Asks the user to select a cell to build onvoid
chooseAction(java.util.List<PossibleActions> possibleActions)
Asks the user which action to performvoid
chooseBlockToBuild(java.util.List<Block> buildableBlocks)
Asks the user which block to build on a cellvoid
chooseGameGods(java.util.List<GodData> allGods, int size)
Asks the lobby owner to choose the gods for the gamevoid
chooseLobbyToJoin(java.util.Map<java.lang.String,java.util.List<java.lang.String>> lobbiesAvailable)
Asks the user which lobby it wants to joinvoid
chooseMatchReload()
Asks the user if it wants to reload an existing saved matchvoid
chooseStartingPlayer(java.util.List<java.lang.String> players)
Asks the user which player will play firstvoid
chooseUserGod(java.util.List<GodData> possibleGods)
Asks the user to pick its godvoid
chooseWorker(java.util.List<Cell> workersCells)
Asks the user to choose a workervoid
gameBoardUpdate(java.util.List<Cell> gameBoard, java.util.List<PlayerData> players)
Refreshes the game screenvoid
gameStartScreen(java.util.List<Cell> gameBoard, java.util.List<PlayerData> players)
Sets up the game board and its graphicsstatic void
launchGui()
void
lobbyOptions(java.util.List<java.lang.String> options)
Asks the user if it wants to join or create a lobbyvoid
moveAction(java.util.List<Cell> gameBoard, java.util.List<Cell> walkableCells)
Asks the user to select a cell to move its current worker onvoid
placeWorker()
Asks the user to place its worker on the boardvoid
printLogo()
Prints the start screenvoid
setInputManager(InputManager inputManager)
Sets the InputManager to parse the inputsvoid
setInputString(java.lang.String inputString)
static void
setRoot(java.lang.String fxml)
void
showErrorMessage(java.lang.String error)
Shows an error messagevoid
showGameBoard(java.util.List<Cell> gameBoard)
Prints the game board on the screenvoid
showSuccessMessage(java.lang.String message)
Shows a success messagevoid
start(javafx.stage.Stage primarystage)
Methods inherited from class javafx.application.Application
getHostServices, getParameters, getUserAgentStylesheet, init, launch, launch, notifyPreloader, setUserAgentStylesheet, stop
-
Constructor Details
-
GUI
public GUI()
-
-
Method Details
-
setRoot
public static void setRoot(java.lang.String fxml) -
launchGui
public static void launchGui() -
start
public void start(javafx.stage.Stage primarystage)- Specified by:
start
in classjavafx.application.Application
-
setInputString
public void setInputString(java.lang.String inputString) -
askToReloadLastSettings
public void askToReloadLastSettings(java.util.List<java.lang.String> savedUsers)Description copied from interface:ViewInterface
Asks the user if it wants to reload a previously saved address/username combo- Specified by:
askToReloadLastSettings
in interfaceViewInterface
- Parameters:
savedUsers
- the address/username combos
-
chooseMatchReload
public void chooseMatchReload()Description copied from interface:ViewInterface
Asks the user if it wants to reload an existing saved match- Specified by:
chooseMatchReload
in interfaceViewInterface
-
setInputManager
Description copied from interface:ViewInterface
Sets the InputManager to parse the inputs- Specified by:
setInputManager
in interfaceViewInterface
- Parameters:
inputManager
- te inputManager to use
-
printLogo
public void printLogo()Description copied from interface:ViewInterface
Prints the start screen- Specified by:
printLogo
in interfaceViewInterface
-
askIP
public void askIP()Description copied from interface:ViewInterface
Asks the user the server address to connect to- Specified by:
askIP
in interfaceViewInterface
-
askUsername
public void askUsername()Description copied from interface:ViewInterface
Asks the user the username it wants to use- Specified by:
askUsername
in interfaceViewInterface
-
gameStartScreen
Description copied from interface:ViewInterface
Sets up the game board and its graphics- Specified by:
gameStartScreen
in interfaceViewInterface
- Parameters:
gameBoard
- the starting game boardplayers
- the players data
-
lobbyOptions
public void lobbyOptions(java.util.List<java.lang.String> options)Description copied from interface:ViewInterface
Asks the user if it wants to join or create a lobby- Specified by:
lobbyOptions
in interfaceViewInterface
- Parameters:
options
- the possible options
-
askLobbyName
public void askLobbyName()Description copied from interface:ViewInterface
Asks the user the name for the lobby to be created- Specified by:
askLobbyName
in interfaceViewInterface
-
askLobbySize
public void askLobbySize()Description copied from interface:ViewInterface
Asks the user the number of players for its lobby- Specified by:
askLobbySize
in interfaceViewInterface
-
chooseLobbyToJoin
public void chooseLobbyToJoin(java.util.Map<java.lang.String,java.util.List<java.lang.String>> lobbiesAvailable)Description copied from interface:ViewInterface
Asks the user which lobby it wants to join- Specified by:
chooseLobbyToJoin
in interfaceViewInterface
- Parameters:
lobbiesAvailable
- a map containing lobbies and their info- See Also:
Lobby.lobbyInfo()
-
chooseWorker
Description copied from interface:ViewInterface
Asks the user to choose a worker- Specified by:
chooseWorker
in interfaceViewInterface
- Parameters:
workersCells
- the cells containing the player's workers
-
moveAction
Description copied from interface:ViewInterface
Asks the user to select a cell to move its current worker on- Specified by:
moveAction
in interfaceViewInterface
- Parameters:
gameBoard
- the current game boardwalkableCells
- the cells on which the worker can be moved to
-
buildAction
Description copied from interface:ViewInterface
Asks the user to select a cell to build on- Specified by:
buildAction
in interfaceViewInterface
- Parameters:
gameBoard
- the current game boardbuildableCells
- the cells on which the worker can build
-
chooseBlockToBuild
Description copied from interface:ViewInterface
Asks the user which block to build on a cell- Specified by:
chooseBlockToBuild
in interfaceViewInterface
- Parameters:
buildableBlocks
- the possible blocks (always more than one)
-
chooseUserGod
Description copied from interface:ViewInterface
Asks the user to pick its god- Specified by:
chooseUserGod
in interfaceViewInterface
- Parameters:
possibleGods
- a list containing the available gods
-
chooseGameGods
Description copied from interface:ViewInterface
Asks the lobby owner to choose the gods for the game- Specified by:
chooseGameGods
in interfaceViewInterface
- Parameters:
allGods
- the list of available godssize
- the number of players
-
chooseStartingPlayer
public void chooseStartingPlayer(java.util.List<java.lang.String> players)Description copied from interface:ViewInterface
Asks the user which player will play first- Specified by:
chooseStartingPlayer
in interfaceViewInterface
- Parameters:
players
- the list of players
-
placeWorker
public void placeWorker()Description copied from interface:ViewInterface
Asks the user to place its worker on the board- Specified by:
placeWorker
in interfaceViewInterface
-
chooseAction
Description copied from interface:ViewInterface
Asks the user which action to perform- Specified by:
chooseAction
in interfaceViewInterface
- Parameters:
possibleActions
- a list of possible actions
-
showGameBoard
Description copied from interface:ViewInterface
Prints the game board on the screen- Specified by:
showGameBoard
in interfaceViewInterface
- Parameters:
gameBoard
- the board to print
-
gameBoardUpdate
Description copied from interface:ViewInterface
Refreshes the game screen- Specified by:
gameBoardUpdate
in interfaceViewInterface
- Parameters:
gameBoard
- the board to start withplayers
- information about the players
-
showErrorMessage
public void showErrorMessage(java.lang.String error)Description copied from interface:ViewInterface
Shows an error message- Specified by:
showErrorMessage
in interfaceViewInterface
- Parameters:
error
- the error message
-
showSuccessMessage
public void showSuccessMessage(java.lang.String message)Description copied from interface:ViewInterface
Shows a success message- Specified by:
showSuccessMessage
in interfaceViewInterface
- Parameters:
message
- the message
-