Modifier and Type | Class and Description |
---|---|
static class |
GUI.Direction |
Modifier and Type | Field and Description |
---|---|
protected de.smarten.tsuro.shared.gui.TileGridPane |
board |
protected javafx.scene.layout.AnchorPane |
boardAnchor |
protected int |
boardLength |
protected int |
boardSize |
protected javafx.scene.layout.AnchorPane |
contentPane |
protected de.smarten.tsuro.shared.gamemodel.Player |
currentlyViewedPlayer |
protected javafx.scene.shape.Rectangle |
currentlyViewedPlayerColorIndicator |
protected javafx.scene.shape.Rectangle |
currentPlayerColorIndicator |
protected javafx.scene.text.Text |
currentPlayerName |
protected javafx.scene.layout.AnchorPane |
deckAnchor |
protected javafx.scene.shape.Rectangle |
deckButtonLeftColorIndicator |
protected javafx.scene.shape.Rectangle |
deckButtonRightColorIndicator |
protected int |
deckCols |
protected javafx.scene.text.Text |
deckPlayerName |
protected int |
deckRows |
protected HashMap<de.smarten.tsuro.shared.gamemodel.Player,de.smarten.tsuro.shared.gui.TileGridPane> |
decks |
protected int |
deckSize |
protected de.smarten.tsuro.shared.gui.SingleChoiceButtonList |
gameListButtons |
protected javafx.scene.layout.GridPane |
gameListGridPane |
protected javafx.scene.text.Text |
gameListMessage |
protected javafx.scene.control.TextField |
gameListNameField |
protected javafx.scene.control.ScrollPane |
gameListScrollPane |
protected de.smarten.tsuro.shared.gamemodel.GameModel |
gameModel |
protected GuiEventHandler |
guiEventHandler |
protected de.smarten.tsuro.shared.gui.GuiHelper |
guiHelper |
protected Map<de.smarten.tsuro.shared.gamemodel.Position,Set<de.smarten.tsuro.shared.gamemodel.Gate>> |
illegalGates |
protected javafx.scene.control.TextField |
ipInput |
protected boolean |
isPlayer |
protected javafx.scene.control.Button |
joinGameButtonSpectator |
protected javafx.scene.text.Text |
messageText |
protected ObserverGUIControl |
observerGUIControl |
protected String |
PLAYER_IN_GAME_TEXT |
protected String |
PLAYER_LOST_TEXT |
protected javafx.scene.layout.GridPane |
playerList |
protected ArrayList<de.smarten.tsuro.shared.gamemodel.Player> |
players |
protected HashMap<de.smarten.tsuro.shared.gamemodel.Player,javafx.scene.text.Text> |
playerStatus |
protected javafx.scene.control.Button |
quitButton |
protected javafx.scene.control.Button |
registerButton |
protected javafx.scene.text.Text |
registerMessage |
protected double |
RELATIVE_GAP_SIZE_BETWEEN_TILES_BOARD |
protected double |
RELATIVE_GAP_SIZE_BETWEEN_TILES_DECK |
protected double |
RELATIVE_LENGTH_OF_GATE_TO_TILE |
protected double |
RELATIVE_STROKE_SIZE_OF_TILES |
protected double |
RELATIVE_STROKE_THICKNESS_OF_GATE_TO_GATE |
protected double |
RELATIVE_STROKE_THICKNESS_OF_TOKEN_TO_TOKEN |
protected double |
RELATIVE_THICKNESS_OF_GATE_TO_TILE |
protected javafx.scene.Scene |
scene |
protected javafx.stage.Stage |
stage |
protected de.smarten.tsuro.shared.utility.Stopwatch |
stopwatchAI |
protected de.smarten.tsuro.shared.utility.Stopwatch |
stopwatchPlayer |
protected javafx.scene.text.Text |
timer |
protected double |
TOKEN_REACH_TO_NEW_TILE |
protected double |
TOKEN_RELATIVE_SCALE_TO_TILE |
protected double |
tokenBorderSize |
protected HashMap<de.smarten.tsuro.shared.gamemodel.Player,javafx.scene.shape.Circle> |
tokens |
protected double |
tokenScale |
protected javafx.scene.layout.AnchorPane |
window |
Constructor and Description |
---|
GUI()
constructor without the gameModel
|
GUI(de.smarten.tsuro.shared.gamemodel.GameModel gameModel)
constructor with the gameModel
|
Modifier and Type | Method and Description |
---|---|
javafx.scene.control.Button |
addGameListItem(int row,
String name,
int id)
adds a new toggleable button to the gameList
|
javafx.scene.shape.Rectangle |
addGateRect(de.smarten.tsuro.shared.gui.TileGridPane tileGridPane,
de.smarten.tsuro.shared.gamemodel.Position position,
de.smarten.tsuro.shared.gamemodel.Gate gate,
String styleClass)
adds a rectangle to serve as a gate entry point
|
protected void |
calculateTokenSize() |
void |
displayLosses(List<de.smarten.tsuro.shared.gamemodel.Player> losers)
displays who lost
|
void |
fillGameList(List<de.smarten.tsuro.shared.gamemodel.Game> gameList) |
protected void |
findSceneObjectsGameList() |
protected void |
findSceneObjectsObserver() |
protected void |
findSceneObjectsRegister() |
void |
gameJoined() |
void |
gameWon(Iterator<de.smarten.tsuro.shared.gamemodel.Player> winners)
Is called when one or multiple player/s won the game.
|
javafx.scene.layout.GridPane |
getGameListGridPane() |
javafx.scene.text.Text |
getMessageText()
function necessary and used for testing
|
ObserverGUIControl |
getObserverGUIControl() |
protected int |
getPlayerIndexWithOffset(int index,
int offset) |
javafx.scene.Scene |
getScene()
Returns the scene that was created in the constructor or null if
the scene could not be created
|
protected void |
initBoard() |
protected void |
initDecks(int mimimumPadding)
builds the decks
|
void |
initGame(de.smarten.tsuro.shared.gamemodel.GameModel gameModel)
starts up the game scene
|
void |
initGameListWindow()
This method is called whenever the client would like to join a game
|
protected void |
initPlayerList()
initializes the playerList GridPane
|
protected void |
initPlayers() |
protected void |
initStopwatches() |
protected void |
initTokens(boolean placeOnPlayerList)
initializes the tokens
|
static void |
main(String[] args)
main method to start the client as a standalone application
|
protected void |
makeDeckVisible(de.smarten.tsuro.shared.gamemodel.Player visiblePlayer)
displays a given player's deck and renders the others invisible
|
protected de.smarten.tsuro.shared.gui.TileImageView |
moveTileFromDeckToBoard(de.smarten.tsuro.shared.gamemodel.Tile tile,
de.smarten.tsuro.shared.gamemodel.Position position,
de.smarten.tsuro.shared.gamemodel.Rotation rotation)
moves a given Tile lying on the deck to a given Position on the board
|
void |
notifyTurn()
starts the stopwatches when a new turn starts
|
void |
pause()
is called then the game is paused.
|
void |
quit()
closes the stage
|
String |
register() |
void |
resume()
is called then the game is resumed.
|
void |
runOnGui(Runnable toBeRun)
runs the task on the GUI thread
|
void |
sendJoinDetails(boolean isPlayer) |
protected void |
setBlockedPosition(de.smarten.tsuro.shared.gamemodel.Position pos)
applies the style of a blocked tile to the board tile on the given position
|
void |
setGameListMessage(String message)
sets the text for the message in the gameList scene
|
protected void |
setPlayerStatus(de.smarten.tsuro.shared.gamemodel.Player player,
de.smarten.tsuro.shared.gamemodel.KickState state)
sets the output text for the player status depending on the KickState
|
protected void |
setTokenPos(de.smarten.tsuro.shared.gamemodel.Player player,
de.smarten.tsuro.shared.gamemodel.Position position,
de.smarten.tsuro.shared.gamemodel.Gate gate)
sets the position on the board of a given token
if the position is not null
|
void |
showError(String error)
sets the text for the error message
|
void |
showGameListMessage(String message) |
void |
showMessage(String message)
sets the text for the normal message
|
void |
showRegisterMessage(String message) |
void |
showRegisterWindow()
starts up the register window
|
void |
start(javafx.stage.Stage stage)
start method to be called by the application launcher on launching a
standalone application
|
void |
switchDeck(GUI.Direction dir)
switches the deck to the right or the left
|
protected void |
switchScene(String fxmlFileName)
Loads a new fxml file into the scene and sets the guiEventHandlerAttribute.
|
void |
update(Observable o,
Object changedObject)
Updates the stopwatch time.
|
protected void |
updateCurrentlyViewedDeck()
Renders the correct deck visible, while making the others invisible.
|
void |
updateCurrentPlayer(de.smarten.tsuro.shared.gamemodel.Player player)
displays the current(new) active player on the GUI
|
protected final double RELATIVE_GAP_SIZE_BETWEEN_TILES_BOARD
protected final double RELATIVE_GAP_SIZE_BETWEEN_TILES_DECK
protected final double RELATIVE_STROKE_SIZE_OF_TILES
protected final double TOKEN_REACH_TO_NEW_TILE
protected final double TOKEN_RELATIVE_SCALE_TO_TILE
protected final double RELATIVE_STROKE_THICKNESS_OF_TOKEN_TO_TOKEN
protected final double RELATIVE_STROKE_THICKNESS_OF_GATE_TO_GATE
protected final double RELATIVE_THICKNESS_OF_GATE_TO_TILE
protected final double RELATIVE_LENGTH_OF_GATE_TO_TILE
protected final String PLAYER_IN_GAME_TEXT
protected final String PLAYER_LOST_TEXT
protected javafx.scene.Scene scene
protected javafx.scene.layout.AnchorPane contentPane
protected javafx.stage.Stage stage
protected javafx.scene.control.Button registerButton
protected javafx.scene.control.Button quitButton
protected javafx.scene.text.Text registerMessage
protected javafx.scene.control.TextField ipInput
protected javafx.scene.text.Text gameListMessage
protected javafx.scene.control.TextField gameListNameField
protected javafx.scene.control.ScrollPane gameListScrollPane
protected javafx.scene.layout.GridPane gameListGridPane
protected javafx.scene.control.Button joinGameButtonSpectator
protected de.smarten.tsuro.shared.gui.TileGridPane board
protected javafx.scene.layout.GridPane playerList
protected javafx.scene.layout.AnchorPane window
protected javafx.scene.layout.AnchorPane deckAnchor
protected javafx.scene.layout.AnchorPane boardAnchor
protected javafx.scene.text.Text currentPlayerName
protected javafx.scene.text.Text deckPlayerName
protected javafx.scene.text.Text messageText
protected javafx.scene.text.Text timer
protected javafx.scene.shape.Rectangle currentPlayerColorIndicator
protected javafx.scene.shape.Rectangle currentlyViewedPlayerColorIndicator
protected javafx.scene.shape.Rectangle deckButtonLeftColorIndicator
protected javafx.scene.shape.Rectangle deckButtonRightColorIndicator
protected Map<de.smarten.tsuro.shared.gamemodel.Position,Set<de.smarten.tsuro.shared.gamemodel.Gate>> illegalGates
protected HashMap<de.smarten.tsuro.shared.gamemodel.Player,javafx.scene.shape.Circle> tokens
protected HashMap<de.smarten.tsuro.shared.gamemodel.Player,de.smarten.tsuro.shared.gui.TileGridPane> decks
protected HashMap<de.smarten.tsuro.shared.gamemodel.Player,javafx.scene.text.Text> playerStatus
protected double tokenScale
protected double tokenBorderSize
protected de.smarten.tsuro.shared.gamemodel.Player currentlyViewedPlayer
protected ArrayList<de.smarten.tsuro.shared.gamemodel.Player> players
protected ObserverGUIControl observerGUIControl
protected GuiEventHandler guiEventHandler
protected int boardLength
protected int deckRows
protected int deckCols
protected int deckSize
protected int boardSize
protected de.smarten.tsuro.shared.gui.GuiHelper guiHelper
protected de.smarten.tsuro.shared.utility.Stopwatch stopwatchAI
protected de.smarten.tsuro.shared.utility.Stopwatch stopwatchPlayer
protected de.smarten.tsuro.shared.gui.SingleChoiceButtonList gameListButtons
protected de.smarten.tsuro.shared.gamemodel.GameModel gameModel
protected boolean isPlayer
public GUI()
public GUI(de.smarten.tsuro.shared.gamemodel.GameModel gameModel)
public static void main(String[] args)
args
- needed to start the main methodpublic void start(javafx.stage.Stage stage) throws Exception
start
in class javafx.application.Application
Exception
public javafx.scene.Scene getScene()
protected void switchScene(String fxmlFileName) throws IOException
fxmlFileName
- the file name of the FXML file to load into the sceneIOException
- if the fxml file isn't validpublic void quit()
public void showRegisterWindow() throws IOException
showRegisterWindow
in interface IGUI
IOException
- if the fxml file isn't validpublic void runOnGui(Runnable toBeRun)
toBeRun
- protected void initPlayerList()
protected void initDecks(int mimimumPadding) throws Exception
mimimumPadding
- minimum distance from the AnchorPane parentException
protected void initTokens(boolean placeOnPlayerList)
placeOnPlayerList
- if true the tokens are placed on the playerList before they are put on the boardpublic void initGame(de.smarten.tsuro.shared.gamemodel.GameModel gameModel) throws Exception
gameModel
- the gameModel to use for informationException
protected void initPlayers()
protected void initStopwatches()
public void initGameListWindow() throws IOException
IGUI
initGameListWindow
in interface IGUI
IOException
- if the fxml file isn't validprotected void findSceneObjectsRegister()
protected void findSceneObjectsGameList()
protected void findSceneObjectsObserver()
protected void calculateTokenSize()
protected int getPlayerIndexWithOffset(int index, int offset)
public void fillGameList(List<de.smarten.tsuro.shared.gamemodel.Game> gameList)
fillGameList
in interface IGUI
public javafx.scene.control.Button addGameListItem(int row, String name, int id)
row
- the row where the button will be placedname
- the name of the gameid
- the ID of the gamepublic javafx.scene.layout.GridPane getGameListGridPane()
public void sendJoinDetails(boolean isPlayer)
public String register()
public void showRegisterMessage(String message)
public void showGameListMessage(String message)
public void displayLosses(List<de.smarten.tsuro.shared.gamemodel.Player> losers)
displayLosses
in interface IGUI
losers
- the list of losing Playerspublic void setGameListMessage(String message)
message
- the message to printpublic javafx.scene.text.Text getMessageText()
public void showMessage(String message)
showMessage
in interface IGUI
message
- String to be displayedpublic void showError(String error)
protected void makeDeckVisible(de.smarten.tsuro.shared.gamemodel.Player visiblePlayer)
visiblePlayer
- the Player whose hand will be displayedpublic void switchDeck(GUI.Direction dir)
dir
- the direction which deck will be displayedprotected void updateCurrentlyViewedDeck()
protected de.smarten.tsuro.shared.gui.TileImageView moveTileFromDeckToBoard(de.smarten.tsuro.shared.gamemodel.Tile tile, de.smarten.tsuro.shared.gamemodel.Position position, de.smarten.tsuro.shared.gamemodel.Rotation rotation)
tile
- the Tile to be movedposition
- the Position where the Tile will be placed on the boardrotation
- the Rotation how the Tile will be placed on the positionprotected void setTokenPos(de.smarten.tsuro.shared.gamemodel.Player player, de.smarten.tsuro.shared.gamemodel.Position position, de.smarten.tsuro.shared.gamemodel.Gate gate) throws Exception
playerId
- the ID of the player who owns the tokenposition
- the position where the token will be placedgate
- the gate where the token will be placedException
- when position is not on the boardprotected void setBlockedPosition(de.smarten.tsuro.shared.gamemodel.Position pos)
pos
- the position where the tile is located on the boardpublic javafx.scene.shape.Rectangle addGateRect(de.smarten.tsuro.shared.gui.TileGridPane tileGridPane, de.smarten.tsuro.shared.gamemodel.Position position, de.smarten.tsuro.shared.gamemodel.Gate gate, String styleClass)
tileGridPane
- the TileGridPane where the rectangle will be placedposition
- the position where the rectangle will be placedgate
- the gate where the rectangle will be placedstyleClass
- the styleClass that will be applied to the rectangleprotected void setPlayerStatus(de.smarten.tsuro.shared.gamemodel.Player player, de.smarten.tsuro.shared.gamemodel.KickState state)
player
- the Player to set the state forstate
- the player's KickStatepublic void updateCurrentPlayer(de.smarten.tsuro.shared.gamemodel.Player player)
IGUI
updateCurrentPlayer
in interface IGUI
player
- the current playerpublic void update(Observable o, Object changedObject)
public void notifyTurn()
public void gameWon(Iterator<de.smarten.tsuro.shared.gamemodel.Player> winners)
winners
- the winning players iteratorpublic void pause()
public void resume()
public void gameJoined()
public ObserverGUIControl getObserverGUIControl()
Copyright © 2017 smarTen. All rights reserved.