三国卡牌客户端基础资源仓库
yyl
9 天以前 a4d146bf50c8bcee42c0824865f0396c35f5da34
日志error变warning
4个文件已修改
72 ■■■■ 已修改文件
Assets/Launch/Launch.cs 26 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/Manager/LocalResManager.cs 40 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/Manager/YooAssetInitializer.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/UI/LaunchWins/LaunchExWin.cs 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/Launch.cs
@@ -224,7 +224,7 @@
                elapsed += 0.5f;
                if (elapsed > 30f)
                {
                    Debug.LogError("[Launch] UpdateBackground give up: cdnUrl not ready within 30s.");
                    Debug.LogWarning("[Launch] UpdateBackground give up: cdnUrl not ready within 30s.");
                    TraceEnd("UpdateBackgroundAsync", "启动背景更新", "结果: cdnUrl 超时");
                    return;
                }
@@ -272,7 +272,7 @@
            File.WriteAllBytes(dir + "LoginBackground_" + newVersion + ".jpg", imgReq.downloadHandler.data);
            LocalSave.SetString("bg_version", newVersion);
            Debug.LogError($"[Launch] Background updated to version {newVersion}");
            Debug.LogWarning($"[Launch] Background updated to version {newVersion}");
            TraceEnd("UpdateBackgroundAsync", "启动背景更新", $"结果: 背景更新到 {newVersion}");
        }
        catch (Exception ex)
@@ -287,7 +287,7 @@
    async void Start()
    {
        TraceBegin("Start", "冷启动入口");
        Debug.LogError("[Launch] Start");
        Debug.LogWarning("[Launch] Start");
#if UNITY_WEBGL
            await VersionConfigEx.Get();
#else
@@ -358,7 +358,7 @@
                : WebGLRemoteConfig.CreateRemoteServices();
            if (!string.IsNullOrEmpty(webCdnUrl))
                remoteCdnBaseUrl = webCdnUrl;
            Debug.LogError($"[Launch] WebGL remoteCdnBaseUrl={remoteCdnBaseUrl ?? WebGLRemoteConfig.ActiveServerURL}");
            Debug.LogWarning($"[Launch] WebGL remoteCdnBaseUrl={remoteCdnBaseUrl ?? WebGLRemoteConfig.ActiveServerURL}");
#else
            // 非 WebGL 正式包:
            // 先读 VersionConfigEx(Resources.Load,不依赖 YooAsset),
@@ -376,11 +376,11 @@
            else
            {
                playMode = EPlayMode.OfflinePlayMode;
                Debug.LogError("[Launch] No cdnUrl configured, using OfflinePlayMode");
                Debug.LogWarning("[Launch] No cdnUrl configured, using OfflinePlayMode");
            }
#endif
            Debug.LogError($"[Launch] cdnUrl={remoteCdnBaseUrl+ LocalResManager.fixPath}, PlayMode={playMode}");
            Debug.LogWarning($"[Launch] cdnUrl={remoteCdnBaseUrl+ LocalResManager.fixPath}, PlayMode={playMode}");
            await YooAssetInitializer.Instance.InitializeAsync(playMode, remoteServices, remoteCdnBaseUrl + LocalResManager.fixPath);
@@ -398,7 +398,7 @@
            // HostPlayMode: 不预下载全部资源。YooAsset CacheFileSystem 在 LoadAssetAsync 时自动按需从 CDN 下载。
            Debug.LogError("[Launch] YooAsset early init completed. State: " + YooAssetInitializer.Instance.State);
            Debug.LogWarning("[Launch] YooAsset early init completed. State: " + YooAssetInitializer.Instance.State);
            TraceEnd("InitYooAssetEarlyAsync", "资源系统预初始化", "结果: 初始化完成");
        }
        catch (Exception ex)
@@ -497,7 +497,7 @@
                continue;
            // 加载assembly对应的dll,会自动为它hook。一旦aot泛型函数的native函数不存在,用解释器版本代码
            LoadImageErrorCode err = RuntimeApi.LoadMetadataForAOTAssembly(ReadBytesFromStreamingAssets(aotDllName), mode);
            Debug.LogError($"LoadMetadataForAOTAssembly:{aotDllName}. mode:{mode} ret:{err}");
            Debug.LogWarning($"LoadMetadataForAOTAssembly:{aotDllName}. mode:{mode} ret:{err}");
        }
        TraceEnd("LoadMetadataForAOTAssemblies", "AOT元数据加载");
    }
