java.lang.Object
javafx.application.Application
polimi.ingsw.am21.codex.view.GUI.Gui
- All Implemented Interfaces:
Remote,GameEventListener,RemoteGameEventListener,View
-
Nested Class Summary
Nested classes/interfaces inherited from class javafx.application.Application
javafx.application.Application.Parameters -
Field Summary
Fields inherited from class javafx.application.Application
STYLESHEET_CASPIAN, STYLESHEET_MODENA -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcardPlaced(String gameId, String playerId, Integer playerHandCardNumber, Integer cardId, CardSideType side, Position position, int newPlayerScore, Map<ResourceType, Integer> updatedResources, Map<ObjectType, Integer> updatedObjects, Set<Position> availableSpots, Set<Position> forbiddenSpots) Interface method used to process the event of the current player placing a card on their playerboard.voidchangeTurn(String gameId, String playerNickname, Integer playerIndex, Boolean isLastRound, Set<Position> availableSpots, Set<Position> forbiddenSpots, Integer resourceDeckTopCardId, Integer goldDeckTopCardId) Interface method used to process the event of the player ending their turn choosing not to draw a card.voidchatMessage(String gameID, ChatMessage message) Interface method used to process the event of a player sending a chat message in the game they're in.voiddisplayException(Exception exception) Displays an exception to the uservoidDraw the available games in the lobby menuvoidDraw a list of available token colors for the player to choose fromvoidvoidDraw the card decks in the gameboardvoiddrawChat()Load the chat scene for chat messages to be drawn in.voiddrawChatMessage(ChatMessage message) Draw a chat message in the chat windowvoidDraw the common objective cards in the gameboardvoiddrawGame()Draw the playerboard and gameboard scenes after every player has finished in the lobbyvoidDraw the gameboard contents.voidDisplay the game is over and the final leaderboardvoiddrawHand()Draws the hand of the playervoidDraw the leaderboard of the game, display the players and their pointsvoidDraw the current status of the lobby and its connected players alongside the lobby windowvoidDraw the scene for the player to choose a nicknamevoidDraw the two objective cards the player can choose from in the lobbyvoidDraws the pairs of resource and gold cards which the player can draw fromvoiddrawPlayerBoard(String nickname) Draw the placed cards of the given playervoiddrawPlayerBoard(String nickname, int verticalOffset, int horizontalOffset) voidvoidDraw the player objective card in its player board alongside its handvoiddrawResourcesAndObjects(LocalPlayer player) Draw a map of the given player available resources and objects to the playerBoardvoidDraw the sides of the starter card the player can choose from in the lobbyvoidgameCreated(String gameId, int currentPlayers, int maxPlayers) Interface method used to process the game creation event.voidgameDeleted(String gameId) Interface method used to process the game deletion event.voidgameHalted(String gameID) voidgameOver()Interface method used to process the event of the game ending.voidgameResumed(String gameID) voidgameStarted(String gameId, GameInfo gameInfo) Interface method used to process the event of a game starting.static GuivoidvoidlobbyInfo(LobbyUsersInfo usersInfo) Interface method used to process the event of a player joining a game lobby when there are other players already inside it that may or may not have already completed the process of joining the game.static voidvoidplayerChoseObjectiveCard(String gameId, UUID connectionID, String nickname) Interface method used to process the event of a player choosing their objective card.voidplayerConnectionChanged(UUID connectionID, String nickname, GameController.UserGameContext.ConnectionStatus status) Interface method used to process the event of a player's connection status changing.voidplayerJoinedLobby(String gameId, UUID connectionID) Interface method used to process the event of a player joining a game lobby.voidplayerLeftLobby(String gameId, UUID connectionID) Interface method used to process the event of a player leaving a game lobby.voidplayerScoresUpdate(Map<String, Integer> newScores) Interface method used to process the event of the player's score being updated after the game ends and secret and common objectives are evaluated.voidplayerSetNickname(String gameId, UUID connectionID, String nickname) Interface method used to process the event of a player choosing their nickname.voidplayerSetToken(String gameId, UUID connectionID, String nickname, TokenColor token) Interface method used to process the event of a player choosing their token color.voidpostNotification(Notification notification) Posts a push notification to the uservoidpostNotification(NotificationType notificationType, String message) Posts a push notification to the uservoidpostNotification(NotificationType notificationType, String[] messages, Colorable colorable, int colorableIndex) voidremainingRounds(String gameID, int remainingRounds) Interface method used to process the event of the number of remaining rounds being updated or set when winning score is reached by any of the players.voidsetClient(ClientConnectionHandler client) voidstart(javafx.stage.Stage primaryStage) voiduserContext(FullUserGameContext context) voidwinningPlayer(String nickname) Interface method used to process and display the winning player of the game.Methods inherited from class javafx.application.Application
getHostServices, getParameters, getUserAgentStylesheet, init, launch, launch, notifyPreloader, setUserAgentStylesheet, stopMethods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface polimi.ingsw.am21.codex.view.View
changeTurn, drawPlayerBoard, drawPlayerBoard, getObjectiveCards, getStarterCard, playerJoinedGame, refreshLobbies
-
Constructor Details
-
Gui
public Gui()
-
-
Method Details
-
getInstance
-
setClient
-
start
public void start(javafx.stage.Stage primaryStage) - Specified by:
startin classjavafx.application.Application
-
getIsInitializedLatch
-
main
-
postNotification
Posts a push notification to the user- Specified by:
postNotificationin interfaceView- Parameters:
notificationType- the type of notification to display (CONFIRM, WARNING, ERROR, UPDATE, RESPONSE)message- the message to display
-
postNotification
Posts a push notification to the user- Specified by:
postNotificationin interfaceView- Parameters:
notification- the notification to display
-
postNotification
public void postNotification(NotificationType notificationType, String[] messages, Colorable colorable, int colorableIndex) - Specified by:
postNotificationin interfaceView
-
displayException
Displays an exception to the user- Specified by:
displayExceptionin interfaceView- Parameters:
exception- the exception to display
-
drawAvailableGames
public void drawAvailableGames()Draw the available games in the lobby menu- Specified by:
drawAvailableGamesin interfaceView
-
drawAvailableTokenColors
public void drawAvailableTokenColors()Draw a list of available token colors for the player to choose from- Specified by:
drawAvailableTokenColorsin interfaceView
-
drawLobby
public void drawLobby()Draw the current status of the lobby and its connected players alongside the lobby window -
drawLeaderBoard
public void drawLeaderBoard()Draw the leaderboard of the game, display the players and their points- Specified by:
drawLeaderBoardin interfaceView
-
drawResourcesAndObjects
Draw a map of the given player available resources and objects to the playerBoard- Parameters:
player- the player whose resources are to be drawn
-
drawNicknameChoice
public void drawNicknameChoice()Draw the scene for the player to choose a nickname- Specified by:
drawNicknameChoicein interfaceView
-
getLocalModel
- Specified by:
getLocalModelin interfaceView
-
drawPlayerBoards
public void drawPlayerBoards()- Specified by:
drawPlayerBoardsin interfaceView
-
drawPlayerBoard
- Specified by:
drawPlayerBoardin interfaceView
-
drawPlayerBoard
Draw the placed cards of the given player- Specified by:
drawPlayerBoardin interfaceView- Parameters:
nickname- The nickname of the player whose playerboard is to be drawn
-
drawGame
public void drawGame()Draw the playerboard and gameboard scenes after every player has finished in the lobby -
drawGameBoard
public void drawGameBoard()Draw the gameboard contents.- Specified by:
drawGameBoardin interfaceView
-
drawGameOver
public void drawGameOver()Display the game is over and the final leaderboard- Specified by:
drawGameOverin interfaceView
-
drawCard
-
drawHand
public void drawHand()Draws the hand of the player -
drawPairs
public void drawPairs()Draws the pairs of resource and gold cards which the player can draw from -
drawObjectiveCardChoice
public void drawObjectiveCardChoice()Draw the two objective cards the player can choose from in the lobby- Specified by:
drawObjectiveCardChoicein interfaceView
-
drawStarterCardSides
public void drawStarterCardSides()Draw the sides of the starter card the player can choose from in the lobby- Specified by:
drawStarterCardSidesin interfaceView
-
drawChat
public void drawChat()Load the chat scene for chat messages to be drawn in. -
drawChatMessage
Draw a chat message in the chat window- Specified by:
drawChatMessagein interfaceView
-
drawCommonObjectiveCards
public void drawCommonObjectiveCards()Draw the common objective cards in the gameboard- Specified by:
drawCommonObjectiveCardsin interfaceView
-
drawPlayerObjective
public void drawPlayerObjective()Draw the player objective card in its player board alongside its hand- Specified by:
drawPlayerObjectivein interfaceView
-
drawCardDecks
public void drawCardDecks()Draw the card decks in the gameboard- Specified by:
drawCardDecksin interfaceView
-
listGames
public void listGames() -
gameCreated
Description copied from interface:RemoteGameEventListenerInterface method used to process the game creation event.- Specified by:
gameCreatedin interfaceGameEventListener- Specified by:
gameCreatedin interfaceRemoteGameEventListener- Specified by:
gameCreatedin interfaceView- Parameters:
gameId- The unique identifier of the game that has just been created.currentPlayers- The number of players currently in the game.maxPlayers- The maximum number of players that can join the game.
-
gameDeleted
Description copied from interface:RemoteGameEventListenerInterface method used to process the game deletion event.- Specified by:
gameDeletedin interfaceGameEventListener- Specified by:
gameDeletedin interfaceRemoteGameEventListener- Specified by:
gameDeletedin interfaceView- Parameters:
gameId- The identifier of the game that has just been deleted.
-
playerJoinedLobby
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of a player joining a game lobby.- Specified by:
playerJoinedLobbyin interfaceGameEventListener- Specified by:
playerJoinedLobbyin interfaceRemoteGameEventListener- Specified by:
playerJoinedLobbyin interfaceView- Parameters:
gameId- The identifier of the game lobby that the player has joined.connectionID- The unique identifier of the player that has joined the lobby.
-
playerLeftLobby
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of a player leaving a game lobby.- Specified by:
playerLeftLobbyin interfaceGameEventListener- Specified by:
playerLeftLobbyin interfaceRemoteGameEventListener- Specified by:
playerLeftLobbyin interfaceView- Parameters:
gameId- The identifier of the game lobby that the player has left.connectionID- The unique identifier of the player that has left the lobby.
-
playerSetToken
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of a player choosing their token color.- Specified by:
playerSetTokenin interfaceGameEventListener- Specified by:
playerSetTokenin interfaceRemoteGameEventListener- Specified by:
playerSetTokenin interfaceView- Parameters:
gameId- The identifier of the game lobby in which the player has set their token color.connectionID- The unique identifier of the player that has set their token color.nickname- The nickname of the player that has set their token color, if they have chosen it alreadytoken- The token color that the player has chosen
-
playerSetNickname
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of a player choosing their nickname.- Specified by:
playerSetNicknamein interfaceGameEventListener- Specified by:
playerSetNicknamein interfaceRemoteGameEventListener- Specified by:
playerSetNicknamein interfaceView- Parameters:
gameId- The identifier of the game lobby in which the player has set their nickname.connectionID- The unique identifier of the player that has set their nickname.nickname- The nickname of the player that has set their nickname
-
playerChoseObjectiveCard
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of a player choosing their objective card.- Specified by:
playerChoseObjectiveCardin interfaceGameEventListener- Specified by:
playerChoseObjectiveCardin interfaceRemoteGameEventListener- Specified by:
playerChoseObjectiveCardin interfaceView- Parameters:
gameId- The identifier of the game lobby in which the player has set their objective card.connectionID- The unique identifier of the player that has set their objective card.nickname- The nickname of the player that has set their objective card, if they have chosen it already
-
gameStarted
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of a game starting.- Specified by:
gameStartedin interfaceGameEventListener- Specified by:
gameStartedin interfaceRemoteGameEventListener- Specified by:
gameStartedin interfaceView- Parameters:
gameId- The identifier of the game that has just started.gameInfo- The information about the game that has just started.
-
gameOver
public void gameOver()Description copied from interface:RemoteGameEventListenerInterface method used to process the event of the game ending.- Specified by:
gameOverin interfaceGameEventListener- Specified by:
gameOverin interfaceRemoteGameEventListener- Specified by:
gameOverin interfaceView
-
playerScoresUpdate
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of the player's score being updated after the game ends and secret and common objectives are evaluated.- Specified by:
playerScoresUpdatein interfaceGameEventListener- Specified by:
playerScoresUpdatein interfaceRemoteGameEventListener- Specified by:
playerScoresUpdatein interfaceView- Parameters:
newScores- A map containing the updated scores of the players. The key is the nickname of the player and the value is the new score of the player.
-
remainingRounds
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of the number of remaining rounds being updated or set when winning score is reached by any of the players.- Specified by:
remainingRoundsin interfaceGameEventListener- Specified by:
remainingRoundsin interfaceRemoteGameEventListener- Specified by:
remainingRoundsin interfaceView- Parameters:
gameID- The identifier of the game in which the number of remaining rounds was updated.remainingRounds- The number of rounds remaining in the game.
-
winningPlayer
Description copied from interface:RemoteGameEventListenerInterface method used to process and display the winning player of the game.- Specified by:
winningPlayerin interfaceGameEventListener- Specified by:
winningPlayerin interfaceRemoteGameEventListener- Specified by:
winningPlayerin interfaceView- Parameters:
nickname- The nickname of the player that has won the game.
-
playerConnectionChanged
public void playerConnectionChanged(UUID connectionID, String nickname, GameController.UserGameContext.ConnectionStatus status) Description copied from interface:RemoteGameEventListenerInterface method used to process the event of a player's connection status changing.- Specified by:
playerConnectionChangedin interfaceGameEventListener- Specified by:
playerConnectionChangedin interfaceRemoteGameEventListener- Specified by:
playerConnectionChangedin interfaceView- Parameters:
connectionID- The unique identifier of the player whose connection status has changed. This is the identifier that the player uses to connect to the server.nickname- The nickname of the player whose connection status has changed.status- The new connection status of the player.
-
lobbyInfo
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of a player joining a game lobby when there are other players already inside it that may or may not have already completed the process of joining the game.- Specified by:
lobbyInfoin interfaceGameEventListener- Specified by:
lobbyInfoin interfaceRemoteGameEventListener- Specified by:
lobbyInfoin interfaceView- Parameters:
usersInfo- The information about the users in the lobby. It includes the nickname, token color, objective card choice, starter card side chosen, and in-game status of each user.
-
chatMessage
Description copied from interface:RemoteGameEventListenerInterface method used to process the event of a player sending a chat message in the game they're in.- Specified by:
chatMessagein interfaceGameEventListener- Specified by:
chatMessagein interfaceRemoteGameEventListener- Specified by:
chatMessagein interfaceView- Parameters:
gameID- The identifier of the game in which the chat message was sent.message- The chat message that was sent by the player.
-
gameHalted
- Specified by:
gameHaltedin interfaceGameEventListener- Specified by:
gameHaltedin interfaceRemoteGameEventListener
-
gameResumed
- Specified by:
gameResumedin interfaceGameEventListener- Specified by:
gameResumedin interfaceRemoteGameEventListener
-
userContext
- Specified by:
userContextin interfaceGameEventListener- Specified by:
userContextin interfaceRemoteGameEventListener
-
cardPlaced
public void cardPlaced(String gameId, String playerId, Integer playerHandCardNumber, Integer cardId, CardSideType side, Position position, int newPlayerScore, Map<ResourceType, Integer> updatedResources, Map<ObjectType, Integer> updatedObjects, Set<Position> availableSpots, Set<Position> forbiddenSpots) Description copied from interface:RemoteGameEventListenerInterface method used to process the event of the current player placing a card on their playerboard.- Specified by:
cardPlacedin interfaceGameEventListener- Specified by:
cardPlacedin interfaceRemoteGameEventListener- Specified by:
cardPlacedin interfaceView- Parameters:
gameId- The identifier of the game in which the card was placed.playerId- The identifier of the player that placed the card.playerHandCardNumber- The number of the card in the player's hand that was placed.cardId- The unique identifier of the card that was placed.side- The side of the card that was placed.position- The position on the player board where the card was placed.newPlayerScore- The updated score of the player that placed the card.updatedResources- The updated resources of the player that placed the card. The key is the type of resource and the value is the new amount of that resource.updatedObjects- The updated objects of the player that placed the card. The key is the type of object and the value is the new amount of that object.availableSpots- A set of positions that are available for the next player to place a card.forbiddenSpots- A set of positions that are forbidden for the next player to place a card. This set is used to display the forbidden spots on the gameboard.
-
changeTurn
public void changeTurn(String gameId, String playerNickname, Integer playerIndex, Boolean isLastRound, Set<Position> availableSpots, Set<Position> forbiddenSpots, Integer resourceDeckTopCardId, Integer goldDeckTopCardId) Description copied from interface:RemoteGameEventListenerInterface method used to process the event of the player ending their turn choosing not to draw a card. This possibility is given by the fact that the decks might be empty, A player can choose not to draw in their last turn if they prefer not to draw from the pairs available on the gameboard- Specified by:
changeTurnin interfaceGameEventListener- Specified by:
changeTurnin interfaceRemoteGameEventListener- Specified by:
changeTurnin interfaceView- Parameters:
gameId- The unique identifier of the game that has just ended.playerNickname- The player that has just finished their turnplayerIndex- The index of the player that has just finished their turn in the list of players.isLastRound- A boolean indicating if this is the last round of the game.availableSpots- A set of positions that are available for the next player to place a card.forbiddenSpots- A set of positions that are forbidden for the next player to place a card.resourceDeckTopCardId- The unique identifier of the top card in the resource deck.goldDeckTopCardId- The unique identifier of the top card in the gold deck.
-