From bbb7a81a92b41da5ae49690492facde03799f156 Mon Sep 17 00:00:00 2001
From: yyl <yyl>
Date: 星期四, 07 五月 2026 18:00:06 +0800
Subject: [PATCH] webgl1

---
 Main/System/TotDayRecharge/TotDayRechargeCell.cs |    3 +
 Main/ResModule/YooAssetService.cs                |   88 +++++++++++++++++++++++++++++++++++++------
 Main/System/TotalRecharge/TotalRechargeCell.cs   |    3 +
 Main/System/Horse/HorseItem.cs                   |    7 ++-
 Main/System/HeroDebut/HeroDebutManager.cs        |    4 +-
 Main/System/Horse/GetHorseWin.cs                 |    7 ++-
 Main/System/HeroReturn/HeroReturnManager.cs      |    4 +-
 7 files changed, 93 insertions(+), 23 deletions(-)

diff --git a/Main/ResModule/YooAssetService.cs b/Main/ResModule/YooAssetService.cs
index 994ee58..b922e67 100644
--- a/Main/ResModule/YooAssetService.cs
+++ b/Main/ResModule/YooAssetService.cs
@@ -180,8 +180,8 @@
             Debug.Log($"[YooAssetService] Initialized {_packages.Count}/{allPkgs.Length} packages with PlayMode={playMode}. " +
                 $"Active: [{string.Join(", ", _packages.Keys)}]");
 
-#if UNITY_WEBGL
-            // WebGL 璇婃柇锛氳緭鍑烘瘡涓寘鐨� Manifest 鍜� Bundle 璇︽儏
+            // 璇婃柇锛氳緭鍑烘瘡涓寘鐨勭姸鎬侊紙Debug 鏋勫缓涓嬪缁堣緭鍑猴紝鏂逛究鎺掓煡 location is invalid 绛夐棶棰橈級
+#if UNITY_DEBUG || UNITY_EDITOR || DEVELOPMENT_BUILD
             DiagDumpPackageStatus();
 #endif
         }
