From 3b2a6bb9047cfce9f501593b3669a9c1af6c5df4 Mon Sep 17 00:00:00 2001
From: lcy <1459594991@qq.com>
Date: 星期三, 05 十一月 2025 17:40:23 +0800
Subject: [PATCH] 130 战斗修改回合样式

---
 Main/Manager/StageManager.cs |   72 +++++++++++++++++++++++++++++++-----
 1 files changed, 62 insertions(+), 10 deletions(-)

diff --git a/Main/Manager/StageManager.cs b/Main/Manager/StageManager.cs
index 04ddcc0..4ab8dc0 100644
--- a/Main/Manager/StageManager.cs
+++ b/Main/Manager/StageManager.cs
@@ -13,36 +13,62 @@
 {
     public StageName currentStage;
 
-    public Action AfterEnterGame;
+    public Action AfterLoadingGameScene;
 
-    public Action BeforeEnterGame;
+    public Action BeforeLoadingGameScene;
 
     // public Action OnSwitchAccount;
+    private LaunchWinData launchWinData = null;
 
     public void Init()
     {
-
+        UIManager.Instance.OnCloseWindow += OnCloseWindow;
     }
 
     public void Release()
     {
-        AfterEnterGame = null;
-        BeforeEnterGame = null;
+        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()
@@ -70,19 +96,25 @@
     public async UniTaskVoid ToGameScene()
     {
         UIManager.Instance.DestroyAllUI();
-
-        AfterEnterGame?.Invoke();
+        
+        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;
 
-        BeforeEnterGame?.Invoke();
+        Main.OnEnterGameScene();
+
+        AfterLoadingGameScene?.Invoke();
 
         UIManager.Instance.OpenWindow<MainWin>();
     }
@@ -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