using System; using UnityEngine; namespace AlicizaX.UI { /// /// Base class for all controller states /// public abstract class ControllerStateBase { /// /// Initialize the state when added to a recorder /// public abstract void Init(UXControllerStateRecorder recorder); /// /// Execute the state when controller index changes /// /// The state recorder /// The index this state entry is bound to /// The currently selected controller index public abstract void Execute(UXControllerStateRecorder recorder, int entryIndex, int selectedIndex); /// /// Validate if the state can be properly executed /// public abstract bool Valid(UXControllerStateRecorder recorder); /// /// Get a human-readable description of this state /// public virtual string GetDescription() { return GetType().Name; } } /// /// Attribute to define display name for a controller state type /// [AttributeUsage(AttributeTargets.Class)] public class ControlerStateNameAttribute : Attribute { public string StateName { get; } public ControlerStateNameAttribute(string stateName) { StateName = stateName; } } /// /// Attribute to define if a state can be attached multiple times to the same recorder /// [AttributeUsage(AttributeTargets.Class)] public class ControlerStateAttachTypeAttribute : Attribute { public bool Repeat { get; } public ControlerStateAttachTypeAttribute(bool repeat) { Repeat = repeat; } } }