Files
UltimateFishing/Assets/Scripts/Assembly-CSharp/TemperatureSlider.cs
2026-02-21 16:45:37 +08:00

43 lines
1.0 KiB
C#

using I2.Loc;
using UnityEngine;
using UnityEngine.UI;
public class TemperatureSlider : MonoBehaviour
{
public Text text;
private Slider slider;
private void OnEnable()
{
slider = GetComponent<Slider>();
UpdateValue();
}
public void UpdateValue()
{
if ((bool)GlobalSettings.Instance)
{
GlobalSettings.Instance.weatherSettings.temperature = slider.value;
}
string text = string.Empty;
if (slider.value == 0f)
{
text = LocalizationManager.GetTermTranslation("GUI/WEATHER_TEMPERATURE_LOW");
}
else if (slider.value == 1f)
{
text = LocalizationManager.GetTermTranslation("GUI/WEATHER_TEMPERATURE_AVERAGE");
}
else if (slider.value == 2f)
{
text = LocalizationManager.GetTermTranslation("GUI/WEATHER_TEMPERATURE_HIGH");
}
if ((bool)this.text)
{
this.text.text = LocalizationManager.GetTermTranslation("GUI/WEATHER_TEMPERATURE") + ": " + text;
}
this.text.color = new Color(this.text.color.r, this.text.color.g, this.text.color.b, (!slider.interactable) ? slider.colors.disabledColor.a : 1f);
}
}