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.
22 lines
893 B
C#
22 lines
893 B
C#
using UnityEngine;
|
|
|
|
namespace MoreMountains.Tools
|
|
{
|
|
/// <summary>
|
|
/// An event used to broadcast checkbox events from a MMDebugMenu
|
|
/// </summary>
|
|
public struct MMDebugMenuCheckboxEvent
|
|
{
|
|
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 { FromCheckbox, SetCheckbox }
|
|
public delegate void Delegate(string checkboxEventName, bool value, EventModes eventMode = EventModes.FromCheckbox);
|
|
static public void Trigger(string checkboxEventName, bool value, EventModes eventMode = EventModes.FromCheckbox)
|
|
{
|
|
OnEvent?.Invoke(checkboxEventName, value, eventMode);
|
|
}
|
|
}
|
|
} |