Files
Continentis/Assets/OtherPlugins/Modern UI Pack/Scripts/Slider/RangeMinSlider.cs

38 lines
961 B
C#
Raw Normal View History

2026-03-20 11:56:50 -04:00
using TMPro;
using UnityEngine;
2025-10-03 00:02:43 -04:00
using UnityEngine.UI;
namespace Michsky.MUIP
{
public class RangeMinSlider : Slider
{
2026-03-20 11:56:50 -04:00
[Header("RESOURCES")] public RangeMaxSlider maxSlider;
2025-10-03 00:02:43 -04:00
public TextMeshProUGUI label;
public string numberFormat;
protected override void Set(float input, bool sendCallback)
{
if (maxSlider == null)
maxSlider = transform.parent.Find("Max Slider").GetComponent<RangeMaxSlider>();
2026-03-20 11:56:50 -04:00
var newValue = input;
if (wholeNumbers)
2025-10-03 00:02:43 -04:00
newValue = Mathf.Round(newValue);
if (newValue >= maxSlider.realValue && maxSlider.realValue != maxSlider.minValue)
return;
if (label != null)
label.text = newValue.ToString(numberFormat);
2026-03-20 11:56:50 -04:00
2025-10-03 00:02:43 -04:00
base.Set(input, sendCallback);
}
public void Refresh(float input)
{
Set(input, false);
}
}
}