@@ -534,7 +534,7 @@
            Debug.LogError("无法找到get_Instance方法");
        }
        LocalResManager.Instance.RecordLauchEvent(3);
        Debug.LogError("进入游戏流程");
        Debug.LogWarning("进入游戏流程");
        TraceEnd("StartGame", "进入热更主流程", "结果: LaunchInHot.Instance 已触发");
    }
@@ -668,7 +668,7 @@
                    downloadBytes = downloader != null ? downloader.TotalDownloadBytes : 0;
                    needRemote = downloadCount > 0 || downloadBytes > 0;
                    downloadStartTime = Time.realtimeSinceStartup;
                    Debug.LogError($"[YooAssetDownload] Start on-demand source=Launch.ReadDllBytes, package={dllPackage.PackageName}, location='{location}', files={downloadCount}, size={FormatBytes(downloadBytes)}");
                    Debug.LogWarning($"[YooAssetDownload] Start on-demand source=Launch.ReadDllBytes, package={dllPackage.PackageName}, location='{location}', files={downloadCount}, size={FormatBytes(downloadBytes)}");
                }
            }
            catch (Exception ex)
@@ -693,10 +693,10 @@
                if (needRemote)
                {
                    float cost = Time.realtimeSinceStartup - downloadStartTime;
                    Debug.LogError($"[YooAssetDownload] Finish on-demand source=Launch.ReadDllBytes, package={dllPackage.PackageName}, location='{location}', files={downloadCount}, size={FormatBytes(downloadBytes)}, cost={cost:F2}s");
                    Debug.LogWarning($"[YooAssetDownload] Finish on-demand source=Launch.ReadDllBytes, package={dllPackage.PackageName}, location='{location}', files={downloadCount}, size={FormatBytes(downloadBytes)}, cost={cost:F2}s");
                }
                s_assetDatas[dllName] = ((TextAsset)handle.AssetObject).bytes;
                Debug.LogError($"[Launch] Loaded DLL: {dllName} size:{s_assetDatas[dllName].Length}");
                Debug.LogWarning($"[Launch] Loaded DLL: {dllName} size:{s_assetDatas[dllName].Length}");
            }
            DllLoadProgress = (float)(i + 1) / total;
@@ -749,7 +749,7 @@
                }
            }
            Debug.LogError($"[LocalFileRemoteServices] 索引了 {_index.Count} 个文件,根目录: {localPath}");
            Debug.LogWarning($"[LocalFileRemoteServices] 索引了 {_index.Count} 个文件,根目录: {localPath}");
        }
        public string GetRemoteMainURL(string fileName)
Assets/Launch/Manager/LocalResManager.cs
@@ -22,7 +22,7 @@
{
    private static void LogTiming(string phase, float startTime)
    {
        Debug.LogError($"[LocalResManager][Timing] {phase} cost={(Time.realtimeSinceStartup - startTime):F3}s");
        Debug.LogWarning($"[LocalResManager][Timing] {phase} cost={(Time.realtimeSinceStartup - startTime):F3}s");
    }
    //不下载时本地安卓测试路径
@@ -89,7 +89,7 @@
        set
        {
            m_step = value;
            Debug.LogError("LoadDllStep:" + m_step);
            Debug.LogWarning("LoadDllStep:" + m_step);
        }
    }
@@ -258,7 +258,7 @@
            if (context.Enabled)
            {
                Debug.LogError($"[YooAssetDownload] Start on-demand source={source}, package={context.PackageName}, location='{location}', files={context.Count}, size={FormatBytes(context.Bytes)}");
                Debug.LogWarning($"[YooAssetDownload] Start on-demand source={source}, package={context.PackageName}, location='{location}', files={context.Count}, size={FormatBytes(context.Bytes)}");
            }
        }
        catch (Exception ex)
