public static void ShowScreen() { LoadingScreenManager instance = Instance; GameObject loadingScreen = instance.loadingScreen; CanvasGroup cg = instance.loadingScreen.GetComponent <CanvasGroup>(); if (instance.transitions != null) { LeanTween.cancel(instance.transitions.uniqueId); } instance.transitions = LeanTween.alphaCanvas(cg, 0f, 0.5f).setOnComplete(_ => loadingScreen.SetActive(false)); }
public static void HideScreen() { LoadingScreenManager instance = Instance; GameObject loadingScreen = instance.loadingScreen; CanvasGroup cg = instance.loadingScreen.GetComponent <CanvasGroup>(); loadingScreen.SetActive(true); if (instance.transitions != null) { LeanTween.cancel(instance.transitions.uniqueId); } instance.transitions = LeanTween.alphaCanvas(cg, 1f, 0.5f); }
IEnumerator GetLoadingProgress(Action onCompleteCallBack = null) { LoadingScreenManager.HideScreen(); yield return(new WaitForEndOfFrame()); foreach (var i in loadingProgressList) { while (!i.isDone) { yield return(null); } } LoadingScreenManager.ShowScreen(); OnEndSceneChange?.Invoke(CurrentScene); onCompleteCallBack?.Invoke(); }
private void Awake() => Instance = this;