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

59 lines
1.0 KiB
C#

using BitStrap;
using UnityEngine;
using UnityEngine.UI;
public class UpdateFont : MonoBehaviour
{
public bool onUpdate;
public bool onStart;
public bool allChildren;
public Font font;
public GUIManager.FontType fontType;
public void Start()
{
if (onStart)
{
UpdateFonts();
}
}
private void Update()
{
}
[Button]
public void UpdateFonts()
{
if (this.font == null && GUIManager.Instance == null)
{
return;
}
Font font = ((!this.font) ? GUIManager.Instance.GetFont(fontType) : this.font);
if (allChildren)
{
Text[] componentsInChildren = GetComponentsInChildren<Text>(true);
Text[] array = componentsInChildren;
foreach (Text text in array)
{
if (!text.GetComponent<UpdateFont>() || !text.GetComponent<UpdateFont>().enabled)
{
text.font = font;
}
}
}
else
{
GetComponent<Text>().font = font;
if ((bool)GUIManager.Instance && GUIManager.Instance.GetFontToUpper(fontType))
{
GetComponent<Text>().text = GetComponent<Text>().text.ToUpper();
}
}
}
}