| | |
| | | { |
| | | 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"); |
| | | } |
| | | |
| | | //不下载时本地安卓测试路径 |
| | |
| | | set |
| | | { |
| | | m_step = value; |
| | | Debug.LogError("LoadDllStep:" + m_step); |
| | | Debug.LogWarning("LoadDllStep:" + m_step); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | 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) |
| | |
| | | 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 |
| | | { |
| | |
| | | { |
| | | 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; |
| | | } |
| | | |
| | |
| | | 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 |
| | | |
| | |
| | | #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 |
| | |
| | | |
| | | urlIndex++; |
| | | versionUrl = url; |
| | | Debug.LogError("http地址:versionUrl " + url); |
| | | Debug.LogWarning("http地址:versionUrl " + url); |
| | | HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnVersionCheckResult); |
| | | } |
| | | catch (Exception ex) |
| | |
| | | |
| | | urlIndex++; |
| | | versionUrl = url; |
| | | Debug.LogError("http地址:versionUrl " + url); |
| | | Debug.LogWarning("http地址:versionUrl " + url); |
| | | HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnVersionCheckResult); |
| | | LogTiming("RequestVersionCheck", startTime); |
| | | } |
| | |
| | | float startTime = Time.realtimeSinceStartup; |
| | | if (string.IsNullOrEmpty(initFuncUrl)) |
| | | { |
| | | Debug.LogError("[LocalResManager] cdnUrl 为空,跳过 CDN InitialFunction.txt,尝试读取包内配置。"); |
| | | Debug.LogWarning("[LocalResManager] cdnUrl 为空,跳过 CDN InitialFunction.txt,尝试读取包内配置。"); |
| | | return false; |
| | | } |
| | | |
| | |
| | | { |
| | | 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)); |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | |
| | | 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; |
| | | } |
| | |
| | | |
| | | private void RetryVersionCheck(string message) |
| | | { |
| | | Debug.LogError(message + " 将在1秒后重试..."); |
| | | Debug.LogWarning(message + " 将在1秒后重试..."); |
| | | Clock.AlarmAt(DateTime.Now + TimeSpan.FromSeconds(1), RequestVersionCheck); |
| | | } |
| | | |
| | |
| | | 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; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | Id = id; |
| | | Debug.LogError(string.Format("系统语言:{0} 设置为{1}", Application.systemLanguage, Id)); |
| | | Debug.LogWarning(string.Format("系统语言:{0} 设置为{1}", Application.systemLanguage, Id)); |
| | | } |
| | | |
| | | #region 事件汇报 |