| | |
| | | LoadingWin loadingWin = await UIManager.Instance.OpenWindowAsync<LoadingWin>();
|
| | | InitLoadingWinData(loadingWin);
|
| | |
|
| | | // Phase 1 (0% ~ 30%): YooAsset resource preload
|
| | | if (AssetSource.isUseAssetBundle)
|
| | | {
|
| | | loadingWin.SetProgress(0.05f);
|
| | | await YooAssetService.Instance.LoadAllAssetsAsync<UnityEngine.Object>("Assets/ResourcesOut/Scenes/Login");
|
| | | loadingWin.SetProgress(0.3f);
|
| | | }
|
| | |
|
| | | // Phase 2 (30% ~ 60%): Scene loading
|
| | | // Phase 1 (0% ~ 60%): Scene loading
|
| | | AsyncOperation asyncOperation = SceneManager.LoadSceneAsync("Login");
|
| | | asyncOperation.allowSceneActivation = false;
|
| | |
|
| | |
| | | {
|
| | | asyncOperation.allowSceneActivation = true;
|
| | | }
|
| | | loadingWin.SetProgress(0.3f + asyncOperation.progress * 0.3f);
|
| | | loadingWin.SetProgress(asyncOperation.progress * 0.5f);
|
| | | await UniTask.Yield();
|
| | | }
|
| | |
|
| | | // Phase 3 (60% ~ 100%): Manager initialization
|
| | | await WaitForManagerProgress(loadingWin, 0.6f, 1.0f,
|
| | | // Phase 2 (50% ~ 100%): Manager initialization
|
| | | await WaitForManagerProgress(loadingWin, 0.5f, 1.0f,
|
| | | ConfigManager.Instance.GetLoadingProgress, Main.InitManagers);
|
| | |
|
| | | loadingWin.SetProgress(1f, true);
|
| | |
| | |
|
| | | currentStage = StageName.Login;
|
| | |
|
| | | UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().Forget();
|
| | | UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
|
| | | UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().ContinueWith(s => {
|
| | | UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
|
| | | DumpLoginSceneDiagnostics("ToLoginScene open triggered").ContinueWith(() => {
|
| | | if (VersionUtility.Instance.NeedDownAsset() && !AssetVersionUtility.hasDownLoadFullAsset)
|
| | | {
|
| | | DownloadHotMgr.Instance.ClearDownloadCache();
|
| | | InGameDownLoad.Instance.inGameDownLoadAllow = true;
|
| | | InGameDownLoad.Instance.TryDownLoad(InGameDownLoad.Dominant.None);
|
| | | }
|
| | | }).Forget();
|
| | | }).Forget();
|
| | |
|
| | | if (VersionUtility.Instance.NeedDownAsset() && !AssetVersionUtility.hasDownLoadFullAsset)
|
| | | {
|
| | | DownloadHotMgr.Instance.ClearDownloadCache();
|
| | | InGameDownLoad.Instance.inGameDownLoadAllow = true;
|
| | | InGameDownLoad.Instance.TryDownLoad(InGameDownLoad.Dominant.None);
|
| | | }
|
| | |
|
| | |
|
| | | }
|
| | |
|
| | | // 返回登录界面 如断线
|
| | | public void ReturnToLoginScene()
|
| | | public async UniTaskVoid ReturnToLoginScene()
|
| | | {
|
| | | UIManager.Instance.DestroyAllUI();
|
| | |
|
| | | SceneManager.LoadSceneAsync("Login");
|
| | | await SceneManager.LoadSceneAsync("Login");
|
| | |
|
| | | Main.OnSwitchToLoginScene();
|
| | | currentStage = StageName.Login;
|
| | | UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().Forget();
|
| | | UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
|
| | |
|
| | | if (ServerForceExitHintWin.reason != 0)
|
| | | {
|
| | | UIManager.Instance.OpenWindowAsync<ServerForceExitHintWin>().Forget();
|
| | | }
|
| | | // SoundPlayer.Instance.StopBackGroundMusic();
|
| | | SoundPlayer.Instance.PlayLoginMusic();
|
| | | UIManager.Instance.OpenWindowAsync<LaunchBackGroundWin>().ContinueWith(s => {
|
| | | UIManager.Instance.OpenWindowAsync<LoginWin>().Forget();
|
| | | DumpLoginSceneDiagnostics("ToLoginScene open triggered").ContinueWith(() => {
|
| | | if (ServerForceExitHintWin.reason != 0)
|
| | | {
|
| | | UIManager.Instance.OpenWindowAsync<ServerForceExitHintWin>().Forget();
|
| | | }
|
| | | // SoundPlayer.Instance.StopBackGroundMusic();
|
| | | SoundPlayer.Instance.PlayLoginMusic();
|
| | | }).Forget();
|
| | | }).Forget();
|
| | | }
|
| | |
|
| | | private async UniTask DumpLoginSceneDiagnostics(string context)
|
| | | {
|
| | | await UniTask.DelayFrame(2);
|
| | | UIManager.Instance.DumpUIDiagnostics(context + " after 2 frames");
|
| | | await UniTask.DelayFrame(30);
|
| | | UIManager.Instance.DumpUIDiagnostics(context + " after 32 frames");
|
| | | }
|
| | |
|
| | | protected float GetManagerRequestDataProgress()
|
| | |
| | | LoadingWin loadingWin = await UIManager.Instance.OpenWindowAsync<LoadingWin>();
|
| | | InitLoadingWinData(loadingWin);
|
| | |
|
| | | // Phase 1 (0% ~ 30%): YooAsset resource preload
|
| | | if (AssetSource.isUseAssetBundle)
|
| | | {
|
| | | loadingWin.SetProgress(0.05f);
|
| | | await YooAssetService.Instance.LoadAllAssetsAsync<UnityEngine.Object>("Assets/ResourcesOut/Scenes/Game");
|
| | | loadingWin.SetProgress(0.3f);
|
| | | }
|
| | |
|
| | | SoundPlayer.Instance.StopBackGroundMusic();
|
| | |
|
| | | // Phase 2 (30% ~ 60%): Scene loading
|
| | | // Phase 1 (0% ~ 60%): Scene loading
|
| | | AsyncOperation asyncOperation = SceneManager.LoadSceneAsync("Game");
|
| | | asyncOperation.allowSceneActivation = false;
|
| | |
|
| | |
| | | {
|
| | | asyncOperation.allowSceneActivation = true;
|
| | | }
|
| | | loadingWin.SetProgress(0.3f + asyncOperation.progress * 0.3f);
|
| | | loadingWin.SetProgress(asyncOperation.progress * 0.5f);
|
| | | await UniTask.Yield();
|
| | | }
|
| | |
|
| | | // Phase 3 (60% ~ 100%): Manager data ready
|
| | | await WaitForManagerProgress(loadingWin, 0.6f, 1.0f,
|
| | | // Phase 2 (50% ~ 100%): Manager data ready
|
| | | await WaitForManagerProgress(loadingWin, 0.5f, 1.0f,
|
| | | () => (DTC0403_tagPlayerLoginLoadOK.finishedLogin ? .5f : 0f) + GetManagerRequestDataProgress() * .5f);
|
| | |
|
| | | loadingWin.SetProgress(1f, true);
|