Class UnityUiPresenter
Abstract base class for Unity UI presenters that manage UI view models and display operations.
Provides common functionality for showing, hiding, and managing UI elements through view model interaction.
Implements
Inherited Members
Namespace: Serenity.Ui.InterfaceAdapters.Presenters
Assembly: Serenity.UnityUi.InterfaceAdapters.dll
Syntax
public abstract class UnityUiPresenter : IUiPresenter
Constructors
UnityUiPresenter(IPlayerInputService)
Initializes the presenter with the player input service used for action-map switching.
Declaration
protected UnityUiPresenter(IPlayerInputService playerInputService)
Parameters
| Type | Name | Description |
|---|---|---|
| IPlayerInputService | playerInputService | The player input service. May be null in contexts where input switching is not required. |
Fields
_playerInputService
Declaration
protected IPlayerInputService _playerInputService
Field Value
| Type | Description |
|---|---|
| IPlayerInputService | Service used to switch the active input action map when a UI is shown. |
_viewModels
Declaration
protected Dictionary<string, IViewModel> _viewModels
Field Value
| Type | Description |
|---|---|
| Dictionary<string, IViewModel> |
Methods
GetUiViewModel(string)
Gets the Unity UI view model for the specified menu identifier.
Retrieves the view model from the internal dictionary and performs type casting.
Declaration
protected UnityUiViewModel GetUiViewModel(string menuId)
Parameters
| Type | Name | Description |
|---|---|---|
| string | menuId | The unique identifier of the UI menu |
Returns
| Type | Description |
|---|---|
| UnityUiViewModel | The Unity UI view model instance |
Exceptions
| Type | Condition |
|---|---|
| Exception | Thrown when the UI with the specified ID is not found |
Hide(UiHideInput)
Hides the UI element specified by the input data.
Makes the UI element invisible and triggers any associated hide animations or effects.
Declaration
public void Hide(UiHideInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| UiHideInput | input | The input data containing the ID of the UI element to hide |
Show(UiShowInput)
Shows the UI element specified by the input data.
Makes the UI element visible and triggers any associated show animations or effects.
Declaration
public void Show(UiShowInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| UiShowInput | input | The input data containing the ID of the UI element to show |