UIAction

class in Doozy.Engine.UI.Base

Description

The UIAction is a versatile event-like class to that allows for the execution of several 'actions' at once.
With a single method call it can invoke an Action, invoke a list of AnimatorEvent, play or stop an UIEffect (ParticleSystem), invoke an UnityEvent, send a list of game events and play a sound.

It is used by a lot of DoozyUI components such as the UIButton, UIDrawer, UIPopup, UIToggle, UIView , SceneLoader...

Properties

  • public int AnimatorEventsCount – Returns the number of entries in the AnimatorEvents list

  • public int GameEventsCount – Returns the number of entries in the GameEvents list

  • public bool HasAnimatorEvents – Returns TRUE if the AnimatorEvents list has at least one entry

  • public bool HasEffect – Returns TRUE if the Effect (UIEffect) has a ParticleSystem referenced

  • public bool HasGameEvents – Returns TRUE if the GameEvents list has at least one entry

  • public bool HasSound – Returns TRUE if ~SoundData~ has valid sound settings

  • public bool HasUnityEvent – Returns TRUE if the Event (UnityEvent) has at least one registered persistent listener

  • public int UnityEventListenerCount – Returns the number of registered persistent listeners

Public Variables

  • public Action<GameObject> Action – Callback executed when this UIAction is invoked

  • public List<AnimatorEvent> AnimatorEvents – Animator Events invoked when this UIAction is invoked

  • public UIEffect EffectUIEffect invoked when this UIAction is invoked

  • public UnityEvent Event – Callback executed when this UIAction is invoked

  • public List<string> GameEvents – Game Events sent when this UIAction is invoked

  • public SoundyData SoundDataSoundyData used by Soundy to play a sound when this UIAction is invoked

Constructors

  • public UIAction() – Initializes a new instance of the class

Public Methods

  • public UIAction AddAnimatorEvent(AnimatorEvent animatorEvent) – Add and AnimatorEvent, to the AnimatorEvents list, that will get invoked when this UIAction is invoked

  • public UIAction AddAnimatorEvents(List<AnimatorEvent> animatorEvents) – Add a list of AnimatorEvent that will get invoked when this UIAction is invoked

  • public UIAction AddGameEvent(string gameEvent, bool clearGameEventsList = false) – Add a game event, to the GameEvents list, that will get sent when this UIAction is invoked

  • public UIAction AddGameEvents(List<string> gameEvents, bool clearGameEventsList = false) – Add a list of game events, that will get sent when this UIAction is invoked

  • public Canvas GetCanvas(GameObject source, bool refresh = false) – Returns the first Canvas component attached to the source GameObject. If no Canvas is found, it returns null. This method is needed mostly used by the UIEffect

  • public void Invoke(GameObject source, bool playSound = true, bool playEffect = true, bool playAnimatorEvents = true, bool sendGameEvents = true, bool invokeUnityEvent = true, bool invokeAction = true) – Invokes all the enabled settings

  • public void InvokeAction(GameObject source) – Invokes the Action of this UIAction, if it’s not null

  • public ~void~ InvokeUnityEvent() – Invokes the Event (UnityEvent) of this UIAction, if it’s not null

  • public void InvokeAnimatorEvents() – Invokes all the AnimatorEvent entries in the AnimatorEvents list

  • public void ExecuteEffect(Canvas canvas) – Plays the UIEffect (the target ParticleSystem) of this UIAction

  • public void PlaySound() – Plays the sound (if enabled) of this UIAction

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

  • public void SendGameEvents(GameObject source) – Sends any registered game events this UIAction has

  • public UIAction SetAction(Action<GameObject> action) – Set the Action callback executed when this UIAction is invoked

  • public UIAction SetEffect(UIEffect effect) – Set and UIEffect that will get invoked when this UIAction is invoked

  • public UIAction SetSoundyData(SoundyData soundyData) – Set a new SoundyData that will be used by Soundy to play a sound when this UIAction is invoked