1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- 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<PageComp>().A__ClosePage();
- }
- }
- private void LateUpdate()
- {
- }
- public void A__ClickClose()
- {
-
- closeTime = Time.time;
- }
- public void initAutoClose(int time)
- {
- closeTime = Time.time + time;
- }
- }
- }
|