@@ -277,7 +277,7 @@
        float cost = Time.realtimeSinceStartup - context.StartTime;
        if (succeed)
        {
            Debug.LogError($"[YooAssetDownload] Finish on-demand source={context.Source}, package={context.PackageName}, location='{context.Location}', files={context.Count}, size={FormatBytes(context.Bytes)}, cost={cost:F2}s");
            Debug.LogWarning($"[YooAssetDownload] Finish on-demand source={context.Source}, package={context.PackageName}, location='{context.Location}', files={context.Count}, size={FormatBytes(context.Bytes)}, cost={cost:F2}s");
        }
        else
        {
@@ -301,7 +301,7 @@
    {
        if (package == null)
        {
            Debug.LogError($"[LocalResManager][Diag] BeforeLoad attempt={attempt + 1}, location='{location}', package=null, state={YooAssetInitializer.Instance.State}, lastError={YooAssetInitializer.Instance.LastError}");
            Debug.LogWarning($"[LocalResManager][Diag] BeforeLoad attempt={attempt + 1}, location='{location}', package=null, state={YooAssetInitializer.Instance.State}, lastError={YooAssetInitializer.Instance.LastError}");
            return;
        }
@@ -326,7 +326,7 @@
            locationValid = $"check-error:{ex.Message}";
        }
        Debug.LogError($"[LocalResManager][Diag] BeforeLoad attempt={attempt + 1}, location='{location}', package='{package.PackageName}', initStatus={package.InitializeStatus}, packageValid={package.PackageValid}, manifestVersion={manifestVersion}, assets={assetTotalCount}, bundles={bundleTotalCount}, locationValid={locationValid}, state={YooAssetInitializer.Instance.State}, lastError={YooAssetInitializer.Instance.LastError}");
        Debug.LogWarning($"[LocalResManager][Diag] BeforeLoad attempt={attempt + 1}, location='{location}', package='{package.PackageName}', initStatus={package.InitializeStatus}, packageValid={package.PackageValid}, manifestVersion={manifestVersion}, assets={assetTotalCount}, bundles={bundleTotalCount}, locationValid={locationValid}, state={YooAssetInitializer.Instance.State}, lastError={YooAssetInitializer.Instance.LastError}");
    }
#endif
@@ -355,13 +355,13 @@
#endif
        Clock.Init();
        Debug.LogError("LocalResManager.Init");
        Debug.LogWarning("LocalResManager.Init");
        LogTiming("Init", startTime);
    }
    public void Release()
    {
        Debug.LogError("提前ResManager.Release资源");
        Debug.LogWarning("提前ResManager.Release资源");
    }
#if UNITY_WEBGL
@@ -384,7 +384,7 @@
            urlIndex++;
            versionUrl = url;
            Debug.LogError("http地址:versionUrl  " + url);
            Debug.LogWarning("http地址:versionUrl  " + url);
            HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnVersionCheckResult);
        }
        catch (Exception ex)
@@ -411,7 +411,7 @@
        urlIndex++;
        versionUrl = url;
        Debug.LogError("http地址:versionUrl  " + url);
        Debug.LogWarning("http地址:versionUrl  " + url);
        HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnVersionCheckResult);
        LogTiming("RequestVersionCheck", startTime);
    }
@@ -537,7 +537,7 @@
        float startTime = Time.realtimeSinceStartup;
        if (string.IsNullOrEmpty(initFuncUrl))
        {
            Debug.LogError("[LocalResManager] cdnUrl 为空,跳过 CDN InitialFunction.txt,尝试读取包内配置。");
            Debug.LogWarning("[LocalResManager] cdnUrl 为空,跳过 CDN InitialFunction.txt,尝试读取包内配置。");
            return false;
        }
@@ -545,7 +545,7 @@
        {
            if (i > 0)
            {
                Debug.LogError($"[LocalResManager] 重试加载 InitialFunction.txt 第 {i}/{INIT_FUNC_MAX_RETRY} 次...");
                Debug.LogWarning($"[LocalResManager] 重试加载 InitialFunction.txt 第 {i}/{INIT_FUNC_MAX_RETRY} 次...");
                await UniTask.Delay(TimeSpan.FromSeconds(INIT_FUNC_RETRY_DELAY_SEC));
            }
@@ -567,7 +567,7 @@
                InitialFunctionConfigEx.Init(response.message);
                // 需要根据languagefix 重新把cdn地址转向正确的多语言版本的cdn地址
                InitDefaultLanguage();
                Debug.LogError($"[LocalResManager] 成功加载 CDN InitialFunction.txt(第 {i + 1} 次尝试)");
                Debug.LogWarning($"[LocalResManager] 成功加载 CDN InitialFunction.txt(第 {i + 1} 次尝试)");
                LogTiming("TryLoadInitialFunctionFromCdnAsync", startTime);
                return true;
            }
