Interface View

All Known Implementing Classes:
ViewGUI, ViewTUI

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 Details

    • setNetworkHandler

      void setNetworkHandler(NetworkHandler networkHandler)
      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

      void showStartupScreen(boolean isSocket, String ip, int port)
      Shows a startup screen. It should be used as first introduction view when the view is created
    • showException

      void showException(Exception e)
      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

      void showRooms(List<RoomIF> rooms)
      Shows the list of rooms returned by the server, which the player can join/reconnect to
      Parameters:
      rooms - List of rooms
    • showPlayerJoinedRoom

      void showPlayerJoinedRoom(PlayerLobby player)
      Shows a player joining the room, possibly the client himself
      Parameters:
      player - Player who joined the room
    • showPlayerLeftRoom

      void showPlayerLeftRoom(PlayerLobby player)
      Shows a player leaving the room, possibly the client himself
      Parameters:
      player - Player who left the room
    • showStartGame

      void showStartGame(GameState state, Chat chat)
      Shows the game starting. It gives the view the reference for the GameState which is kept up to date
      Parameters:
      state - Reference to the game's state which is kept up to date
    • showStartGameReconnected

      void showStartGameReconnected(GameState state, PlayerLobby thisPlayer, Chat chat)
      Shows the already started game to the player who has reconnected mid-game
      Parameters:
      state - GameState of the started match
      thisPlayer - Player linked to this client which is reconnecting to the match
    • showPlayedStarter

      void showPlayedStarter(PlayerLobby player)
      Shows a player playing their starter card
      Parameters:
      player - Player who played their starter card
    • showChosenPersonalObjective

      void showChosenPersonalObjective(PlayerLobby player)
      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

      void showPlayedCard(PlayerLobby player, Coordinates coord)
      Shows a player placing one of their hand cards on the field
      Parameters:
      player - Player who placed the card on field
      coord - Coordinates of the field where the card has been placed
    • showPickedCard

      void showPickedCard(PlayerLobby player)
      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

      void showPlayerDisconnected(PlayerLobby player)
      Show a player disconnecting from the game
      Parameters:
      player - Player who disconnected
    • showPlayerReconnected

      void showPlayerReconnected(PlayerLobby player)
      Show a player reconnecting to the game
      Parameters:
      player - Player who reconnected
    • showChatMessage

      void showChatMessage(PlayerLobby sender, List<PlayerLobby> receivers)
      Shows a chat message
      Parameters:
      sender - of the message
      receivers - of the message
    • forceCloseApp

      void forceCloseApp()
      Forces tbe close of the app. It should be used to end the app for anomalous reasons