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

57 lines
820 B
C#

using System;
using UnityEngine;
using UnityEngine.UI;
public class RefreshGuiText : MonoBehaviour
{
[HideInInspector]
public Text text;
public bool toUpper;
public bool toUpperInvariant;
public bool toLower;
public bool checkPlatform;
private void OnEnable()
{
Refresh();
}
public void LanguageChanged()
{
Refresh();
}
public void Refresh()
{
if (!text)
{
text = GetComponent<Text>();
}
if (toUpper)
{
text.text = text.text.ToUpper();
}
if (toLower)
{
text.text = text.text.ToLower();
}
if (toUpperInvariant)
{
text.text = text.text[0].ToString().ToUpper() + text.text.Substring(1);
}
if (checkPlatform)
{
string newText = text.text;
text.text = newText;
LeanTween.delayedCall(1f, (Action)delegate
{
text.text = newText;
});
}
}
}