Learn / Documentation / Script Reference / UIToggleBehavior

UIToggleBehavior

class in Doozy.Engine.UI

Description

The UIToggleBehavior class contains settings and 'actions' used and triggered by the UIToggle when it changes its state

Static Properties

  • public static string DefaultPresetCategory – Returns the default preset category name for an UIToggle

  • public static string DefaultPresetName – Returns the default preset name for an UIToggle

Properties

  • public int AnimatorsCount – Returns the number of AnimatorEvents that have been added to the Animator list

  • public UIToggleBehaviorType BehaviorType – Returns for what type of behavior the settings and ‘actions’ are configured for

  • public bool HasAnimation – If ButtonAnimationType is either Punch or State, it will return TRUE if at least one animation is enabled or if a preset is set to be loaded at runtime. If ButtonAnimationType is Animator, it will return TRUE if an AnimatorEvent has been added to the Animators list.

  • public bool HasAnimators – Returns TRUE if ButtonAnimationType.Animator and at least one Animator has been added to the Animators list

  • public bool HasAnimatorEvents – Returns TRUE if OnToggleOn UIAction or OnToggleOff UIAction have at least one AnimatorEvent in the AnimatorEvents list

  • public bool HasEffect – Returns TRUE if OnToggleOn UIAction Effect (UIEffect) or OnToggleOff UIAction Effect (UIEffect) have a target ParticleSystem referenced

  • public bool HasGameEvents – Returns TRUE if OnToggleOn UIAction or OnToggleOff UIAction have at least one game event in the GameEvents list

  • public bool HasPunchAnimation – Returns TRUE if ButtonAnimationType.Punch and at least one punch animation is enabled or if a preset is set to be loaded at runtime

  • public bool HasSound – Returns TRUE if OnToggleOn UIAction or OnToggleOff UIAction have valid sound settings

  • public bool HasStateAnimation – Returns TRUE if ButtonAnimationType.State and at least one state animation is enabled or if a preset is set to be loaded at runtime

  • public bool HasUnityEvents – Returns TRUE if OnToggleOn UIAction Event (UnityEvent) or OnToggleOff UIAction Event (UnityEvent) have at least one registered persistent listener

Public Variables

  • public List<AnimatorEvent> AnimatorsAnimator animation settings

  • public ButtonAnimationType ButtonAnimationType – Determines what type of animation is enabled on this behavior

  • public bool DeselectButton – Determines if the button should get deselected after this behavior has been triggered (works only for OnPointerExit and OnPointerUp)

  • public float DisableInterval – Time interval after this behavior has been fired while it cannot be fired again (works only for OnPointerEnter and OnPointerExit)

  • public bool Enabled – Toggles this behavior

  • public bool LoadSelectedPresetAtRuntime – Determines if the selected preset should override at runtime the current editor settings or not

  • public UIAction OnToggleOff – Actions performed when the behavior is triggered and the toggle is off

  • public UIAction OnToggleOn – Actions performed when the behavior is triggered and the toggle is on

  • public string PresetCategory – Preset category name

  • public string PresetName – Preset name

  • public UIAnimation PunchAnimation – Punch animation settings

  • public bool Ready – Keeps track if this behavior is ready to get fired again. This is needed if a disable interval has been set

  • public bool SelectButton – Determines if the button should get selected after this behavior has been triggered (works only for OnPointerEnter and OnPointerDown)

  • public UIAnimation StateAnimation – State animation settings

  • public bool TriggerEventsAfterAnimation – If TRUE, all the events will get fired after the animation finished playing. This is useful if you want to be sure the user sees the button animation

Constructors

  • public UIToggleBehavior(UIToggleBehaviorType behaviorType, bool enabled = false) – Initializes a new instance of the class

Public Methods

  • public float GetAnimationTotalDuration() – Returns the maximum duration (including startDelay) of the punch or state animation (depending on what AnimationType is set on this behavior)

  • public void Invoke(UIToggle toggle) – Triggers this behavior by executing its actions

  • public void LoadPreset() – Loads the selected preset settings

  • public void LoadPreset(string presetCategory, string presetName) – Loads the preset, with the given category name and preset name, settings

  • public void PlayAnimation(UIToggle toggle, bool withSound = true, UnityAction onStartCallback = null, UnityAction onCompleteCallback = null) – Plays the currently active animation

  • public void Reset(UIToggleBehaviorType behaviorType) – Resets this instance to the default values

Static Methods