public void Set(LoadingScreenEvent e) { imageComponent.sprite = e.image; imageComponent.enabled = imageComponent.sprite != null; titleTextComponent.text = e.title; titleTextComponent.enabled = titleTextComponent.text.IsValid(); descriptionTextComponent.text = e.description; descriptionTextComponent.enabled = descriptionTextComponent.text.IsValid(); }
//------------------------------------------------------------------------/ // Procedures: Loading Screen //------------------------------------------------------------------------/ private void SetLoadingScreen(LoadingScreenEvent e) { IEnumerator loadingRoutine() { // Wait a frame yield return(new WaitForEndOfFrame()); // Assign assets loadingScreen.Set(e); loadingScreen.Show(); yield return(new WaitForSeconds(e.speed)); void onContinue() { // If a prompt is needed to continue past the screen, set it if (e.promptContinue) { continueInputEnabled = true; loadingScreen.continuePromptDisplay.CrossFade(true); } else { Continue(); } } // If progress is required... if (e.progress && loadingScreen.progressBar != null) { loadingScreen.progressBar.ResetProgress(); loadingScreen.progressBar.Toggle(true); // If a progress callback is provided, keep calling it to update the current progress if (e.progressFunction != null) { } // If no progress callback is provided, artificially set the progress by min value else { loadingScreen.progressBar.UpdateProgress(1f, e.progressDuration, onContinue); } } else { onContinue(); } } this.StartCoroutine(loadingRoutine(), "Loading Screen"); }
private void OnLoadingScreenEvent(LoadingScreenEvent e) { ProcessTransitionEvent(e, () => SetLoadingScreen(e), HideLoadingScreen); }