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 void
askIp()
Asks the user both the server address and the username
At this point, the username is surely not set yetvoid
askLobbyName()
Shows a TextInputDialog asking for both the lobby name and sizevoid
askLobbySize()
Does nothing, the lobby size is asked in askLobbyName() for this printervoid
askToReloadSettings()
Asks the user if it wants to reload an already used address/username combovoid
askUsername()
Asks the user its username only
This will generate an InputDialog only if the current state is "LOBBY", a.k.a.void
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)
Shows the user a MultipleChoiceListDialog, containing the gods and their descriptionsvoid
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 detailsvoid
chooseStartingPlayer(java.util.List<java.lang.String> players)
Asks the user which player will play firstvoid
chooseToReloadMatch()
Shows the user a dialog with two buttons (Yes/No), asking the user if it wants to reload a previously saved game statusvoid
chooseUserGod(java.util.List<GodData> possibleGods)
Shows the user a DetailedSingleChoiceListDialog, containing the available gods and descriptionsvoid
chooseWorker(java.util.List<Cell> cells)
Asks the user to choose a workervoid
lobbyOptions(java.util.List<java.lang.String> options)
Shows a dialog with one or two buttons, based on the possible lobby options (Create/Join)void
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
printError(java.lang.String errorMsg)
Shows a popup error messagevoid
printMessage(java.lang.String msg)
Shows a popup general messagevoid
printStartingScreen()
Shows the "Santorini" logoprotected BoardUtils
setBoardUtils()
Creates a FancyPrinterBoardUtilsvoid
showSavedSettings(java.util.List<java.lang.String> options)
Shows a dialog with Yes/No buttons to decide to reload a previously saved address/username combovoid
updateGameData(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:
printError
in classPrinter
- Parameters:
errorMsg
- the error message
-
printMessage
public void printMessage(java.lang.String msg)Shows a popup general message- Specified by:
printMessage
in classPrinter
- Parameters:
msg
- the message
-
printStartingScreen
public void printStartingScreen()Shows the "Santorini" logo- Specified by:
printStartingScreen
in classPrinter
-
askToReloadSettings
public void askToReloadSettings()Asks the user if it wants to reload an already used address/username combo- Specified by:
askToReloadSettings
in 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:
showSavedSettings
in 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:
askUsername
in 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:
lobbyOptions
in 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:
askLobbyName
in classPrinter
-
askLobbySize
public void askLobbySize()Does nothing, the lobby size is asked in askLobbyName() for this printer- Specified by:
askLobbySize
in 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:
chooseLobbyToJoin
in 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:
chooseToReloadMatch
in classPrinter
-
chooseGameGods
Shows the user a MultipleChoiceListDialog, containing the gods and their descriptions- Specified by:
chooseGameGods
in 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:
chooseUserGod
in 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:
chooseStartingPlayer
in classPrinter
- Parameters:
players
- the players in game
-
setBoardUtils
Creates a FancyPrinterBoardUtils- Specified by:
setBoardUtils
in classPrinter
- Returns:
- a boardUtils object
-
updateGameData
Updates information about the game and the players- Specified by:
updateGameData
in classPrinter
- Parameters:
board
- the game boardplayers
- information about the players
-
chooseAction
Asks the user which action to perform- Specified by:
chooseAction
in classPrinter
- Parameters:
possibleActions
- a list of possible actions
-
placeWorker
public void placeWorker()Asks the user to place its worker on the board- Specified by:
placeWorker
in classPrinter
-
chooseWorker
Asks the user to choose a worker- Specified by:
chooseWorker
in 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:
moveAction
in 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:
buildAction
in 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:
chooseBlockToBuild
in classPrinter
- Parameters:
buildableBlocks
- the possible blocks (always more than one)
-