public interface View
Interface representing methods exposed by a generic game view.
Some methods handle the lobby phase, when the view should show the list of available rooms and players joining the room.
The other methods can be used to modify the view in order to respond to the updates coming from the server.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Forces tbe close of the app.void
setNetworkHandler
(NetworkHandler networkHandler) Sets the handler of the network, which the view can use to send its command actions to the servervoid
showChatMessage
(PlayerLobby sender, List<PlayerLobby> receivers) Shows a chat messagevoid
Shows a players choosing their personal objective cardvoid
Show the end of the game (after which the server deletes the game)void
Shows a generic exception in the view (specific exception could be handled in different ways, also depending on the phase or the state of game)void
Shows the game entering the final phase (last turns before adding extra points)void
Show the game entering the turn-based phasevoid
Show the game moving on to the next turnvoid
showPickedCard
(PlayerLobby player) Shows a player picking a cardvoid
showPlayedCard
(PlayerLobby player, Coordinates coord) Shows a player placing one of their hand cards on the fieldvoid
showPlayedStarter
(PlayerLobby player) Shows a player playing their starter cardvoid
showPlayerDisconnected
(PlayerLobby player) Show a player disconnecting from the gamevoid
showPlayerJoinedRoom
(PlayerLobby player) Shows a player joining the room, possibly the client himselfvoid
showPlayerLeftRoom
(PlayerLobby player) Shows a player leaving the room, possibly the client himselfvoid
showPlayerReconnected
(PlayerLobby player) Show a player reconnecting to the gamevoid
Shows the list of rooms returned by the server, which the player can join/reconnect tovoid
showStartGame
(GameState state, Chat chat) Shows the game starting.void
showStartGameReconnected
(GameState state, PlayerLobby thisPlayer, Chat chat) Shows the already started game to the player who has reconnected mid-gamevoid
showStartupScreen
(boolean isSocket, String ip, int port) Shows a startup screen.void
Shows the points updated after the turn-based phase is finishedvoid
Show the winner
-
Method Details
-
setNetworkHandler
Sets the handler of the network, which the view can use to send its command actions to the server- Parameters:
networkHandler
- Handler of the network
-
showStartupScreen
Shows a startup screen. It should be used as first introduction view when the view is created -
showException
Shows a generic exception in the view (specific exception could be handled in different ways, also depending on the phase or the state of game)- Parameters:
e
- Exception to be shown
-
showRooms
Shows the list of rooms returned by the server, which the player can join/reconnect to- Parameters:
rooms
- List of rooms
-
showPlayerJoinedRoom
Shows a player joining the room, possibly the client himself- Parameters:
player
- Player who joined the room
-
showPlayerLeftRoom
Shows a player leaving the room, possibly the client himself- Parameters:
player
- Player who left the room
-
showStartGame
Shows the game starting. It gives the view the reference for theGameState
which is kept up to date- Parameters:
state
- Reference to the game's state which is kept up to date
-
showStartGameReconnected
Shows the already started game to the player who has reconnected mid-game- Parameters:
state
- GameState of the started matchthisPlayer
- Player linked to this client which is reconnecting to the match
-
showPlayedStarter
Shows a player playing their starter card- Parameters:
player
- Player who played their starter card
-
showChosenPersonalObjective
Shows a players choosing their personal objective card- Parameters:
player
- Player who chose their personal objective card
-
showInGame
void showInGame()Show the game entering the turn-based phase -
showPlayedCard
Shows a player placing one of their hand cards on the field- Parameters:
player
- Player who placed the card on fieldcoord
- Coordinates of the field where the card has been placed
-
showPickedCard
Shows a player picking a card- Parameters:
player
- Player who picked a card
-
showNextTurn
void showNextTurn()Show the game moving on to the next turn -
showFinalPhase
void showFinalPhase()Shows the game entering the final phase (last turns before adding extra points) -
showUpdatePoints
void showUpdatePoints()Shows the points updated after the turn-based phase is finished -
showWinner
void showWinner()Show the winner -
showEndGame
void showEndGame()Show the end of the game (after which the server deletes the game) -
showPlayerDisconnected
Show a player disconnecting from the game- Parameters:
player
- Player who disconnected
-
showPlayerReconnected
Show a player reconnecting to the game- Parameters:
player
- Player who reconnected
-
showChatMessage
Shows a chat message- Parameters:
sender
- of the messagereceivers
- of the message
-
forceCloseApp
void forceCloseApp()Forces tbe close of the app. It should be used to end the app for anomalous reasons
-