Module AM37
Class FancyPrinterBoardUtils
java.lang.Object
it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
it.polimi.ingsw.view.cli.console.graphics.components.Window
it.polimi.ingsw.view.cli.console.printers.BoardUtils
it.polimi.ingsw.view.cli.console.printers.fancyPrinter.FancyPrinterBoardUtils
- All Implemented Interfaces:
KeyEventListener
public class FancyPrinterBoardUtils extends BoardUtils implements KeyEventListener
Collection of WindowItems and utility methods to decorate the game board, giving information about the game status
-
Field Summary
Fields inherited from class it.polimi.ingsw.view.cli.console.printers.BoardUtils
boardHeight, boardWidth, buildingBlocks, cachedBoard, cellFrames, cellHeight, cellWidth, emptyBoard, horizontalWallWidth, lastGameBoardPrinted, playerData, verticalWallWidth, workersFields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Window
background, cli, enableInputOnReturn, returnToFields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
activeItems, id, parent, passiveItems -
Constructor Summary
Constructors Constructor Description FancyPrinterBoardUtils(FancyPrinter printer) -
Method Summary
Modifier and Type Method Description voiddeselectCell(Cell cell)Deselects a cell, hiding the highlighted bordervoidenableActionSelector(java.util.List<PossibleActions> actions)Shows a dialog asking the user to select an action to performvoidenableBlockSelector(java.util.List<Block> buildableBlocks)voidenableGridInput()voidenableGridInput(java.util.List<Cell> highlighted)Enables the user to select a cell, using a GridOverlayvoidhighlightWorkers(java.util.List<Cell> cells)Highlights the user's workersvoidonArrowDown()Defines the listener behavior when theArrow Downkey is pressedvoidonArrowLeft()Defines the listener behavior when theArrow Leftkey is pressedvoidonArrowRight()Defines the listener behavior when theArrow Rightkey is pressedvoidonArrowUp()Defines the listener behavior when theArrow Upkey is pressedvoidonCarriageReturn()Defines the listener behavior when theEnterkey is pressedvoidonTab()Defines the listener behavior when theTabkey is pressedvoidremove()Removes itself, restoring the underlying dialogsvoidselectCell(Cell cell, PrintableObject cellBorder)Highlights a single cellvoidsetPlayerData(java.util.List<PlayerData> playerData)voidshow()Shows the window on the consolevoidshowErrorMessage(java.lang.String error)voidshowGameBoard()voidshowGameBoard(java.util.List<Cell> toHighlight)Shows the current gameBoard on the screen, highlighting some cellsvoidshowMessage(java.lang.String message)Methods inherited from class it.polimi.ingsw.view.cli.console.printers.BoardUtils
cloneMatrix, highlight, overrideCachedBoard, setCachedBoard, subMatrix, updateCachedBoard, updateGameDataMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Window
addToBackground, getCli, getReturnToMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, drawShadows, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItemMethods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBackground, drawBorders, findCenter, getBackgroundColor, getColor, getHeight, getInitCoord, getTextColor, getWidth, hideBorders, loadPropertiesFileMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface it.polimi.ingsw.view.cli.console.KeyEventListener
onBackspace, onPrintableKey
-
Constructor Details
-
FancyPrinterBoardUtils
- Throws:
java.io.IOException
-
-
Method Details
-
remove
public void remove()Removes itself, restoring the underlying dialogs- Overrides:
removein classWindowItem
-
show
public void show()Shows the window on the console -
enableGridInput
public void enableGridInput() -
enableGridInput
Enables the user to select a cell, using a GridOverlay -
setPlayerData
-
enableActionSelector
Shows a dialog asking the user to select an action to perform- Parameters:
actions- a list of possible actions
-
enableBlockSelector
-
showErrorMessage
public void showErrorMessage(java.lang.String error) -
showMessage
public void showMessage(java.lang.String message) -
showGameBoard
public void showGameBoard()- Specified by:
showGameBoardin classBoardUtils
-
showGameBoard
Description copied from class:BoardUtilsShows the current gameBoard on the screen, highlighting some cells- Specified by:
showGameBoardin classBoardUtils- Parameters:
toHighlight- the cells to highlight
-
highlightWorkers
Highlights the user's workers- Specified by:
highlightWorkersin classBoardUtils- Parameters:
cells- the cells containing the user's workers
-
selectCell
Highlights a single cell- Parameters:
cell- the cell to highlightcellBorder- the PrintableObject containing the cell border
-
deselectCell
Deselects a cell, hiding the highlighted border- Parameters:
cell- the cell to disable
-
onCarriageReturn
public void onCarriageReturn()Defines the listener behavior when theEnterkey is pressed- Specified by:
onCarriageReturnin interfaceKeyEventListener
-
onTab
public void onTab()Defines the listener behavior when theTabkey is pressed- Specified by:
onTabin interfaceKeyEventListener
-
onArrowUp
public void onArrowUp()Defines the listener behavior when theArrow Upkey is pressed- Specified by:
onArrowUpin interfaceKeyEventListener
-
onArrowDown
public void onArrowDown()Defines the listener behavior when theArrow Downkey is pressed- Specified by:
onArrowDownin interfaceKeyEventListener
-
onArrowRight
public void onArrowRight()Defines the listener behavior when theArrow Rightkey is pressed- Specified by:
onArrowRightin interfaceKeyEventListener
-
onArrowLeft
public void onArrowLeft()Defines the listener behavior when theArrow Leftkey is pressed- Specified by:
onArrowLeftin interfaceKeyEventListener
-