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 TypeMethodDescriptionvoidprocessMove(boolean isPlayerMove, int row, int col, int[][] result) Processes and renders the result of a move on the game grids.voidshowMessage(String message) Displays a game-related message to the player, such as turn notifications or win/loss alerts.
-
Method Details
-
showMessage
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 opponentrow- The row index of the targeted cellcol- The column index of the targeted cellresult- A 2D array containing the outcome: - Empty: Miss - One cell: Hit - Multiple cells: Ship sunk - First cell as [-1, -1]: Game over sentinel
-