Interface PlacementHandler
- All Known Implementing Classes:
PlacementUI
public interface PlacementHandler
Interface defining the necessary operations for handling the ship placement phase. It acts as a
contract between the UI and the event listeners to manage user selections and transitions.
- Author:
- Alessio Cascini
-
Method Summary
Modifier and TypeMethodDescriptionintRetrieves the selected orientation (e.g., Horizontal or Vertical).intRetrieves the index of the currently selected ship from the UI.voidhighlightShipCells(Ship ship) Updates the UI to visually represent a ship that has been successfully placed.voidproceedToGameUI(boolean isFirstPlayer) Transitions the application from the placement screen to the main game screen.voidshowMessage(String message) Displays a feedback message to the user, such as errors or instructions.
-
Method Details
-
getSelectedShipIndex
int getSelectedShipIndex()Retrieves the index of the currently selected ship from the UI.- Returns:
- The index of the selected ship in the fleet list
-
getSelectedOrientationIndex
int getSelectedOrientationIndex()Retrieves the selected orientation (e.g., Horizontal or Vertical).- Returns:
- The index representing the chosen orientation
-
showMessage
Displays a feedback message to the user, such as errors or instructions.- Parameters:
message- The string content to be displayed
-
highlightShipCells
-
proceedToGameUI
void proceedToGameUI(boolean isFirstPlayer) Transitions the application from the placement screen to the main game screen.- Parameters:
isFirstPlayer- Boolean flag to identify if this client is Player 1 or Player 2
-