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 voidaskIP()Asks the user the server address to connect tovoidaskLobbyName()Asks the user the name for the lobby to be createdvoidaskLobbySize()Asks the user the number of players for its lobbyvoidaskToReloadLastSettings(java.util.List<java.lang.String> savedUsers)Asks the user if it wants to reload a previously saved address/username combovoidaskUsername()Asks the user the username it wants to usevoidbuildAction(java.util.List<Cell> gameBoard, java.util.List<Cell> buildableCells)Asks the user to select a cell to build onvoidchooseAction(java.util.List<PossibleActions> possibleActions)Asks the user which action to performvoidchooseBlockToBuild(java.util.List<Block> buildableBlocks)Asks the user which block to build on a cellvoidchooseGameGods(java.util.List<GodData> allGods, int size)Asks the lobby owner to choose the gods for the gamevoidchooseLobbyToJoin(java.util.Map<java.lang.String,java.util.List<java.lang.String>> lobbiesAvailable)Asks the user which lobby it wants to joinvoidchooseMatchReload()Asks the user if it wants to reload an existing saved matchvoidchooseStartingPlayer(java.util.List<java.lang.String> players)Asks the user which player will play firstvoidchooseUserGod(java.util.List<GodData> possibleGods)Asks the user to pick its godvoidchooseWorker(java.util.List<Cell> workersCells)Asks the user to choose a workervoidgameBoardUpdate(java.util.List<Cell> gameBoard, java.util.List<PlayerData> players)Refreshes the game screenvoidgameStartScreen(java.util.List<Cell> gameBoard, java.util.List<PlayerData> players)Sets up the game board and its graphicsstatic voidlaunchGui()voidlobbyOptions(java.util.List<java.lang.String> options)Asks the user if it wants to join or create a lobbyvoidmoveAction(java.util.List<Cell> gameBoard, java.util.List<Cell> walkableCells)Asks the user to select a cell to move its current worker onvoidplaceWorker()Asks the user to place its worker on the boardvoidprintLogo()Prints the start screenvoidsetInputManager(InputManager inputManager)Sets the InputManager to parse the inputsvoidsetInputString(java.lang.String inputString)static voidsetRoot(java.lang.String fxml)voidshowErrorMessage(java.lang.String error)Shows an error messagevoidshowGameBoard(java.util.List<Cell> gameBoard)Prints the game board on the screenvoidshowSuccessMessage(java.lang.String message)Shows a success messagevoidstart(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:
startin 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:ViewInterfaceAsks the user if it wants to reload a previously saved address/username combo- Specified by:
askToReloadLastSettingsin interfaceViewInterface- Parameters:
savedUsers- the address/username combos
-
chooseMatchReload
public void chooseMatchReload()Description copied from interface:ViewInterfaceAsks the user if it wants to reload an existing saved match- Specified by:
chooseMatchReloadin interfaceViewInterface
-
setInputManager
Description copied from interface:ViewInterfaceSets the InputManager to parse the inputs- Specified by:
setInputManagerin interfaceViewInterface- Parameters:
inputManager- te inputManager to use
-
printLogo
public void printLogo()Description copied from interface:ViewInterfacePrints the start screen- Specified by:
printLogoin interfaceViewInterface
-
askIP
public void askIP()Description copied from interface:ViewInterfaceAsks the user the server address to connect to- Specified by:
askIPin interfaceViewInterface
-
askUsername
public void askUsername()Description copied from interface:ViewInterfaceAsks the user the username it wants to use- Specified by:
askUsernamein interfaceViewInterface
-
gameStartScreen
Description copied from interface:ViewInterfaceSets up the game board and its graphics- Specified by:
gameStartScreenin 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:ViewInterfaceAsks the user if it wants to join or create a lobby- Specified by:
lobbyOptionsin interfaceViewInterface- Parameters:
options- the possible options
-
askLobbyName
public void askLobbyName()Description copied from interface:ViewInterfaceAsks the user the name for the lobby to be created- Specified by:
askLobbyNamein interfaceViewInterface
-
askLobbySize
public void askLobbySize()Description copied from interface:ViewInterfaceAsks the user the number of players for its lobby- Specified by:
askLobbySizein interfaceViewInterface
-
chooseLobbyToJoin
public void chooseLobbyToJoin(java.util.Map<java.lang.String,java.util.List<java.lang.String>> lobbiesAvailable)Description copied from interface:ViewInterfaceAsks the user which lobby it wants to join- Specified by:
chooseLobbyToJoinin interfaceViewInterface- Parameters:
lobbiesAvailable- a map containing lobbies and their info- See Also:
Lobby.lobbyInfo()
-
chooseWorker
Description copied from interface:ViewInterfaceAsks the user to choose a worker- Specified by:
chooseWorkerin interfaceViewInterface- Parameters:
workersCells- the cells containing the player's workers
-
moveAction
Description copied from interface:ViewInterfaceAsks the user to select a cell to move its current worker on- Specified by:
moveActionin interfaceViewInterface- Parameters:
gameBoard- the current game boardwalkableCells- the cells on which the worker can be moved to
-
buildAction
Description copied from interface:ViewInterfaceAsks the user to select a cell to build on- Specified by:
buildActionin interfaceViewInterface- Parameters:
gameBoard- the current game boardbuildableCells- the cells on which the worker can build
-
chooseBlockToBuild
Description copied from interface:ViewInterfaceAsks the user which block to build on a cell- Specified by:
chooseBlockToBuildin interfaceViewInterface- Parameters:
buildableBlocks- the possible blocks (always more than one)
-
chooseUserGod
Description copied from interface:ViewInterfaceAsks the user to pick its god- Specified by:
chooseUserGodin interfaceViewInterface- Parameters:
possibleGods- a list containing the available gods
-
chooseGameGods
Description copied from interface:ViewInterfaceAsks the lobby owner to choose the gods for the game- Specified by:
chooseGameGodsin 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:ViewInterfaceAsks the user which player will play first- Specified by:
chooseStartingPlayerin interfaceViewInterface- Parameters:
players- the list of players
-
placeWorker
public void placeWorker()Description copied from interface:ViewInterfaceAsks the user to place its worker on the board- Specified by:
placeWorkerin interfaceViewInterface
-
chooseAction
Description copied from interface:ViewInterfaceAsks the user which action to perform- Specified by:
chooseActionin interfaceViewInterface- Parameters:
possibleActions- a list of possible actions
-
showGameBoard
Description copied from interface:ViewInterfacePrints the game board on the screen- Specified by:
showGameBoardin interfaceViewInterface- Parameters:
gameBoard- the board to print
-
gameBoardUpdate
Description copied from interface:ViewInterfaceRefreshes the game screen- Specified by:
gameBoardUpdatein interfaceViewInterface- Parameters:
gameBoard- the board to start withplayers- information about the players
-
showErrorMessage
public void showErrorMessage(java.lang.String error)Description copied from interface:ViewInterfaceShows an error message- Specified by:
showErrorMessagein interfaceViewInterface- Parameters:
error- the error message
-
showSuccessMessage
public void showSuccessMessage(java.lang.String message)Description copied from interface:ViewInterfaceShows a success message- Specified by:
showSuccessMessagein interfaceViewInterface- Parameters:
message- the message
-