@@ -397,7 +397,24 @@
         {
             var packageName = YooAssetPackageConfig.GetPackageForLocation(location);
             if (_packages.TryGetValue(packageName, out var package))
+            {
+                // 鍦ㄥ姞杞藉墠妫�鏌� location 鏄惁鍦ㄨ鍖呯殑 Manifest 閲岋紝鎻愬墠鏆撮湶闂
+                if (!package.CheckLocationValid(location))
+                {
+                    // 鏀堕泦鎵�鏈夊寘鐨� CheckLocationValid 缁撴灉
+                    var validIn = new System.Collections.Generic.List<string>();
+                    foreach (var kv in _packages)
+                        if (kv.Value.CheckLocationValid(location)) validIn.Add(kv.Key);
+
+                    Debug.LogError(
+                        $"[YooAssetService][鈽匢NVALID-LOCATION鈽匽 location='{location}' 璺敱鍒板寘='{packageName}'" +
+                        $" 浣� CheckLocationValid=False锛乗n" +
+                        $"  鈫� 鍖呯姸鎬�: {package.InitializeStatus}\n" +
+                        $"  鈫� 璇ヨ祫婧愬湪浠ヤ笅鍖呬腑鏈夋晥: [{(validIn.Count > 0 ? string.Join(", ", validIn) : "鏃�")}]\n" +
+                        $"  鈫� 鍙兘鍘熷洜: 鈶犲寘鏈噸鏂版墦鍖呭鑷� Manifest 缂哄皯姝よ祫婧� 鈶¤祫婧愯矾寰勬嫾鍐欓敊璇� 鈶㈠寘鍒濆鍖栧け璐� Manifest 涓虹┖");
+                }
                 return package;
+            }
 
             // 璺敱鍒扮殑鍖呭皻鏈垵濮嬪寲锛屽洖閫�鍒伴粯璁ゅ寘 鈥� 鍙戝嚭鏄庣‘璀﹀憡
             Debug.LogWarning($"[YooAssetService] Package '{packageName}' not available for location '{location}'. " +
@@ -857,31 +874,76 @@
             return package.LoadAllAssetsSync<T>(location);
         }
 
-#if UNITY_WEBGL
+#if UNITY_WEBGL || UNITY_DEBUG || UNITY_EDITOR || DEVELOPMENT_BUILD
         /// <summary>
-        /// WebGL 璇婃柇锛氳緭鍑烘瘡涓� YooAsset 鍖呯殑鍒濆鍖栫姸鎬佸拰璧勬簮鏁伴噺銆�
+        /// 璇婃柇锛氳緭鍑烘瘡涓� YooAsset 鍖呯殑鍒濆鍖栫姸鎬佸拰璧勬簮鏁伴噺銆�
         /// </summary>
         private void DiagDumpPackageStatus()
         {
             var sb = new System.Text.StringBuilder();
-            sb.AppendLine("[YooAssetService][WebGL-Diag] Package status dump:");
+            sb.AppendLine("[YooAssetService][Diag] Package status dump:");
             foreach (var kv in _packages)
             {
                 var pkg = kv.Value;
                 var status = pkg.InitializeStatus;
-                // 灏濊瘯鑾峰彇娓呭崟涓殑璧勬簮淇℃伅鏁伴噺
-                int assetCount = 0;
+                int assetTotalCount = -1;
+                int bundleTotalCount = -1;
+                string pkgVersion = "?";
                 try
                 {
-                    // GetAssetInfos 杩斿洖璇ュ寘鎵�鏈夎祫婧愪俊鎭�
-                    var infos = pkg.GetAssetInfos(string.Empty);
-                    assetCount = infos != null ? infos.Length : -1;
+                    var details = pkg.GetPackageDetails();
+                    assetTotalCount = details.AssetTotalCount;
+                    bundleTotalCount = details.BundleTotalCount;
+                    pkgVersion = details.PackageVersion ?? "null";
                 }
-                catch
+                catch { }
+                sb.AppendLine($"  [{kv.Key}] status={status}, assets={assetTotalCount}, bundles={bundleTotalCount}, version={pkgVersion}");
+            }
+            Debug.Log(sb.ToString());
+        }
+
+        /// <summary>
+        /// 璇婃柇鎸囧畾 location 鍦ㄥ摢涓寘閲屻�佹槸鍚﹁兘鎵惧埌銆�
+        /// 璋冪敤锛歒ooAssetService.Instance.DiagCheckLocation("Assets/ResourcesOut/Config/Foo.txt")
+        /// </summary>
+        public void DiagCheckLocation(string location)
+        {
+            var sb = new System.Text.StringBuilder();
+            sb.AppendLine($"[DiagCheckLocation] location='{location}'");
+            string routedPkg = YooAssetPackageConfig.GetPackageForLocation(location);
+            sb.AppendLine($"  璺敱鍒板寘: '{routedPkg}'");
+
+            foreach (var kv in _packages)
+            {
+                var pkg = kv.Value;
+                bool valid = pkg.CheckLocationValid(location);
+                sb.AppendLine($"  [{kv.Key}] CheckLocationValid={valid}, InitStatus={pkg.InitializeStatus}");
+            }
+            Debug.Log(sb.ToString());
+        }
+
+        /// <summary>
+        /// 鎵撳嵃鎵�鏈夊凡鍒濆鍖栧寘鐨勮祫婧愭暟鍜岀増鏈紙鎺掓煡 Manifest 鏈姞杞介棶棰橈級銆�
+        /// </summary>
+        public void DiagDumpAllPackages()
+        {
+            var sb = new System.Text.StringBuilder();
+            sb.AppendLine("[DiagDumpAllPackages]");
+            foreach (var kv in _packages)
+            {
+                var pkg = kv.Value;
+                int assetTotalCount = -1;
+                int bundleTotalCount = -1;
+                string pkgVersion = "?";
+                try
                 {
-                    assetCount = -1;
+                    var details = pkg.GetPackageDetails();
+                    assetTotalCount = details.AssetTotalCount;
+                    bundleTotalCount = details.BundleTotalCount;
+                    pkgVersion = details.PackageVersion ?? "null";
                 }
-                sb.AppendLine($"  [{kv.Key}] status={status}, assetInfoCount={assetCount}");
+                catch { }
+                sb.AppendLine($"  [{kv.Key}] status={pkg.InitializeStatus}, assets={assetTotalCount}, bundles={bundleTotalCount}, version={pkgVersion}");
             }
             Debug.Log(sb.ToString());
         }
diff --git a/Main/System/HeroDebut/HeroDebutManager.cs b/Main/System/HeroDebut/HeroDebutManager.cs
index baa2f25..0935c63 100644
--- a/Main/System/HeroDebut/HeroDebutManager.cs
+++ b/Main/System/HeroDebut/HeroDebutManager.cs
@@ -1203,11 +1203,11 @@
 
         if (showGiftType == 1)
         {
-            UIManager.Instance.OpenWindow<HeroDebutZhanLingPreviewWin>();
+            UIManager.Instance.OpenWindowAsync<HeroDebutZhanLingPreviewWin>().Forget();
         }
         else if (showGiftType == 2)
         {
-            UIManager.Instance.OpenWindow<HeroDebutZhanLingPreviewHWin>();
+            UIManager.Instance.OpenWindowAsync<HeroDebutZhanLingPreviewHWin>().Forget();
         }
     }
 