@@ -590,14 +590,14 @@
            TextAsset textAsset = await Resources.LoadAsync<TextAsset>("Config/InitialFunction") as TextAsset;
            if (textAsset == null || string.IsNullOrEmpty(textAsset.text))
            {
                Debug.LogError("[LocalResManager] 包内 InitialFunction.txt 不存在或内容为空,将继续启动。");
                Debug.LogWarning("[LocalResManager] 包内 InitialFunction.txt 不存在或内容为空,将继续启动。");
                return false;
            }
            InitialFunctionConfigEx.Init(textAsset.text);
            // 需要根据languagefix 重新把cdn地址转向正确的多语言版本的cdn地址
            InitDefaultLanguage();
            Debug.LogError("[LocalResManager] 已使用包内 InitialFunction.txt 初始化启动配置。");
            Debug.LogWarning("[LocalResManager] 已使用包内 InitialFunction.txt 初始化启动配置。");
            LogTiming("TryLoadInitialFunctionFromResourcesAsync", startTime);
            return true;
        }
@@ -632,7 +632,7 @@
    private void RetryVersionCheck(string message)
    {
        Debug.LogError(message + " 将在1秒后重试...");
        Debug.LogWarning(message + " 将在1秒后重试...");
        Clock.AlarmAt(DateTime.Now + TimeSpan.FromSeconds(1), RequestVersionCheck);
    }
@@ -823,17 +823,17 @@
        if (languageStartDict == null || VersionConfigEx.config == null || !languageStartDict.ContainsKey(VersionConfigEx.config.appId))
        {
            //检查有没多语言
            Debug.LogError("当前渠道未开启多语言:" + (VersionConfigEx.config != null ? VersionConfigEx.config.appId : "null"));
            Debug.LogWarning("当前渠道未开启多语言:" + (VersionConfigEx.config != null ? VersionConfigEx.config.appId : "null"));
            return;
        }
        Debug.LogError(string.Format("系统语言:{0} {1}", Application.systemLanguage, config.Numerical1));
        Debug.LogWarning(string.Format("系统语言:{0} {1}", Application.systemLanguage, config.Numerical1));
        var id = LocalSave.GetString("LANGUAGE_ID1");
        if (!string.IsNullOrEmpty(id))
        {
            //玩家已经选择过语言,不做处理
            Debug.LogError("当前选择语言:" + id);
                Debug.LogWarning("当前选择语言:" + id);
            return;
        }
@@ -867,7 +867,7 @@
        }
        Id = id;
        Debug.LogError(string.Format("系统语言:{0} 设置为{1}", Application.systemLanguage, Id));
        Debug.LogWarning(string.Format("系统语言:{0} 设置为{1}", Application.systemLanguage, Id));
    }
    #region 事件汇报
Assets/Launch/Manager/YooAssetInitializer.cs
@@ -388,7 +388,7 @@
    {
        if (package == null)
        {
            Debug.LogError($"[YooAssetInitializer][Diag] {phase} pkg='{pkgName}' package=null");
            Debug.LogWarning($"[YooAssetInitializer][Diag] {phase} pkg='{pkgName}' package=null");
            return;
        }
Assets/Launch/UI/LaunchWins/LaunchExWin.cs
@@ -1,4 +1,4 @@
using System.Collections;
using System.Collections;
using System.Collections.Generic;
using System;
using UnityEngine;
@@ -46,7 +46,7 @@
    private static void LogTiming(string phase, float startTime)
    {
        Debug.LogError($"[LaunchExWin][Timing] {phase} cost={(Time.realtimeSinceStartup - startTime):F3}s");
        Debug.LogWarning($"[LaunchExWin][Timing] {phase} cost={(Time.realtimeSinceStartup - startTime):F3}s");
    }
    void Awake()