Class UnityGameSettingsAssetPreloadingIntegrator
Integration component that connects menu lifecycle events with progressive asset preloading.
SYSTEM DESIGN:
This component listens to menu display and interaction events to trigger appropriate
preloading strategies. It acts as the glue between the menu system and the progressive
asset preloader.
EVENT INTEGRATION:
- Menu Display: Triggers initial menu analysis and preloading
- Selection Change: Updates neighbor preloading based on current selection
- Value Submission: Triggers preloading for newly selected values
- Menu Exit: Releases associated assets to free memory
PRELOADING TRIGGERS: - OnMenuDisplayed(): Analyzes entire menu and preloads all discoverable assets
- OnSelectionChanged(): Updates sliding window preloading around current selection
- OnValueSubmitted(): Preloads assets for newly confirmed values
- OnMenuExited(): Cleans up all menu-related preloaded assets
NOTE: This is a design template. Full implementation requires proper assembly references to access UiOption, MenuDisplayEvent, and other domain types.
Implements
Namespace: Serenity.GameSettings.Infrastructure.Services
Assembly: Serenity.UnityGlobal.Infrastructure.dll
Syntax
public class UnityGameSettingsAssetPreloadingIntegrator : MonoBehaviour, IGameSettingsAssetPreloadingIntegrator
Constructors
UnityGameSettingsAssetPreloadingIntegrator()
Declaration
public UnityGameSettingsAssetPreloadingIntegrator()
Methods
Initialize(IGameSettingsAssetPreloader, ILogService)
Initializes the integrator with the asset preloader component.
Declaration
public void Initialize(IGameSettingsAssetPreloader assetPreloader, ILogService logService)
Parameters
| Type | Name | Description |
|---|---|---|
| IGameSettingsAssetPreloader | assetPreloader | The asset preloader to integrate with |
| ILogService | logService |
OnMenuDisplayed(string, object[])
Called when a menu is displayed to the user.
Triggers comprehensive analysis and preloading for the entire menu.
Declaration
public void OnMenuDisplayed(string menuId, object[] options)
Parameters
| Type | Name | Description |
|---|---|---|
| string | menuId | Identifier of the displayed menu |
| object[] | options | Menu options that were displayed (design: UiOption[] when available) |
OnMenuExited(string)
Called when user exits a menu.
Triggers cleanup of menu-related preloaded assets to free memory.
Declaration
public void OnMenuExited(string menuId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | menuId | Identifier of the menu being exited |
OnSelectionChanged(string, int, object[])
Called when user changes their selection within a menu.
Triggers sliding window preloading around the new selection.
Declaration
public void OnSelectionChanged(string menuId, int selectedIndex, object[] options)
Parameters
| Type | Name | Description |
|---|---|---|
| string | menuId | Identifier of the menu where selection changed |
| int | selectedIndex | Index of the newly selected option |
| object[] | options | All available options in the menu |
OnValueSubmitted(string, string, string)
Called when user submits/confirms a value selection.
Triggers preloading for the newly submitted value and related options.
Declaration
public void OnValueSubmitted(string menuId, string selectedValue, string optionId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | menuId | Identifier of the menu where value was submitted |
| string | selectedValue | The value that was submitted |
| string | optionId | ID of the option that was modified |
TriggerManualPreloading(string)
Manual trigger for testing or debugging the integration.
Declaration
public void TriggerManualPreloading(string menuId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | menuId | Menu ID to trigger preloading for |
ValidateConfiguration()
Validates that all required dependencies are properly configured.
Declaration
public bool ValidateConfiguration()
Returns
| Type | Description |
|---|---|
| bool | True if configuration is valid, false otherwise |