Project_WL/Assets/Script/UI/ETC/LoadingUI.cs

35 lines
804 B
C#
Raw Normal View History

2024-12-15 01:39:39 +00:00
using System.Collections;
using TMPro;
2024-12-15 01:39:39 +00:00
using UnityEngine;
public class LoadingUI : MyCoroutine
{
public static LoadingUI Ins;
public GameObject go;
public TextMeshProUGUI m_text;
private string baseText = "Loading";
private int dotCount = 0;
2024-12-15 01:39:39 +00:00
void Awake() { Ins = this; }
public void Start_Loading()
2024-12-15 01:39:39 +00:00
{
go.SetActive(true);
StartCoroutine(AnimateLoadingText());
2024-12-15 01:39:39 +00:00
}
public void End_Loading()
2024-12-15 01:39:39 +00:00
{
go.SetActive(false);
2024-12-15 01:39:39 +00:00
}
IEnumerator AnimateLoadingText()
2024-12-15 01:39:39 +00:00
{
while (true)
2024-12-15 01:39:39 +00:00
{
m_text.text = baseText + new string('.', dotCount);
dotCount = (dotCount + 1) % 4; // 0 → 1 → 2 → 3 → 0 순환
yield return new WaitForSeconds(0.5f); // 0.5초 간격으로 변경
2024-12-15 01:39:39 +00:00
}
}
}