From d68f2c0be6edf436b6033773147588b7574a93b0 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期一, 09 六月 2025 16:25:45 +0800
Subject: [PATCH] 18 子 2D卡牌客户端搭建 / 2D卡牌客户端搭建 启动LoadingWin的修改

---
 Main/System/Launch/LoadingWin.cs                 |  112 +++++++++++++++++++++++----
 Main/Manager/StageManager.cs                     |   24 +++++
 Main/ResModule/BuiltInLoader.cs                  |    1 
 Main/System/Launch/LaunchWin.cs                  |   17 +++
 Main/System/Launch/LaunchWinData.cs.meta         |   11 ++
 Main/Main.cs                                     |    6 +
 Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs |    6 -
 Main/System/Launch/LaunchWinData.cs              |   13 +++
 8 files changed, 161 insertions(+), 29 deletions(-)

diff --git a/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs b/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
index 56b5677..3ce7dce 100644
--- a/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
+++ b/Main/Core/GameEngine/Launch/LaunchFadeOutTask.cs
@@ -20,11 +20,7 @@
         
         
 
-        var launchWin = UIManager.Instance.GetUI<LaunchWin>();
-        if (launchWin != null)
-        {
-            launchWin.FadeOut();
-        }
+
 
 
         // try
diff --git a/Main/Main.cs b/Main/Main.cs
index 1de4044..cd2b51a 100644
--- a/Main/Main.cs
+++ b/Main/Main.cs
@@ -19,7 +19,11 @@
     public static void Init()
     {
         Debug.Log("Main.Init() 琚皟鐢�");
-
+        var launchWin = UIManager.Instance.GetUI<LaunchWin>();
+        if (launchWin != null)
+        {
+            launchWin.FadeOut();
+        }
         SwitchToLoginScene();
     }
 
diff --git a/Main/Manager/StageManager.cs b/Main/Manager/StageManager.cs
index fa82c63..f7dbbc8 100644
--- a/Main/Manager/StageManager.cs
+++ b/Main/Manager/StageManager.cs
@@ -18,16 +18,18 @@
     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()
@@ -95,6 +97,18 @@
 
         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)
         {
             if (asyncOperation.progress >= 0.9f)
@@ -129,4 +143,12 @@
 
         loadingWin.CloseWindow();
     }
+
+    private void OnCloseWindow(UIBase closeUI)
+    {
+        if (closeUI is LaunchWin)
+        {
+            launchWinData = (closeUI as LaunchWin).GetData();
+        }
+    }
 }
\ No newline at end of file
diff --git a/Main/ResModule/BuiltInLoader.cs b/Main/ResModule/BuiltInLoader.cs
index a7eee09..8baa053 100644
--- a/Main/ResModule/BuiltInLoader.cs
+++ b/Main/ResModule/BuiltInLoader.cs
@@ -20,6 +20,7 @@
             if (excludePngs.Contains(StringUtility.Contact(name, SPRITE_EXTENSION)))
             {
                 var path = StringUtility.Contact("Assets/ResourcesOut/BuiltIn/Sprites/", name, SPRITE_EXTENSION);
+                path = System.Text.RegularExpressions.Regex.Replace(path, @"[\p{C}]", "");
                 sprite = UnityEditor.AssetDatabase.LoadAssetAtPath<Sprite>(path);
             }
             else
diff --git a/Main/System/Launch/LaunchWin.cs b/Main/System/Launch/LaunchWin.cs
index 94345bd..e850fd6 100644
--- a/Main/System/Launch/LaunchWin.cs
+++ b/Main/System/Launch/LaunchWin.cs
@@ -13,7 +13,7 @@
 
     public class LaunchWin : UIBase
     {
-        [SerializeField] UIAlphaTween m_AlphaTween;
+        // [SerializeField] UIAlphaTween m_AlphaTween;
         [SerializeField] Image m_BackGround;
         [SerializeField] RectTransform m_AndroidProgressContainer;
         [SerializeField] RectTransform m_NetworkContainer;
@@ -81,7 +81,7 @@
                 m_TotalProgressSlider.ResetValue(0f);
             }
 
