UI Components
Last updated
Last updated
The UI Components system is responsible for managing various UI elements in the Candy Merge game. This includes handling sliders for audio settings, toggles for options, and updating UI elements based on user interactions. The system ensures that the UI components are interactive and reflect the current game settings.
Controls an audio slider that adjusts volume settings for master or individual tracks. This class handles the initialization of the slider, updates the volume settings based on user input, and saves the settings.
Key Responsibilities:
Initializing Slider: Initializes the slider component and sets the initial value based on saved settings.
Updating Volume Settings: Updates the volume settings when the slider value changes.
Saving Volume Settings: Saves the updated volume settings to persistent storage.
Adjusting Master Volume: The AudioSlider class can be used to adjust the master volume of the game, ensuring that the overall audio level is set according to the player's preference.
Adjusting Individual Track Volume: The AudioSlider class can also be used to adjust the volume of individual audio tracks, allowing for fine-tuned audio control.
Handles the behavior of a UI slider, updating a TextMeshProUGUI element with the slider's value. This class ensures that the slider value is displayed correctly and updates the text component accordingly.
Key Responsibilities:
Displaying Slider Value: Updates the TextMeshProUGUI element with the current slider value.
Subscribing to Slider Events: Subscribes to the slider's value changed event to update the text component in real-time.
Displaying Volume Level: The SliderHandler class can be used to display the current volume level on the UI, providing visual feedback to the player.
Displaying Other Slider Values: The SliderHandler class can also be used to display values for other sliders, such as brightness or sensitivity settings.
Handles the toggle component and syncs its state with saved data. This class ensures that the toggle state is loaded from persistent storage and updates the saved state when the toggle value changes.
Key Responsibilities:
Initializing Toggle: Initializes the toggle component and sets the initial state based on saved settings.
Updating Toggle State: Updates the saved state when the toggle value changes.
Loading Saved State: Loads the saved state of the toggle on start.
Toggling Audio Settings: The ToggleHandler class can be used to toggle audio settings, such as enabling or disabling background music.
Toggling Other Options: The ToggleHandler class can also be used to toggle other game options, such as enabling or disabling visual effects.
By using the UI Components system, you can manage various UI elements in the Candy Merge game, ensuring that the UI is interactive and reflects the current game settings, providing a comprehensive and engaging user interface for players.