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, workers
Fields inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Window
background, cli, enableInputOnReturn, returnTo
Fields 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 void
deselectCell(Cell cell)
Deselects a cell, hiding the highlighted bordervoid
enableActionSelector(java.util.List<PossibleActions> actions)
Shows a dialog asking the user to select an action to performvoid
enableBlockSelector(java.util.List<Block> buildableBlocks)
void
enableGridInput()
void
enableGridInput(java.util.List<Cell> highlighted)
Enables the user to select a cell, using a GridOverlayvoid
highlightWorkers(java.util.List<Cell> cells)
Highlights the user's workersvoid
onArrowDown()
Defines the listener behavior when theArrow Down
key is pressedvoid
onArrowLeft()
Defines the listener behavior when theArrow Left
key is pressedvoid
onArrowRight()
Defines the listener behavior when theArrow Right
key is pressedvoid
onArrowUp()
Defines the listener behavior when theArrow Up
key is pressedvoid
onCarriageReturn()
Defines the listener behavior when theEnter
key is pressedvoid
onTab()
Defines the listener behavior when theTab
key is pressedvoid
remove()
Removes itself, restoring the underlying dialogsvoid
selectCell(Cell cell, PrintableObject cellBorder)
Highlights a single cellvoid
setPlayerData(java.util.List<PlayerData> playerData)
void
show()
Shows the window on the consolevoid
showErrorMessage(java.lang.String error)
void
showGameBoard()
void
showGameBoard(java.util.List<Cell> toHighlight)
Shows the current gameBoard on the screen, highlighting some cellsvoid
showMessage(java.lang.String message)
Methods inherited from class it.polimi.ingsw.view.cli.console.printers.BoardUtils
cloneMatrix, highlight, overrideCachedBoard, setCachedBoard, subMatrix, updateCachedBoard, updateGameData
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Window
addToBackground, getCli, getReturnTo
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.WindowItem
addActiveItem, addPassiveItem, currentActiveItem, drawShadows, getID, getParent, hideShadows, maxStringLength, nextActiveItem, previousActiveItem
Methods inherited from class it.polimi.ingsw.view.cli.console.graphics.components.Rectangle
drawBackground, drawBorders, findCenter, getBackgroundColor, getColor, getHeight, getInitCoord, getTextColor, getWidth, hideBorders, loadPropertiesFile
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
remove
in 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:
showGameBoard
in classBoardUtils
-
showGameBoard
Description copied from class:BoardUtils
Shows the current gameBoard on the screen, highlighting some cells- Specified by:
showGameBoard
in classBoardUtils
- Parameters:
toHighlight
- the cells to highlight
-
highlightWorkers
Highlights the user's workers- Specified by:
highlightWorkers
in 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 theEnter
key is pressed- Specified by:
onCarriageReturn
in interfaceKeyEventListener
-
onTab
public void onTab()Defines the listener behavior when theTab
key is pressed- Specified by:
onTab
in interfaceKeyEventListener
-
onArrowUp
public void onArrowUp()Defines the listener behavior when theArrow Up
key is pressed- Specified by:
onArrowUp
in interfaceKeyEventListener
-
onArrowDown
public void onArrowDown()Defines the listener behavior when theArrow Down
key is pressed- Specified by:
onArrowDown
in interfaceKeyEventListener
-
onArrowRight
public void onArrowRight()Defines the listener behavior when theArrow Right
key is pressed- Specified by:
onArrowRight
in interfaceKeyEventListener
-
onArrowLeft
public void onArrowLeft()Defines the listener behavior when theArrow Left
key is pressed- Specified by:
onArrowLeft
in interfaceKeyEventListener
-