-            m_AlphaTween.SetStartState();
+            // m_AlphaTween.SetStartState();
 
             m_BuildTime.text = VersionConfig.Get().debugVersion ? VersionConfig.Get().buildTime : "";
 
@@ -152,7 +152,8 @@
 
         public void FadeOut()
         {
-            m_AlphaTween.Play();
+            // m_AlphaTween.Play();
+            CloseWindow();
         }
 
         string GetLaunchStageDescription(LaunchStage _stage, int step)
@@ -289,6 +290,16 @@
             }
         }
 
+        public LaunchWinData GetData()
+        {
+            return new LaunchWinData(){
+                backGroundTimer = backGroundTimer,
+                backGroundIndex = backGroundIndex,
+                sprite = m_BackGround.overrideSprite,
+                sprites = backGrounds,
+            };
+        }
+
     }
 
 
diff --git a/Main/System/Launch/LaunchWinData.cs b/Main/System/Launch/LaunchWinData.cs
new file mode 100644
index 0000000..9b3b956
--- /dev/null
+++ b/Main/System/Launch/LaunchWinData.cs
@@ -0,0 +1,13 @@
+
+//	閲囬泦鐣岄潰鏁版嵁 缁橪oadingWin鐢� 鍋氳〃鐜颁竴鑷�
+using UnityEngine;
+using UnityEngine.UI;
+using System.Collections.Generic;
+
+public class LaunchWinData
+{
+    public float backGroundTimer;
+    public int backGroundIndex;
+    public Sprite sprite;
+    public List<Sprite> sprites;
+}
\ No newline at end of file
diff --git a/Main/System/Launch/LaunchWinData.cs.meta b/Main/System/Launch/LaunchWinData.cs.meta
new file mode 100644
index 0000000..ff033d8
--- /dev/null
+++ b/Main/System/Launch/LaunchWinData.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 18cd9b944777de14484346d7eeca334f
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 
diff --git a/Main/System/Launch/LoadingWin.cs b/Main/System/Launch/LoadingWin.cs
index c880bb3..9b13597 100644
--- a/Main/System/Launch/LoadingWin.cs
+++ b/Main/System/Launch/LoadingWin.cs
@@ -9,18 +9,50 @@
     protected int currentProgress = 0;
     protected int targetProgress = 0;
 
-    protected Text titleText;
-    protected Text tipsText;
-    protected Image progressBar;
-    protected Text progressText;
+    // [SerializeField] UIAlphaTween m_AlphaTween;
+    [SerializeField] Image m_BackGround;
+    [SerializeField] RectTransform m_AndroidProgressContainer;
+    [SerializeField] RectTransform m_NetworkContainer;
+    [SerializeField] SmoothSlider m_PartProgressSlider;
+    [SerializeField] SmoothSlider m_TotalProgressSlider;
+    [SerializeField] Text m_StageDescription;
+    [SerializeField] Text m_BuildTime;
+    [SerializeField] Text m_Version;
+    // [SerializeField] Button m_UserHelp;
+
+    protected List<Sprite> backGrounds = new List<Sprite>();
+
+    protected float backGroundTimer = 0f;
+    protected int backGroundIndex = 0;
 
     protected override void InitComponent()
     {
         base.InitComponent();
-        titleText = transform.Find("Text_Loading").GetComponent<Text>();
-        tipsText = transform.Find("Text_Tips").GetComponent<Text>();
-        progressBar = transform.Find("Img_Progress/Img_Foreground").GetComponent<Image>();
-        progressText = transform.Find("Text_Progress").GetComponent<Text>();
+
+        if (Application.isEditor)
+        {
+            if (m_BackGround.overrideSprite == null)
+            {
+                var sprite = BuiltInLoader.LoadSprite("Launch_1");
+                m_BackGround.overrideSprite = sprite;
+            }
+        }
+        else
+        {
+            if (backGrounds.Count <= 0)
+            {
+                for (var i = 0; i < 3; i++)
+                {
+                    var sprite = BuiltInLoader.LoadSprite(StringUtility.Contact("Launch_", i + 1));
+                    if (sprite != null)
+                    {
+                        backGrounds.Add(sprite);
+                    }
+                }
+
+                m_BackGround.overrideSprite = backGrounds[0];
+            }
+        }
     }
 
     protected override void OnPreOpen()
