Class LadderGameMenuController
java.lang.Object
edu.ntnu.idi.idatt.controller.common.MenuController
edu.ntnu.idi.idatt.controller.laddergame.LadderGameMenuController
- All Implemented Interfaces:
ButtonClickObserver
LadderGameMenuController.
This class extends MenuController
to manage the specific setup and logic for the
Ladder Game main menu. It is responsible for initializing the menu view with Ladder Game specific
options, such as available board variants, player token types, and player limits.
Key responsibilities include:
- Setting up the
LadderBoardFactory
to create ladder game boards. - Defining constraints for the Ladder Game, such as minimum/maximum players and allowed player token types (though currently, all token types and colors are permitted without restriction).
- Populating the list of players by creating
LadderGamePlayer
instances from the information entered in the menu view's player rows. - Initializing the
MenuView
with Ladder Game specific title, token types, colors, and player limits. - Loading predefined/hardcoded ladder board variants (e.g., "Classic", "Teleporting") using the board factory.
- See Also:
-
Field Summary
Fields inherited from class edu.ntnu.idi.idatt.controller.common.MenuController
boardFactory, boardVariants, currentBoardIndex, DEFAULT_BOARD_INDEX, logger, menuView, onBackToGameSelection, onCreateBoard, onStartGame
-
Constructor Summary
ConstructorsConstructorDescriptionLadderGameMenuController
(MenuView menuView) Constructs a newLadderGameMenuController
. -
Method Summary
Modifier and TypeMethodDescriptionRetrieves and returns a list ofPlayer
objects based on the current data entered in the player configuration rows of theMenuController.menuView
.protected void
Initializes theMenuController.menuView
for the Ladder Game.protected void
Loads predefined ladder board variants (e.g., "Classic", "Teleporting") using theMenuController.boardFactory
and stores them in theMenuController.boardVariants
map.Methods inherited from class edu.ntnu.idi.idatt.controller.common.MenuController
handleNextBoard, handlePreviousBoard, loadPlayersFromFile, onButtonClicked, onButtonClickedWithParams, savePlayersToFile, setBoardFactory, setOnBackToGameSelection, setOnCreateBoard, setOnStartGame
-
Constructor Details
-
LadderGameMenuController
Constructs a newLadderGameMenuController
. Initializes the controller with the providedMenuView
, sets up theLadderBoardFactory
, and initializes the menu view for Ladder Game specifics.- Parameters:
menuView
- TheMenuView
associated with this controller.
-
-
Method Details
-
getPlayers
Retrieves and returns a list ofPlayer
objects based on the current data entered in the player configuration rows of theMenuController.menuView
. Each player is created as aLadderGamePlayer
instance.- Specified by:
getPlayers
in classMenuController
- Returns:
- A list of
LadderGamePlayer
s configured in the menu.
-
initializeMenuView
protected void initializeMenuView()Initializes theMenuController.menuView
for the Ladder Game. This involves loading predefined board variants from theMenuController.boardFactory
, setting a default selected board (e.g., "Classic"), and then calling the menu view's initialize method with Ladder Game specific parameters such as the title, allowed token types, allowed colors (currently unrestricted), and min/max players.- Specified by:
initializeMenuView
in classMenuController
-
loadBoardsFromFactory
protected void loadBoardsFromFactory()Loads predefined ladder board variants (e.g., "Classic", "Teleporting") using theMenuController.boardFactory
and stores them in theMenuController.boardVariants
map. This method is called during the initialization of the menu view.- Specified by:
loadBoardsFromFactory
in classMenuController
- See Also:
-