-
Notifications
You must be signed in to change notification settings - Fork 0
Pop up Menus UI Display and Action Handling
Pop-up menus throughout the game function similarly regardless of their reason for appearing. To minimise duplicate code and encourage modularity, two classes were built to manage creating the UI elements and on-click actions common to all, or many menus.
The display of the UI and control of actions common to all menus is handled by the UIPopupHandler and PopupMenuActions classes. The UIPopupHandler class controls the setting up of the menu background, buttons and triggers on the buttons. The PopupMenuActions class controls actions common to all menus (such as returning to the Main Menu and Replaying the level).
When a new PopupMenu is added to a UI, it should be passed a new PopupUIHandler. The PopupUIHandler constructor takes a String[] textures as an argument which contains the filepaths of the menu's background and buttons to be placed onto the pop-up menu. This textures object must have been loaded by the resource service (ServiceLocator.getResourceService()) prior to being passed to the PopupUIHandler. textures must be ordered as:
- the background image for the menu
- the button(s) you would like to place onto the menu.
Once the pop-up menu appears, a _Display.java class should be created as part of the pop-up's UI. This class will call on methods from the PopupUIHandler. For example, in the PlayerWinDisplay addActors method:
// Set up the background image
Table background = new Table();
handler.setupBackground(background);
// Place the buttons onto the UI.
Table buttonHolder = new Table();
ArrayList<Image> button = handler.setupButtons(buttonHolder, 125, 15);
// Set up the on-click triggers for the buttons.
final String[] actions = {"replayLevel","homeMenu","continue"};
handler.setupButtonClicks(buttons, actions, entity);
// Add to the stage to display the pop-up menu
stage.addActor(backgroundFrame);
stage.addActor(buttonHolder);
PopupMenuActions must be added as a Component to the over-arching UI. As the PopupMenus are also Components of the UI, they are able to access the same Entity object. For example, in the MainGameScreen createUI method:
Entity ui = new Entity();
ui.addComponent(new PopUpMenu(this.game, new PopupUIHandler));
.addComponent(new PopupMenuActions(this.game));
When the pop-up menu's UI is created, an _Actions.java class should be created as part of the UI. This class is passed a reference to the over-arching UI. For example, in the PlayerWinPopup createUI method:
Entity ui = new Entity();
ui.addComponent(new PlayerWinActions(game, upperUI))
.addCompoonent(new PlayerWinDisplay(handler));
For common functionality, these Action classes will call on the PopupMenuActions class. For example, in the PlayerWinActions create() method:
// Functionality which is common to all pop-up menus
entity.getEvents().addListener("replayLevel", this.mainGameUI.getComponent(PopupMenuActions.class)::onReplay);
// Functionality on this menu only
entity.getEvents().addListener("continue", this::onContinue);
- Player UI
- Popup Menus
- Obstacles
- Boss Enemies
- Progress Tracker
- Checkpoint Design and Functionality
- Score System
- Lives System
- Game Background
- Multiple game-level
- Visual Improvements
- Tutorial Level
- Character Design and Animations
- Character Damage Animations
- Player Animation Functionalities
- Player and Serpent Portal Transition
- Pop-up Menus
- Obstacles
- Lives & Score User Testing
- Buffs & Debuffs
- Buffs & Debuffs redesign
- Obstacle Animation
- Background Design
- Level 2 Background Appearance
- Enemy Monster User Testing
- Level 1 Floor Terrain Testing
- Introduction Screens User Testing
- Character Movement Interviews & User Testing
- Sound user testing
- Level 2 Obstacles and enemy
- Story, Loading, Level 4 and Win Condition Sound Design User Testing
- Giant Bug and Purple Squid animation user testing
- General Gameplay and Tutorial Level User Testing
- Level 4 Terrain User Testing
- Game Outro User Testing