From ed98029a88cd89702980ac7c40b711afddc5aeb2 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 20 十一月 2025 14:44:59 +0800
Subject: [PATCH] Merge branch 'master' of http://mobile.secondworld.net.cn:10010/r/Project_SG_scripts

---
 Main/Manager/StageManager.cs |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/Main/Manager/StageManager.cs b/Main/Manager/StageManager.cs
index 9451f58..4ab8dc0 100644
--- a/Main/Manager/StageManager.cs
+++ b/Main/Manager/StageManager.cs
@@ -18,31 +18,57 @@
     public Action BeforeLoadingGameScene;
 
     // public Action OnSwitchAccount;
+    private LaunchWinData launchWinData = null;
 
     public void Init()
     {
-
+        UIManager.Instance.OnCloseWindow += OnCloseWindow;
     }
 
     public void Release()
     {
         AfterLoadingGameScene = null;
         BeforeLoadingGameScene = null;
+        UIManager.Instance.OnCloseWindow -= OnCloseWindow;
     }
 
     public async UniTaskVoid ToLoginScene()
     {
         UIManager.Instance.DestroyAllUI();
 
+        if (AssetSource.isUseAssetBundle)
+        {
+            AssetBundleUtility.Instance.Sync_LoadAll("maps/Login");
+        }
+
         AsyncOperation asyncOperation = SceneManager.LoadSceneAsync("Login");
 
-        await OnLoading(asyncOperation, ConfigManager.Instance.GetLoadingProgress);
+        await OnLoading(asyncOperation, ConfigManager.Instance.GetLoadingProgress, Main.InitManagers);
 
         Main.OnSwitchToLoginScene();
 
         currentStage = StageName.Login;
 
+        UIManager.Instance.OpenWindow<LaunchBackGroundWin>();
         UIManager.Instance.OpenWindow<LoginWin>();
+    }
+
+    // 杩斿洖鐧诲綍鐣岄潰 濡傛柇绾�
+    public void ReturnToLoginScene()
+    {
+        UIManager.Instance.DestroyAllUI();
+
+        SceneManager.LoadSceneAsync("Login");
+
+        Main.OnSwitchToLoginScene();
+        currentStage = StageName.Login;
+        UIManager.Instance.OpenWindow<LaunchBackGroundWin>();
+        UIManager.Instance.OpenWindow<LoginWin>();
+
+        if (ServerForceExitHintWin.reason != 0)
+        {
+            UIManager.Instance.OpenWindow<ServerForceExitHintWin>();
+        }
     }
 
     protected float GetManagerRequestDataProgress()
@@ -74,13 +100,19 @@
         BeforeLoadingGameScene?.Invoke();
 
         // ResManager.Instance.PrewarmResources();
+        if (AssetSource.isUseAssetBundle)
+        {
+            AssetBundleUtility.Instance.Sync_LoadAll("maps/Game");
+        }
 
         AsyncOperation asyncOperation = SceneManager.LoadSceneAsync("Game");
 
-        await OnLoading(asyncOperation, GetManagerRequestDataProgress);
+        await OnLoading(asyncOperation, () => (DTC0403_tagPlayerLoginLoadOK.finishedLogin ? .5f : 0f) + GetManagerRequestDataProgress() * .5f);
 
         //  鍔犺浇鍒濆鍖栨暟鎹畬鎴�
         currentStage = StageName.Game;
+
+        Main.OnEnterGameScene();
 
         AfterLoadingGameScene?.Invoke();
 
@@ -92,6 +124,18 @@
         asyncOperation.allowSceneActivation = false;
 
         LoadingWin loadingWin = UIManager.Instance.OpenWindow<LoadingWin>();
+
+        LaunchWin launchWin = UIManager.Instance.GetUI<LaunchWin>();
+        if (null != launchWin && launchWin.IsActive() && launchWinData == null)
+        {
+            launchWinData = launchWin.GetData();
+        }
+
+        if (null != launchWinData)
+        {
+            loadingWin.SetData(launchWinData);
+            launchWinData = null;
+        }
 
         while (!asyncOperation.isDone)
         {
@@ -127,4 +171,12 @@
 
         loadingWin.CloseWindow();
     }
+
+    private void OnCloseWindow(UIBase closeUI)
+    {
+        if (closeUI is LaunchWin)
+        {
+            launchWinData = (closeUI as LaunchWin).GetData();
+        }
+    }
 }
\ No newline at end of file

--
Gitblit v1.8.0