using System; using Plugins.CxShine.page; using Unity.VisualScripting; using UnityEngine; using UnityEngine.UI; namespace UI.Loading { public class LoadingComp : MonoBehaviour { public GameObject CenterRotate; public Text WaitingText; public string[] strs; private void Start() { strs = new[] { "Waiting", "Waiting.", "Waiting..", "Waiting..." }; initAutoClose(12000000); } public float interval = 0.01f; private int currentIndex; private float lastSpriteChangeTime; private float currentTime; private float closeTime; private void Update() { currentTime = Time.time; float elapsedTime = Time.time - lastSpriteChangeTime; if (elapsedTime > interval) { currentIndex = (currentIndex + 1) % strs.Length; lastSpriteChangeTime = currentTime; } WaitingText.text = strs[currentIndex]; if (Time.time >= closeTime) { gameObject.GetComponent().A__ClosePage(); } } private void LateUpdate() { } public void A__ClickClose() { closeTime = Time.time; } public void initAutoClose(int time) { closeTime = Time.time + time; } } }