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,63 @@
using UnityEngine;
using System.Collections;
using System;
using MoreMountains.Tools;
using UnityEngine.UI;
using System.Collections.Generic;
namespace MoreMountains.Tools
{
/// <summary>
/// A class to handle radio buttons.
/// To group them, just use the same RadioButtonGroupName string for all radio buttons in the group
/// </summary>
public class MMDebugMenuRadioButton : MMDebugMenuSpriteReplace
{
/// The name of the radio button group. Use the same one for each buttons in the group
public string RadioButtonGroupName;
protected List<MMDebugMenuRadioButton> _group;
/// <summary>
/// On Init, we grab all buttons from the group
/// </summary>
public override void Initialization()
{
base.Initialization ();
FindAllRadioButtonsFromTheSameGroup ();
}
/// <summary>
/// Finds all radio buttons from the same group.
/// </summary>
protected virtual void FindAllRadioButtonsFromTheSameGroup ()
{
_group = new List<MMDebugMenuRadioButton> ();
MMDebugMenuRadioButton[] radioButtons = FindObjectsOfType(typeof(MMDebugMenuRadioButton)) as MMDebugMenuRadioButton[];
foreach (MMDebugMenuRadioButton radioButton in radioButtons)
{
if ((radioButton.RadioButtonGroupName == RadioButtonGroupName)
&& (radioButton != this))
{
_group.Add (radioButton);
}
}
}
/// <summary>
/// When turning the button on, we turn off all other buttons in the group
/// </summary>
protected override void SpriteOn()
{
base.SpriteOn ();
if (_group.Count >= 1)
{
foreach (MMDebugMenuRadioButton radioButton in _group)
{
radioButton.SwitchToOffSprite ();
}
}
}
}
}

View File

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

View File

@@ -0,0 +1,112 @@
using UnityEngine;
using System.Collections;
using System;
using MoreMountains.Tools;
using UnityEngine.UI;
namespace MoreMountains.Tools
{
/// <summary>
/// A class to add to an image to have it act like a button with a different sprite for on and off states
/// </summary>
public class MMDebugMenuSpriteReplace : MonoBehaviour
{
/// the sprite to use when in the "on" state
public Sprite OnSprite;
/// the sprite to use when in the "off" state
public Sprite OffSprite;
/// if this is true, the button will start if "on" state
public bool StartsOn = true;
/// the current state of the button
public bool CurrentValue { get { return (_image.sprite == OnSprite); } }
protected Image _image;
protected MMTouchButton _mmTouchButton;
/// <summary>
/// On Start we initialize our button
/// </summary>
protected virtual void Awake()
{
//Initialization ();
}
/// <summary>
/// On init, we grab our image component, and set our sprite in its initial state
/// </summary>
public virtual void Initialization()
{
_image = this.gameObject.GetComponent<Image> ();
_mmTouchButton = this.gameObject.GetComponent<MMTouchButton> ();
if (_mmTouchButton != null)
{
_mmTouchButton.ReturnToInitialSpriteAutomatically = false;
}
if (_image == null) { return; }
if ((OnSprite == null) || (OffSprite == null)) { return; }
if (StartsOn)
{
_image.sprite = OnSprite;
}
else
{
_image.sprite = OffSprite;
}
}
/// <summary>
/// A public method to change the sprite
/// </summary>
public virtual void Swap()
{
if (_image.sprite != OnSprite)
{
SwitchToOnSprite ();
}
else
{
SwitchToOffSprite ();
}
}
/// <summary>
/// a public method to switch to off sprite directly
/// </summary>
public virtual void SwitchToOffSprite()
{
if (_image == null) { return; }
if (OffSprite == null) { return; }
SpriteOff ();
}
/// <summary>
/// sets the image's sprite to off
/// </summary>
protected virtual void SpriteOff()
{
_image.sprite = OffSprite;
}
/// <summary>
/// a public method to switch to on sprite directly
/// </summary>
public virtual void SwitchToOnSprite()
{
if (_image == null) { return; }
if (OnSprite == null) { return; }
SpriteOn ();
}
/// <summary>
/// sets the image's sprite to on
/// </summary>
protected virtual void SpriteOn()
{
_image.sprite = OnSprite;
}
}
}

View File

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

View File

@@ -0,0 +1,109 @@
using UnityEngine;
using System.Collections;
using System;
using MoreMountains.Tools;
using UnityEngine.UI;
using System.Collections.Generic;
using UnityEngine.Events;
namespace MoreMountains.Tools
{
/// <summary>
/// A component to handle switches
/// </summary>
public class MMDebugMenuSwitch : MMTouchButton
{
[Header("Switch")]
/// a SpriteReplace to represent the switch knob
public MMDebugMenuSpriteReplace SwitchKnob;
/// the possible states of the switch
[MMReadOnly]
public bool SwitchState;
/// the state the switch should start in
public bool InitialState = false;
[Header("Binding")]
/// the methods to call when the switch is turned on
public UnityEvent OnSwitchOn;
/// the methods to call when the switch is turned off
public UnityEvent OnSwitchOff;
/// the methods to call when the switch is turned off
public UnityEvent<bool> OnSwitchToggle;
/// <summary>
/// On init, we set our current switch state
/// </summary>
protected override void Initialization()
{
base.Initialization ();
SwitchState = InitialState;
InitializeState ();
SwitchKnob.Initialization();
if (InitialState)
{
SwitchKnob.SwitchToOnSprite();
}
else
{
SwitchKnob.SwitchToOffSprite();
}
}
public virtual void InitializeState()
{
/*if (CurrentSwitchState == SwitchStates.Left)
{
_animator?.Play ("RollLeft");
}
else
{
_animator?.Play ("RollRight");
}*/
}
public virtual void SetTrue()
{
SwitchState = true;
if (_animator != null)
{
_animator.SetTrigger("Right");
}
SwitchKnob.SwitchToOnSprite();
if (OnSwitchOn != null)
{
OnSwitchOn.Invoke();
}
}
public virtual void SetFalse()
{
SwitchState = false;
if (_animator != null)
{
_animator.SetTrigger("Left");
}
SwitchKnob.SwitchToOffSprite();
if (OnSwitchOff != null)
{
OnSwitchOff.Invoke();
}
}
/// <summary>
/// Use this method to go from one state to the other
/// </summary>
public virtual void ToggleState()
{
if (SwitchState == false)
{
SetTrue();
}
else
{
SetFalse();
}
OnSwitchToggle?.Invoke(SwitchState);
}
}
}

View File

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