Insanely huge initial commit

This commit is contained in:
2026-02-21 17:04:05 -08:00
parent 9cdd36191a
commit 613d75914a
22525 changed files with 4035207 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace MoreMountains.Tools
{
/// <summary>
/// A class used to bind a button to a MMDebugMenu
/// </summary>
public class MMDebugMenuItemButton : MonoBehaviour
{
[Header("Bindings")]
/// the associated button
public Button TargetButton;
/// the button's text comp
public Text ButtonText;
/// the button's background image
public Image ButtonBg;
/// the name of the event bound to this button
public string ButtonEventName = "Button";
protected bool _listening = false;
/// <summary>
/// Triggers a button event using the button's event name
/// </summary>
public virtual void TriggerButtonEvent()
{
MMDebugMenuButtonEvent.Trigger(ButtonEventName);
}
protected virtual void OnMMDebugMenuButtonEvent(string checkboxEventName, bool active, MMDebugMenuButtonEvent.EventModes eventMode)
{
if ((eventMode == MMDebugMenuButtonEvent.EventModes.SetButton)
&& (checkboxEventName == ButtonEventName)
&& (TargetButton != null))
{
TargetButton.interactable = active;
}
}
/// <summary>
/// Starts listening for events
/// </summary>
public virtual void OnEnable()
{
if (!_listening)
{
_listening = true;
MMDebugMenuButtonEvent.Register(OnMMDebugMenuButtonEvent);
}
}
/// <summary>
/// Stops listening for events
/// </summary>
public virtual void OnDestroy()
{
_listening = false;
MMDebugMenuButtonEvent.Unregister(OnMMDebugMenuButtonEvent);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 4111d7e29da39ee46b807daa22dd3af9
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,102 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace MoreMountains.Tools
{
/// <summary>
/// A class used to bind a checkbox to a MMDebugMenu
/// </summary>
public class MMDebugMenuItemCheckbox : MonoBehaviour
{
[Header("Bindings")]
/// the switch used to display the checkbox
public MMDebugMenuSwitch Switch;
/// the text used to display the checkbox's text
public Text SwitchText;
/// the name of the checkbox event
public string CheckboxEventName = "Checkbox";
protected bool _valueSetThisFrame = false;
protected bool _listening = false;
/// <summary>
/// Triggers an event when the checkbox gets pressed
/// </summary>
public virtual void TriggerCheckboxEvent()
{
if (_valueSetThisFrame)
{
_valueSetThisFrame = false;
return;
}
MMDebugMenuCheckboxEvent.Trigger(CheckboxEventName, Switch.SwitchState, MMDebugMenuCheckboxEvent.EventModes.FromCheckbox);
}
/// <summary>
/// Triggers an event when the checkbox gets checked and becomes true
/// </summary>
public virtual void TriggerCheckboxEventTrue()
{
if (_valueSetThisFrame)
{
_valueSetThisFrame = false;
return;
}
MMDebugMenuCheckboxEvent.Trigger(CheckboxEventName, true, MMDebugMenuCheckboxEvent.EventModes.FromCheckbox);
}
/// <summary>
/// Triggers an event when the checkbox gets unchecked and becomes false
/// </summary>
public virtual void TriggerCheckboxEventFalse()
{
if (_valueSetThisFrame)
{
_valueSetThisFrame = false;
return;
}
MMDebugMenuCheckboxEvent.Trigger(CheckboxEventName, false, MMDebugMenuCheckboxEvent.EventModes.FromCheckbox);
}
protected virtual void OnMMDebugMenuCheckboxEvent(string checkboxEventName, bool value, MMDebugMenuCheckboxEvent.EventModes eventMode)
{
if ((eventMode == MMDebugMenuCheckboxEvent.EventModes.SetCheckbox)
&& (checkboxEventName == CheckboxEventName))
{
_valueSetThisFrame = true;
if (value)
{
Switch.SetTrue();
}
else
{
Switch.SetFalse();
}
}
}
/// <summary>
/// Starts listening for events
/// </summary>
public virtual void OnEnable()
{
if (!_listening)
{
_listening = true;
MMDebugMenuCheckboxEvent.Register(OnMMDebugMenuCheckboxEvent);
}
}
/// <summary>
/// Stops listening for events
/// </summary>
public virtual void OnDestroy()
{
_listening = false;
MMDebugMenuCheckboxEvent.Unregister(OnMMDebugMenuCheckboxEvent);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 28ad17ba84c916d499cb74e758d28e8e
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,77 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace MoreMountains.Tools
{
/// <summary>
/// A class used to store choices contents
/// </summary>
[System.Serializable]
public class MMDebugMenuChoiceEntry
{
/// the button associated to this choice
public Button TargetButton;
/// the text comp used to display the button's text
public Text ButtonText;
/// the button's background image comp
public Image ButtonBg;
/// the name of the event bound to this button
public string ButtonEventName = "ButtonEvent";
}
/// <summary>
/// A class used to bind a Choice menu item to a MMDebugMenu
/// </summary>
public class MMDebugMenuItemChoices : MonoBehaviour
{
[Header("Bindings")]
/// the sprite to use when the button is active
public Sprite SelectedSprite;
/// the sprite to use as bg when the button is inactive
public Sprite OffSprite;
/// the color to use when the button is active
public Color OnColor = Color.white;
/// the color to use when the button is inactive
public Color OffColor = Color.black;
/// the color to use when the button is accented
public Color AccentColor = MMColors.ReunoYellow;
/// a list of choices
public List<MMDebugMenuChoiceEntry> Choices;
/// <summary>
/// Triggers a button event of the selected index
/// </summary>
/// <param name="index"></param>
public virtual void TriggerButtonEvent(int index)
{
MMDebugMenuButtonEvent.Trigger(Choices[index].ButtonEventName);
}
/// <summary>
/// Selects one of the buttons
/// </summary>
/// <param name="index"></param>
public virtual void Select(int index)
{
Deselect();
Choices[index].ButtonBg.sprite = SelectedSprite;
Choices[index].ButtonBg.color = AccentColor;
Choices[index].ButtonText.color = OffColor;
}
/// <summary>
/// Deselects all buttons
/// </summary>
public virtual void Deselect()
{
foreach(MMDebugMenuChoiceEntry entry in Choices)
{
entry.ButtonBg.sprite = OffSprite;
entry.ButtonBg.color = OnColor;
entry.ButtonText.color = OnColor;
}
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 1b2bca3004ee68c45bb99ade8a9e5380
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,139 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace MoreMountains.Tools
{
/// <summary>
/// A class used to bind a slider to a MMDebugMenu
/// </summary>
public class MMDebugMenuItemSlider : MonoBehaviour
{
/// the possible modes this slider can operate on
public enum Modes { Float, Int }
[Header("Bindings")]
/// the selected mode for this slider
public Modes Mode = Modes.Float;
/// the Slider to use to change the value
public Slider TargetSlider;
/// the text comp used to display the slider's name
public Text SliderText;
/// the text comp used to display the slider's value
public Text SliderValueText;
/// the target knob
public Image SliderKnob;
/// the line behind the knob
public Image SliderLine;
/// the value to remap the slider's 0 to
public float RemapZero = 0f;
/// the value to remap the slider's 1 to
public float RemapOne = 1f;
/// the name of the event bound to this slider
public string SliderEventName = "Checkbox";
/// the current slider value
[MMReadOnly]
public float SliderValue;
/// the current slider int value
[MMReadOnly]
public int SliderValueInt;
protected bool _valueSetThisFrame = false;
protected bool _listening = false;
/// <summary>
/// On Awake we start listening for slider changes
/// </summary>
protected virtual void Awake()
{
TargetSlider.onValueChanged.AddListener(delegate { ValueChangeCheck(); });
}
/// <summary>
/// Invoked when the slider value changes
/// </summary>
public void ValueChangeCheck()
{
if (_valueSetThisFrame)
{
_valueSetThisFrame = false;
return;
}
bool valueChanged = true;
SliderValue = MMMaths.Remap(TargetSlider.value, 0f, 1f, RemapZero, RemapOne);
if (Mode == Modes.Int)
{
SliderValue = Mathf.Round(SliderValue);
if (SliderValue == SliderValueInt)
{
valueChanged = false;
}
SliderValueInt = (int)SliderValue;
}
if (valueChanged)
{
UpdateValue(SliderValue);
}
TriggerSliderEvent(SliderValue);
}
protected virtual void UpdateValue(float newValue)
{
SliderValueText.text = (Mode == Modes.Int) ? newValue.ToString() : newValue.ToString("F3");
}
/// <summary>
/// Triggers a slider event
/// </summary>
/// <param name="value"></param>
protected virtual void TriggerSliderEvent(float value)
{
MMDebugMenuSliderEvent.Trigger(SliderEventName, value, MMDebugMenuSliderEvent.EventModes.FromSlider);
}
/// <summary>
/// When we get a set slider event, we set our value
/// </summary>
/// <param name="sliderEventName"></param>
/// <param name="value"></param>
protected virtual void OnMMDebugMenuSliderEvent(string sliderEventName, float value, MMDebugMenuSliderEvent.EventModes eventMode)
{
if ((eventMode == MMDebugMenuSliderEvent.EventModes.SetSlider)
&& (sliderEventName == SliderEventName))
{
_valueSetThisFrame = true;
TargetSlider.value = MMMaths.Remap(value, RemapZero, RemapOne, 0f, 1f);
UpdateValue(value);
}
}
/// <summary>
/// Starts listening for events
/// </summary>
public virtual void OnEnable()
{
if (!_listening)
{
MMDebugMenuSliderEvent.Register(OnMMDebugMenuSliderEvent);
_listening = true;
}
}
/// <summary>
/// Stops listening for events
/// </summary>
public virtual void OnDestroy()
{
_listening = false;
MMDebugMenuSliderEvent.Unregister(OnMMDebugMenuSliderEvent);
}
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 6d8d661dac43a98489944be49a162bda
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,18 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace MoreMountains.Tools
{
/// <summary>
/// A class used to bind a text item to a MMDebugMenu
/// </summary>
public class MMDebugMenuItemText : MonoBehaviour
{
[Header("Bindings")]
/// a text comp used to display the text
[TextArea]
public Text ContentText;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 26996c3ee681f254592c7bbaf459447a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,19 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace MoreMountains.Tools
{
/// <summary>
/// A class used to bind a title item to a MMDebugMenu
/// </summary>
public class MMDebugMenuItemTitle : MonoBehaviour
{
[Header("Bindings")]
/// the text comp used to display the title
public Text TitleText;
/// a line below the title
public Image TitleLine;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: debc95d929132814d968cb0e4c3c8bca
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,25 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
namespace MoreMountains.Tools
{
/// <summary>
/// A class used to bind a value item to a MMDebugMenu
/// </summary>
public class MMDebugMenuItemValue : MonoBehaviour
{
[Header("Bindings")]
/// the label to display next to the value
public Text LabelText;
/// the text comp to display the value with
public Text ValueText;
/// a radio receiver to update the value with
public MMRadioReceiver RadioReceiver;
/// the current level of this value item
public float Level { get { return _level; } set { _level = value; ValueText.text = value.ToString("F2"); } }
protected float _level;
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 5aecab0d11ad9fe47bd4744bf897a145
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: