Class UnityUiViewFactory
Factory for creating Unity UI views with proper configuration and setup.
Handles view instantiation, component assignment, and initialization within the Unity UI system.
Integrates audio services, theme definitions, and use case dependencies for complete view functionality.
Implements
Inherited Members
Namespace: Serenity.Ui.Infrastructure.Views.Factories
Assembly: Serenity.UnityUi.Infrastructure.dll
Syntax
public class UnityUiViewFactory : IUiViewFactory
Constructors
UnityUiViewFactory(AudioPlayerPlayClip)
Initializes a new instance of the UnityUiViewFactory with audio playback capability.
Sets up the factory with audio integration for UI sound effects.
Declaration
public UnityUiViewFactory(AudioPlayerPlayClip audioPlayerPlayClip)
Parameters
| Type | Name | Description |
|---|---|---|
| AudioPlayerPlayClip | audioPlayerPlayClip | The audio player delegate for playing UI sounds |
Methods
CreateView(object, UiUseCases, IViewModel, IFoundationSettings, string, IUiThemeDefinition)
Creates a Unity UI view with the specified configuration and dependencies.
Instantiates the view GameObject, configures components, and initializes the view with all required services.
Declaration
public IViewBase CreateView(object canvas, UiUseCases useCases, IViewModel viewModel, IFoundationSettings settings, string audioServiceId, IUiThemeDefinition theme)
Parameters
| Type | Name | Description |
|---|---|---|
| object | canvas | The Unity Canvas object that will contain the view |
| UiUseCases | useCases | The UI use cases for view operations |
| IViewModel | viewModel | The view model for data binding |
| IFoundationSettings | settings | The foundation settings configuration |
| string | audioServiceId | The identifier for the audio service |
| IUiThemeDefinition | theme | The UI theme definition for styling |
Returns
| Type | Description |
|---|---|
| IViewBase | The configured Unity UI view instance |
SetAudioClips(UnityUiView, IUiThemeDefinition)
Configures audio clips for view show/hide/cancel sound effects from theme definition.
Extracts audio clip information from the theme and creates AudioPlayerClip instances for view sound feedback.
Declaration
protected void SetAudioClips(UnityUiView view, IUiThemeDefinition theme)
Parameters
| Type | Name | Description |
|---|---|---|
| UnityUiView | view | The view to configure audio clips for |
| IUiThemeDefinition | theme | UI theme definition containing audio clip references |