@@ -45,29 +77,71 @@
     {
         if (directly)
         {
-            currentProgress = targetProgress = (int)(value * 100);
+            currentProgress = targetProgress = Mathf.Min((int)(value * 100), 100);
             UpdateProgress();
         }
         else
         {
-            currentProgress = (int)(value * 100);
+            targetProgress = Mathf.Min((int)(value * 100), 100);
         }
-
-        
     }
 
     protected void UpdateProgress()
     {
-        progressText.text = currentProgress + "%";
-        progressBar.fillAmount = currentProgress / 100f;
-    }
-
-    protected void Update()
-    {
+        // Debug.LogErrorFormat("cur : {0}  /  target {1}", currentProgress, targetProgress);
         if (currentProgress < targetProgress)
         {
             currentProgress = (int)Mathf.Lerp(currentProgress, targetProgress, 0.1f);
-            UpdateProgress();
+            m_TotalProgressSlider.value = currentProgress / 100f;
+            m_PartProgressSlider.value = currentProgress / 100f;
         }
+        else
+        {
+            m_TotalProgressSlider.value = currentProgress / 100f;
+            m_PartProgressSlider.value = currentProgress / 100f;
+        }
+        CopiedLogic_UpdateProgress();
+    }
+
+    private void CopiedLogic_UpdateProgress()
+    {
+        //  鏆傜暀鎺ュ彛
+
+        //  濂藉儚閮戒笉搴旇鍦ㄨ繖閲屽啓涓滆タ浜�
+        //  m_TotalProgressSlider璺焟_PartProgressSlider閮芥湁鑷繁鏂扮殑閫昏緫
+        //  m_StageDescription鏈夊浐瀹氱殑鏂囧瓧
+
+        //  iOS濡傛灉涓嶆槸download閭d篃閮芥槸闅愯棌鐨� 杩欓噷鑲畾涓嶄細鏈塪ownload鐨� 鎵�浠ュ氨涓嶆惉浜�
+    }
+
+    protected void LateUpdate()
+    {
+        UpdateProgress();
+        CopiedLogic_LateUpdate();
+    }
+
+    private void CopiedLogic_LateUpdate()
+    {
+        backGroundTimer += Time.deltaTime;
+        if (backGroundTimer >= 3f)
+        {
+            backGroundTimer -= 3f;
+            if (backGrounds.Count > 1)
+            {
+                m_BackGround.overrideSprite = backGrounds[(++backGroundIndex) % backGrounds.Count];
+            }
+
+            //  鑰冭檻鍦ㄨ繖閲屽仛杩欎釜鎻忚堪鐨勫垏鎹� 鎴栬�呮牴鎹浘鐗囨潵鍋氭彁绀鸿瘝
+            // m_StageDescription.text = "";
+        }
+    }
+
+    public void SetData(LaunchWinData _launchWinData)
+    {
+        backGroundTimer = _launchWinData.backGroundTimer;
+        backGroundIndex = _launchWinData.backGroundIndex;
+        m_BackGround.overrideSprite = _launchWinData.sprite;
+        backGrounds = _launchWinData.sprites;
+        m_StageDescription.text = Language.GetFromLocal(44);//鏈�鍚嶤ompleted涓�瀹氭槸杩欎釜 鑰冭檻瑕佷笉瑕佸鍏aunchWinData..
     }
 }
\ No newline at end of file

--
Gitblit v1.8.0