Enhancement of Settings - UQcsse3200/2024-studio-1 GitHub Wiki

Overview

Enhancing the game settings by adding a notification box that appears whenever any setting is changed, asking, "Are you sure you want to apply the changes?" This confirmation step ensures that players don’t accidentally make unwanted adjustments. Additionally, once any changes are applied, the settings screen automatically exits, streamlining the process and allowing players to return to their gameplay more quickly. These enhancements make the settings experience more intuitive and user-friendly.

Features

Confirmation Dialog:

The applyChanges method creates a Dialog named confirmationDialog that prompts the player with the message, "Are you sure you want to apply these changes?" The dialog has "Cancel" and "Okay" options, where pressing "Okay" confirms and applies the settings, while "Cancel" keeps the current settings.

Automatic Exit:

When the "Okay" button is pressed, the game calls game.setScreen(ScreenType.MAIN_MENU) to exit the settings screen and return to the main menu. The exitMenu method also handles the transition back to the main menu when the "Exit" button is clicked.

Implementation

The enhancements ensure that players have a safeguard against accidental changes while providing a seamless way to return to the game once settings adjustments are confirmed.