Class UnityUiToggleComponentParameters
Unity-specific parameters for toggle UI components that handle boolean value selection.
Extends interactable component parameters to include toggle-specific configuration such as initial value state.
Implements IUiToggleableParameters interface to provide foundation-agnostic toggle functionality within the Unity UI system.
Namespace: Serenity.Ui.Infrastructure.Components
Assembly: Serenity.UnityUi.Infrastructure.dll
Syntax
public class UnityUiToggleComponentParameters : UiInteractableComponentParameters, IUiToggleableParameters, IComponentParameters, IFoundationSettings
Constructors
UnityUiToggleComponentParameters()
Initializes toggle component parameters with default configuration.
Creates a toggle component with default false value and base parameter initialization.
Declaration
public UnityUiToggleComponentParameters()
UnityUiToggleComponentParameters(string, int, bool, string, UiComponentAlignmentType)
Initializes toggle component parameters with basic configuration.
Sets up the toggle with specified ID, index, initial value, label text, and alignment settings.
Declaration
public UnityUiToggleComponentParameters(string id, int index, bool value, string label, UiComponentAlignmentType alignment)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | Unique identifier for the toggle component |
| int | index | Display order index within the parent container |
| bool | value | Initial boolean state of the toggle |
| string | label | Display text label for the toggle option |
| UiComponentAlignmentType | alignment | Text and element alignment configuration |
UnityUiToggleComponentParameters(string, string, int, bool, string, UiComponentAlignmentType, IFoundationViewElementFactory, AudioPlayerPlayClip, string, IUiThemeSounds, bool, bool, float)
Initializes toggle component parameters with complete dependency injection configuration.
Sets up the toggle with full foundation integration including audio services, theme sounds, and view element factories.
Provides comprehensive configuration for toggle components within the Serenity foundation architecture.
Declaration
public UnityUiToggleComponentParameters(string id, string guid, int index, bool value, string label, UiComponentAlignmentType alignment, IFoundationViewElementFactory foundationViewElementFactory, AudioPlayerPlayClip audioPlayerPlayClip, string audioServiceId, IUiThemeSounds themeSounds, bool isTranslatingLabel, bool adaptMenuWidth, float adaptMenuWidthPadding)
Parameters
| Type | Name | Description |
|---|---|---|
| string | id | Unique identifier for the toggle component |
| string | guid | Globally unique identifier for foundation management |
| int | index | Display order index within the parent container |
| bool | value | Initial boolean state of the toggle |
| string | label | Display text label for the toggle option |
| UiComponentAlignmentType | alignment | Text and element alignment configuration |
| IFoundationViewElementFactory | foundationViewElementFactory | Factory for creating foundation view elements |
| AudioPlayerPlayClip | audioPlayerPlayClip | Audio playback delegate for sound effects |
| string | audioServiceId | Audio service identifier for sound playback |
| IUiThemeSounds | themeSounds | Theme sound definitions for UI feedback |
| bool | isTranslatingLabel | Whether the label is being translated |
| bool | adaptMenuWidth | Whether to adapt selector width to text content |
| float | adaptMenuWidthPadding | Padding to apply when adapting selector width to text content |
Fields
_value
Declaration
protected bool _value
Field Value
| Type | Description |
|---|---|
| bool | The current boolean value state of the toggle component. |
Properties
Value
Gets or sets the boolean value of the toggle component.
Controls the on/off state of the toggle UI element.
Declaration
public bool Value { get; set; }
Property Value
| Type | Description |
|---|---|
| bool | The current boolean value |