yyl
2026-05-07 bbb7a81a92b41da5ae49690492facde03799f156
webgl1
7个文件已修改
116 ■■■■ 已修改文件
Main/ResModule/YooAssetService.cs 88 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroDebut/HeroDebutManager.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/HeroReturn/HeroReturnManager.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Horse/GetHorseWin.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/Horse/HorseItem.cs 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/TotDayRecharge/TotDayRechargeCell.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Main/System/TotalRecharge/TotalRechargeCell.cs 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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][★INVALID-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 在哪个包里、是否能找到。
        /// 调用:YooAssetService.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());
        }
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();
        }
    }
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();
        }
    }
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));
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);
Main/System/TotDayRecharge/TotDayRechargeCell.cs
@@ -1,4 +1,5 @@
using 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();
                }
            }
        });
Main/System/TotalRecharge/TotalRechargeCell.cs
@@ -1,4 +1,5 @@
using 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();
                }
            }
        });