diff --git a/Main/System/HeroReturn/HeroReturnManager.cs b/Main/System/HeroReturn/HeroReturnManager.cs
index ee7b916..1d1d3d8 100644
--- a/Main/System/HeroReturn/HeroReturnManager.cs
+++ b/Main/System/HeroReturn/HeroReturnManager.cs
@@ -1321,11 +1321,11 @@
 
         if (showGiftType == 1)
         {
-            UIManager.Instance.OpenWindow<HeroReturnZhanLingPreviewWin>();
+            UIManager.Instance.OpenWindowAsync<HeroReturnZhanLingPreviewWin>().Forget();
         }
         else if (showGiftType == 2)
         {
-            UIManager.Instance.OpenWindow<HeroReturnZhanLingPreviewHWin>();
+            UIManager.Instance.OpenWindowAsync<HeroReturnZhanLingPreviewHWin>().Forget();
         }
     }
 
diff --git a/Main/System/Horse/GetHorseWin.cs b/Main/System/Horse/GetHorseWin.cs
index 9a9ca62..019084c 100644
--- a/Main/System/Horse/GetHorseWin.cs
+++ b/Main/System/Horse/GetHorseWin.cs
@@ -1,4 +1,5 @@
 using System;
+using Cysharp.Threading.Tasks;
 using UnityEngine;
 
 public class GetHorseWin : UIBase
@@ -27,8 +28,10 @@
             return;
 
         nameTxt.text = horseSkinConfig.Name;
-        iconImg.overrideSprite = UILoader.LoadSprite("HorseIcon", horseSkinConfig.Icon);
-        iconImg.SetNativeSize();
+        UILoader.LoadSprite("HorseIcon", horseSkinConfig.Icon, iconImg).ContinueWith(() =>
+        {
+            if (iconImg != null) iconImg.SetNativeSize();
+        }).Forget();
         HorseManager.Instance.GetRiderTotalAttrInfoByHorseID(horseID, out int attrID, out long value, out PlayerPropertyConfig playerPropertyConfig);
         attrTxt.text = StringUtility.Concat(PlayerPropertyConfig.Get(attrID).ShowName, " ", "+", PlayerPropertyConfig.GetValueDescription(attrID, value));
 
diff --git a/Main/System/Horse/HorseItem.cs b/Main/System/Horse/HorseItem.cs
index 652e07a..e81123b 100644
--- a/Main/System/Horse/HorseItem.cs
+++ b/Main/System/Horse/HorseItem.cs
@@ -1,3 +1,4 @@
+using Cysharp.Threading.Tasks;
 using UnityEngine;
 using UnityEngine.UI;
 
@@ -27,8 +28,10 @@
         if (horseSkinConfig == null)
             return;
 
-        iconImg.overrideSprite = UILoader.LoadSprite("HorseIcon", horseSkinConfig.Icon);
-        iconImg.SetNativeSize();
+        UILoader.LoadSprite("HorseIcon", horseSkinConfig.Icon, iconImg).ContinueWith(() =>
+        {
+            if (iconImg != null) iconImg.SetNativeSize();
+        }).Forget();
 
         bool hasArrtId = PlayerPropertyConfig.HasKey(config.AttrID);
         attrNameBg.SetActive(hasArrtId);
diff --git a/Main/System/TotDayRecharge/TotDayRechargeCell.cs b/Main/System/TotDayRecharge/TotDayRechargeCell.cs
index 10996a8..b5a709d 100644
--- a/Main/System/TotDayRecharge/TotDayRechargeCell.cs
+++ b/Main/System/TotDayRecharge/TotDayRechargeCell.cs
@@ -1,4 +1,5 @@
 锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
 using UnityEngine;
 using UnityEngine.UI;
 
@@ -66,7 +67,7 @@
                 }
                 else
                 {
-                    UIManager.Instance.OpenWindow<StoreBaseWin>(2);
+                    UIManager.Instance.OpenWindowAsync<StoreBaseWin>(2).Forget();
                 }
             }
         });
diff --git a/Main/System/TotalRecharge/TotalRechargeCell.cs b/Main/System/TotalRecharge/TotalRechargeCell.cs
index 789adfc..e9cc449 100644
--- a/Main/System/TotalRecharge/TotalRechargeCell.cs
+++ b/Main/System/TotalRecharge/TotalRechargeCell.cs
@@ -1,4 +1,5 @@
 锘縰sing System.Collections.Generic;
+using Cysharp.Threading.Tasks;
 using UnityEngine;
 using UnityEngine.UI;
 
@@ -66,7 +67,7 @@
                 }
                 else
                 {
-                    UIManager.Instance.OpenWindow<StoreBaseWin>(2);
+                    UIManager.Instance.OpenWindowAsync<StoreBaseWin>(2).Forget();
                 }
             }
         });

--
Gitblit v1.8.0