static async Task Loading(Type sceneType) { string sceneName = sceneType.Name.Replace("Scene", ""); if (string.IsNullOrEmpty(sceneName)) { GameLog.LogErrorFormat("Failed to load scene {0}({1})", sceneName, sceneType.Name); onSceneLoaded = null; return; } await ScreenFader.AsyncFade(true); if (null != current) { current.OnDestroy(); } current = null; // UI.Instance.ClosePanelsWhenSceneDestroy(); await SceneLoader.AsyncLoad(sceneName); current = (IScene)Activator.CreateInstance(sceneType); current.Start(); if (null != onSceneLoaded) { onSceneLoaded(); } onSceneLoaded = null; await ScreenFader.AsyncFade(false); }
async void AsyncLoad() { loading = true; try { await SceneLoader.AsyncLoad( dropdown.captionText.text, v => progress.text = string.Format("Loading {0:P2}", v)); current.text = SceneResource.Current.Path; } catch (Exception e) { ResLog.LogException(e); } loading = false; }