Interface GameActionHandler

All Known Implementing Classes:
GameUI

public interface GameActionHandler
Interface defining the actions required to update the game state during the battle phase. It facilitates communication between the network logic (event listeners) and the user interface (GameUI).
Author:
Alessio Cascini
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    processMove(boolean isPlayerMove, int row, int col, int[][] result)
    Processes and renders the result of a move on the game grids.
    void
    Displays a game-related message to the player, such as turn notifications or win/loss alerts.
  • Method Details

    • showMessage

      void showMessage(String message)
      Displays a game-related message to the player, such as turn notifications or win/loss alerts.
      Parameters:
      message - The text content to be shown in the UI
    • processMove

      void processMove(boolean isPlayerMove, int row, int col, int[][] result)
      Processes and renders the result of a move on the game grids.
      Parameters:
      isPlayerMove - True if the move was initiated by the local player, false if it was an incoming move from the opponent
      row - The row index of the targeted cell
      col - The column index of the targeted cell
      result - A 2D array containing the outcome: - Empty: Miss - One cell: Hit - Multiple cells: Ship sunk - First cell as [-1, -1]: Game over sentinel