/// <summary> /// /// </summary> /// <param name="info"></param> void SetupUI(bl_SceneLoaderInfo info) { if (BackgroundImage != null && useBackgrounds) { if (info.Backgrounds.Length > 1) { cacheBackgrounds.AddRange(info.Backgrounds); StartCoroutine(BackgroundTransition()); BackgroundImage.color = Color.white; } else if (info.Backgrounds != null && info.Backgrounds.Length > 0) { BackgroundImage.sprite = info.Backgrounds[0]; BackgroundImage.color = Color.white; } } if (SceneNameText != null) { SceneNameText.text = info.DisplayName; } if (DescriptionText != null) { if (ShowDescription) { DescriptionText.text = info.Description; } else { DescriptionText.text = string.Empty; } } if (LoadBarSlider != null) { LoadBarSlider.value = 0; } if (ProgressText != null) { ProgressText.text = string.Format(LoadingTextFormat, 0); } if (Manager.HasTips && TipText != null) { if (RandomTips) { CurrentTip = Random.Range(0, cacheTips.Count); TipText.text = cacheTips[CurrentTip]; } else { TipText.text = cacheTips[0]; } StartCoroutine(TipsLoop()); } //Show all UI RootAlpha.alpha = 0; RootUI.SetActive(true); //start audio loop Source.Play(); StartCoroutine(FadeAudio(true)); }
/// <summary> /// /// </summary> static void Setup() { bl_SceneLoaderManager sm = Resources.Load("SceneLoaderManager", typeof(bl_SceneLoaderManager)) as bl_SceneLoaderManager; if (sm == null) { Debug.Log("Can't load scenes"); return; } string[] allscenes = SceneNames(); List <bl_SceneLoaderInfo> scenes = new List <bl_SceneLoaderInfo>(); scenes.AddRange(sm.List.ToArray()); for (int i = 0; i < allscenes.Length; i++) { if (scenes.Exists(x => x.SceneName == allscenes[i])) { continue; } bl_SceneLoaderInfo info = new bl_SceneLoaderInfo(); info.SceneName = allscenes[i]; info.DisplayName = allscenes[i]; sm.List.Add(info); } Debug.Log("Scenes setup with success!"); Selection.objects = new UnityEngine.Object[] { sm }; EditorGUIUtility.PingObject(sm); }
/// <summary> /// /// </summary> public void LoadLevel(string level) { bl_SceneLoaderInfo sli = Manager.GetSceneInfo(level); if (sli == null) { return; } SetupUI(sli); StartCoroutine(StartAsyncOperation(sli.SceneName)); }
/// <summary> /// /// </summary> public void LoadLevel(string level) { CurrentLoadLevel = Manager.GetSceneInfo(level); if (CurrentLoadLevel == null) { return; } SetupUI(CurrentLoadLevel); StartCoroutine(StartAsyncOperation(CurrentLoadLevel.SceneName)); if (CurrentLoadLevel.LoadingType == LoadingType.Fake) { StartCoroutine(StartFakeLoading()); } }
/// <summary> /// Start to loading a scene /// </summary> /// <param name="level">The scene name</param> public void LoadLevel(string level) { //get the scene info from the SceneLoaderManager CurrentLoadLevel = Manager.GetSceneInfo(level); if (CurrentLoadLevel == null) { return; } //Setup the UI with the scene info ScreenUI.SetupUIForScene(CurrentLoadLevel); //start load the scene asynchronously doesn't matter if use fake time StartCoroutine(DoAsyncOperation(CurrentLoadLevel.SceneName)); //if fake time is used, don't load the scene until the fake time passed if (CurrentLoadLevel.LoadingType == LoadingType.Fake) { StartCoroutine(StartFakeLoading()); } }