1using System.Collections;
2using System.Collections.Generic;
10 [SerializeField]
private Text loadingTitle;
11 [SerializeField]
private Text loadingText;
12 [SerializeField]
private RectTransform loadingImg;
13 [SerializeField]
private GameObject loadingWindow;
14 [SerializeField]
private CanvasGroup cg;
20 private Coroutine delayedHide, actualHide;
23 internal bool FilesLoaded =
false;
27 if (loadingText ==
null)
28 loadingText = gameObject.DemandComponent<Text>();
29 if (loadingTitle ==
null)
30 loadingTitle = gameObject.DemandComponent<Text>();
31 if (loadingWindow ==
null)
32 loadingWindow =
new GameObject(
"temp");
37 private void OnEnable()
44 if (actualHide !=
null)
46 StopCoroutine(actualHide);
51 cg.blocksRaycasts =
true;
52 cg.interactable =
true;
54 loadingWindow.SetActive(
true);
56#if !UNITY_WEBGL && TRILIB_2
57 if (delayedHide !=
null)
58 StopCoroutine(delayedHide);
64 if (actualHide !=
null)
66 StopCoroutine(actualHide);
68 actualHide = StartCoroutine(realHide(ignoreDelayedEvents));
71 IEnumerator realHide(
bool ignoreDelayedEvents =
false)
73 yield
return new WaitForSeconds(2f);
79 cg.blocksRaycasts =
false;
80 cg.interactable =
false;
83#if !UNITY_WEBGL && TRILIB_2
84 if (delayedHide !=
null)
85 StopCoroutine(delayedHide);
86 delayedHide = StartCoroutine(DelayedHide());
88 loadingWindow.SetActive(
false);
90 if (!ignoreDelayedEvents)
92 StartCoroutine(DelayedEvent());
97 private IEnumerator DelayedHide()
99 yield
return new WaitForSeconds(2.5f);
100 loadingWindow.SetActive(
false);
103 StartCoroutine(DelayedEvent());
108 loadingText.text =
Macro.
T(
"SYNCING");
109 loadingTitle.text =
Macro.
T(
"SYNCING");
113 loadingText.text =
Macro.
T(
"CONNECTING");
114 loadingTitle.text =
Macro.
T(
"CONNECTING");
119 loadingText.text =
Macro.
T(
"LOADING");
120 loadingTitle.text =
Macro.
T(
"LOADING");
123 IEnumerator DelayedEvent()
125 yield
return new WaitForSeconds(2.5f);
129 private void FixedUpdate()
135 if (!loadingImg)
return;
139 timeout -= Time.fixedDeltaTime;
UnityEvent onDelayedCompleated
void HideWindow(bool ignoreDelayedEvents=false)
static string T(string key)