2025-10-03 00:31:34 +08:00
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace UI
|
|
|
|
|
{
|
2025-10-10 14:08:23 +08:00
|
|
|
public class WaitStartUI : MonoBehaviour
|
2025-10-03 00:31:34 +08:00
|
|
|
{
|
|
|
|
|
public TMP_Text text;
|
|
|
|
|
public string baseText;
|
2025-10-10 14:08:23 +08:00
|
|
|
|
2025-10-03 00:31:34 +08:00
|
|
|
public int dotCount = 3;
|
2025-10-10 14:08:23 +08:00
|
|
|
public int dotCounter;
|
2025-10-03 00:31:34 +08:00
|
|
|
|
|
|
|
|
public float updateTime = 1;
|
2025-10-10 14:08:23 +08:00
|
|
|
private float timer;
|
|
|
|
|
|
|
|
|
|
private void Awake()
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(true);
|
|
|
|
|
}
|
2025-10-03 00:31:34 +08:00
|
|
|
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
2025-10-10 14:08:23 +08:00
|
|
|
if (string.IsNullOrEmpty(baseText))
|
2025-10-03 00:31:34 +08:00
|
|
|
baseText = text.text;
|
|
|
|
|
else
|
|
|
|
|
text.text = baseText;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void Update()
|
|
|
|
|
{
|
2025-10-10 14:08:23 +08:00
|
|
|
timer += Time.deltaTime;
|
|
|
|
|
if (timer >= updateTime)
|
2025-10-03 00:31:34 +08:00
|
|
|
{
|
2025-10-10 14:08:23 +08:00
|
|
|
timer -= updateTime;
|
2025-10-03 00:31:34 +08:00
|
|
|
var dots = "";
|
2025-10-10 14:08:23 +08:00
|
|
|
for (var i = 0; i < dotCounter; i++) dots += ".";
|
2025-10-03 00:31:34 +08:00
|
|
|
text.text = baseText + dots;
|
|
|
|
|
dotCounter += 1;
|
2025-10-10 14:08:23 +08:00
|
|
|
if (dotCounter > dotCount) dotCounter = 0;
|
2025-10-03 00:31:34 +08:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void Hide()
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|