java.lang.Object
it.polimi.ingsw.view.cli.console.printers.Printer
it.polimi.ingsw.view.cli.console.printers.fancyPrinter.FancyPrinter
public class FancyPrinter extends Printer
Fancy printer for systems supporting non canonical terminal mode
-
Field Summary
Fields inherited from class it.polimi.ingsw.view.cli.console.printers.Printer
boardUtils, cli, console, mainLogo, properties, SCENE_HEIGHT, SCENE_WIDTH -
Constructor Summary
Constructors Constructor Description FancyPrinter(Console console, CLI cli)Default constructor -
Method Summary
Modifier and Type Method Description voidaskIp()Asks the user both the server address and the username
At this point, the username is surely not set yetvoidaskLobbyName()Shows a TextInputDialog asking for both the lobby name and sizevoidaskLobbySize()Does nothing, the lobby size is asked in askLobbyName() for this printervoidaskToReloadSettings()Asks the user if it wants to reload an already used address/username combovoidaskUsername()Asks the user its username only
This will generate an InputDialog only if the current state is "LOBBY", a.k.a.voidbuildAction(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)Shows the user a MultipleChoiceListDialog, containing the gods and their descriptionsvoidchooseLobbyToJoin(java.util.Map<java.lang.String,java.util.List<java.lang.String>> lobbiesAvailable)Asks the user to choose which lobby to join, showing a list of available lobbies and their detailsvoidchooseStartingPlayer(java.util.List<java.lang.String> players)Asks the user which player will play firstvoidchooseToReloadMatch()Shows the user a dialog with two buttons (Yes/No), asking the user if it wants to reload a previously saved game statusvoidchooseUserGod(java.util.List<GodData> possibleGods)Shows the user a DetailedSingleChoiceListDialog, containing the available gods and descriptionsvoidchooseWorker(java.util.List<Cell> cells)Asks the user to choose a workervoidlobbyOptions(java.util.List<java.lang.String> options)Shows a dialog with one or two buttons, based on the possible lobby options (Create/Join)voidmoveAction(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 boardvoidprintError(java.lang.String errorMsg)Shows a popup error messagevoidprintMessage(java.lang.String msg)Shows a popup general messagevoidprintStartingScreen()Shows the "Santorini" logoprotected BoardUtilssetBoardUtils()Creates a FancyPrinterBoardUtilsvoidshowSavedSettings(java.util.List<java.lang.String> options)Shows a dialog with Yes/No buttons to decide to reload a previously saved address/username combovoidupdateGameData(java.util.List<Cell> board, java.util.List<PlayerData> players)Updates information about the game and the playersMethods inherited from class it.polimi.ingsw.view.cli.console.printers.Printer
getConsole, highlightWorkers, showGameBoard, showGameBoard
-
Constructor Details
-
FancyPrinter
Default constructor- Parameters:
console- the console in which the output will be printedcli- the UI object- Throws:
java.io.IOException
-
-
Method Details
-
printError
public void printError(java.lang.String errorMsg)Shows a popup error message- Specified by:
printErrorin classPrinter- Parameters:
errorMsg- the error message
-
printMessage
public void printMessage(java.lang.String msg)Shows a popup general message- Specified by:
printMessagein classPrinter- Parameters:
msg- the message
-
printStartingScreen
public void printStartingScreen()Shows the "Santorini" logo- Specified by:
printStartingScreenin classPrinter
-
askToReloadSettings
public void askToReloadSettings()Asks the user if it wants to reload an already used address/username combo- Specified by:
askToReloadSettingsin classPrinter
-
showSavedSettings
public void showSavedSettings(java.util.List<java.lang.String> options)Shows a dialog with Yes/No buttons to decide to reload a previously saved address/username combo- Specified by:
showSavedSettingsin classPrinter- Parameters:
options- the address/username combos
-
askIp
public void askIp()Asks the user both the server address and the username
At this point, the username is surely not set yet -
askUsername
public void askUsername()Asks the user its username only
This will generate an InputDialog only if the current state is "LOBBY", a.k.a. the user tried to join a lobby using an already taken username for that lobby- Specified by:
askUsernamein classPrinter
-
lobbyOptions
public void lobbyOptions(java.util.List<java.lang.String> options)Shows a dialog with one or two buttons, based on the possible lobby options (Create/Join)- Specified by:
lobbyOptionsin classPrinter- Parameters:
options- a list of possible options
-
askLobbyName
public void askLobbyName()Shows a TextInputDialog asking for both the lobby name and size- Specified by:
askLobbyNamein classPrinter
-
askLobbySize
public void askLobbySize()Does nothing, the lobby size is asked in askLobbyName() for this printer- Specified by:
askLobbySizein classPrinter
-
chooseLobbyToJoin
public void chooseLobbyToJoin(java.util.Map<java.lang.String,java.util.List<java.lang.String>> lobbiesAvailable)Asks the user to choose which lobby to join, showing a list of available lobbies and their details- Specified by:
chooseLobbyToJoinin classPrinter- Parameters:
lobbiesAvailable- a map containing the lobbies available and their relative information- See Also:
Lobby.lobbyInfo()
-
chooseToReloadMatch
public void chooseToReloadMatch()Shows the user a dialog with two buttons (Yes/No), asking the user if it wants to reload a previously saved game status- Specified by:
chooseToReloadMatchin classPrinter
-
chooseGameGods
Shows the user a MultipleChoiceListDialog, containing the gods and their descriptions- Specified by:
chooseGameGodsin classPrinter- Parameters:
allGods- the list of available godssize- the number of players
-
chooseUserGod
Shows the user a DetailedSingleChoiceListDialog, containing the available gods and descriptions- Specified by:
chooseUserGodin classPrinter- Parameters:
possibleGods- a list containing the available gods
-
chooseStartingPlayer
public void chooseStartingPlayer(java.util.List<java.lang.String> players)Asks the user which player will play first- Specified by:
chooseStartingPlayerin classPrinter- Parameters:
players- the players in game
-
setBoardUtils
Creates a FancyPrinterBoardUtils- Specified by:
setBoardUtilsin classPrinter- Returns:
- a boardUtils object
-
updateGameData
Updates information about the game and the players- Specified by:
updateGameDatain classPrinter- Parameters:
board- the game boardplayers- information about the players
-
chooseAction
Asks the user which action to perform- Specified by:
chooseActionin classPrinter- Parameters:
possibleActions- a list of possible actions
-
placeWorker
public void placeWorker()Asks the user to place its worker on the board- Specified by:
placeWorkerin classPrinter
-
chooseWorker
Asks the user to choose a worker- Specified by:
chooseWorkerin classPrinter- Parameters:
cells- the cells containing the player's workers
-
moveAction
Asks the user to select a cell to move its current worker on- Specified by:
moveActionin classPrinter- Parameters:
gameBoard- the current game boardwalkableCells- the cells on which the worker can be moved to
-
buildAction
Asks the user to select a cell to build on- Specified by:
buildActionin classPrinter- Parameters:
gameBoard- the current game boardbuildableCells- the cells on which the worker can build
-
chooseBlockToBuild
Asks the user which block to build on a cell- Specified by:
chooseBlockToBuildin classPrinter- Parameters:
buildableBlocks- the possible blocks (always more than one)
-