java.lang.Object
it.polimi.ingsw.view.cli.console.printers.Printer
it.polimi.ingsw.view.cli.console.printers.basicPrinter.BasicPrinter
public class BasicPrinter extends Printer
- 
Field SummaryFields inherited from class it.polimi.ingsw.view.cli.console.printers.PrinterboardUtils, cli, console, mainLogo, properties, SCENE_HEIGHT, SCENE_WIDTH
- 
Constructor SummaryConstructors Constructor Description BasicPrinter(Console console, CLI cli)Default constructor
- 
Method SummaryModifier and Type Method Description voidaskIp()Asks the user to insert the server addressvoidaskLobbyName()Asks the user to choose a name for the lobby to be createdvoidaskLobbySize()Asks the user to choose the lobby sizevoidaskToReloadSettings()Asks the user if it wants to reload a previously saved address/username combovoidaskUsername()Asks the user to insert its usernamevoidbuildAction(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 user 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 to joinvoidchooseStartingPlayer(java.util.List<java.lang.String> players)Asks the user which player will play firstvoidchooseToReloadMatch()Asks the user if it wants to reload an existing saved matchvoidchooseUserGod(java.util.List<GodData> possibleGods)Asks the user to choose its personal god for the gamevoidchooseWorker(java.util.List<Cell> cells)Asks the user to choose a workervoidlobbyOptions(java.util.List<java.lang.String> options)Asks the user to choose whether 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 boardvoidprintError(java.lang.String errorMsg)Shows an error messagevoidprintMessage(java.lang.String msg)Shows a success messageprotected voidprintOptions(java.util.List<java.lang.String> list)Print a list of options, preceded by a number that the user will have to type to choose that optionvoidprintStartingScreen()Shows the logoprotected BoardUtilssetBoardUtils()Creates a BoardUtils object, based on the printer calling itvoidshowSavedSettings(java.util.List<java.lang.String> options)Shows the user the saved address/username combosvoidupdateGameData(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.PrintergetConsole, highlightWorkers, showGameBoard, showGameBoard
- 
Constructor Details- 
BasicPrinterDefault constructor- Parameters:
- cli- the view which created the printer
- Throws:
- java.io.IOException
 
 
- 
- 
Method Details- 
printErrorpublic void printError(java.lang.String errorMsg)Shows an error message- Specified by:
- printErrorin class- Printer
- Parameters:
- errorMsg- the error message
 
- 
printMessagepublic void printMessage(java.lang.String msg)Shows a success message- Specified by:
- printMessagein class- Printer
- Parameters:
- msg- the message
 
- 
printStartingScreenpublic void printStartingScreen()Shows the logo- Specified by:
- printStartingScreenin class- Printer
 
- 
askToReloadSettingspublic void askToReloadSettings()Asks the user if it wants to reload a previously saved address/username combo- Specified by:
- askToReloadSettingsin class- Printer
 
- 
showSavedSettingspublic void showSavedSettings(java.util.List<java.lang.String> options)Shows the user the saved address/username combos- Specified by:
- showSavedSettingsin class- Printer
- Parameters:
- options- the address/username combos
 
- 
askIppublic void askIp()Asks the user to insert the server address
- 
askUsernamepublic void askUsername()Asks the user to insert its username- Specified by:
- askUsernamein class- Printer
 
- 
lobbyOptionspublic void lobbyOptions(java.util.List<java.lang.String> options)Asks the user to choose whether to join or create a lobby- Specified by:
- lobbyOptionsin class- Printer
- Parameters:
- options- a list of possible options
 
- 
askLobbyNamepublic void askLobbyName()Asks the user to choose a name for the lobby to be created- Specified by:
- askLobbyNamein class- Printer
 
- 
askLobbySizepublic void askLobbySize()Asks the user to choose the lobby size- Specified by:
- askLobbySizein class- Printer
 
- 
chooseLobbyToJoinpublic void chooseLobbyToJoin(java.util.Map<java.lang.String,java.util.List<java.lang.String>> lobbiesAvailable)Asks the user which lobby to join- Specified by:
- chooseLobbyToJoinin class- Printer
- Parameters:
- lobbiesAvailable- a map containing the lobbies available and their relative information
 
- 
chooseToReloadMatchpublic void chooseToReloadMatch()Asks the user if it wants to reload an existing saved match- Specified by:
- chooseToReloadMatchin class- Printer
 
- 
chooseGameGodsAsks the user to choose the gods for the game- Specified by:
- chooseGameGodsin class- Printer
- Parameters:
- allGods- the list of available gods
- size- the number of players
 
- 
chooseUserGodAsks the user to choose its personal god for the game- Specified by:
- chooseUserGodin class- Printer
- Parameters:
- possibleGods- a list containing the available gods
 
- 
chooseStartingPlayerpublic void chooseStartingPlayer(java.util.List<java.lang.String> players)Asks the user which player will play first- Specified by:
- chooseStartingPlayerin class- Printer
- Parameters:
- players- the players in game
 
- 
setBoardUtilsCreates a BoardUtils object, based on the printer calling it- Specified by:
- setBoardUtilsin class- Printer
- Returns:
- a boardUtils object
 
- 
updateGameDataUpdates information about the game and the players- Specified by:
- updateGameDatain class- Printer
- Parameters:
- board- the game board
- players- information about the players
 
- 
chooseActionAsks the user which action to perform- Specified by:
- chooseActionin class- Printer
- Parameters:
- possibleActions- a list of possible actions
 
- 
placeWorkerpublic void placeWorker()Asks the user to place its worker on the board- Specified by:
- placeWorkerin class- Printer
 
- 
chooseWorkerAsks the user to choose a worker- Specified by:
- chooseWorkerin class- Printer
- Parameters:
- cells- the cells containing the user's workers
 
- 
moveActionAsks the user to select a cell to move its current worker on- Specified by:
- moveActionin class- Printer
- Parameters:
- gameBoard- the current game board
- walkableCells- the cells on which the worker can be moved to
 
- 
buildActionAsks the user to select a cell to build on- Specified by:
- buildActionin class- Printer
- Parameters:
- gameBoard- the current game board
- buildableCells- the cells on which the worker can build
 
- 
chooseBlockToBuildAsks the user which block to build on a cell- Specified by:
- chooseBlockToBuildin class- Printer
- Parameters:
- buildableBlocks- the possible blocks (always more than one)
 
- 
printOptionsprotected void printOptions(java.util.List<java.lang.String> list)Print a list of options, preceded by a number that the user will have to type to choose that option- Parameters:
- list- the options
 
 
-