You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CrowdControl/Assets/Feel/MMTools/Tools/MMDebugMenu/Scripts/Events/MMDebugMenuSliderEvent.cs

22 lines
877 B
C#

2 months ago
using UnityEngine;
namespace MoreMountains.Tools
{
/// <summary>
/// An event used to broadcast slider events from a MMDebugMenu
/// </summary>
public struct MMDebugMenuSliderEvent
{
static private event Delegate OnEvent;
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] private static void RuntimeInitialization() { OnEvent = null; }
static public void Register(Delegate callback) { OnEvent += callback; }
static public void Unregister(Delegate callback) { OnEvent -= callback; }
public enum EventModes { FromSlider, SetSlider }
public delegate void Delegate(string sliderEventName, float value, EventModes eventMode = EventModes.FromSlider);
static public void Trigger(string sliderEventName, float value, EventModes eventMode = EventModes.FromSlider)
{
OnEvent?.Invoke(sliderEventName, value, eventMode);
}
}
}