| | |
| | | { |
| | | private static void LogTiming(string phase, float startTime) |
| | | { |
| | | Debug.LogWarning($"[LocalResManager][Timing] {phase} cost={(Time.realtimeSinceStartup - startTime):F3}s"); |
| | | #if UNITY_WEBGL |
| | | Debug.Log("[LocalResManager][Timing] " + phase + " cost=" + |
| | | (Time.realtimeSinceStartup - startTime).ToString("F3") + "s"); |
| | | #else |
| | | Debug.LogWarning("[LocalResManager][Timing] " + phase + " cost=" + |
| | | (Time.realtimeSinceStartup - startTime).ToString("F3") + "s"); |
| | | #endif |
| | | } |
| | | |
| | | //不下载时本地安卓测试路径 |
| | |
| | | case "ryzj": |
| | | VERSION_URL = new string[] |
| | | { |
| | | "http://xssgcenter.secondworld.net.cn:11000/center/appversion_new.php/?", |
| | | "http://106.55.151.92:11000/center/appversion_new.php/?", |
| | | "http://xssgcenter.secondworld.net.cn:11000/center/appversion_new.php?", |
| | | "http://106.55.151.92:11000/center/appversion_new.php?", |
| | | }; |
| | | break; |
| | | case "sghy": |
| | | VERSION_URL = new string[] |
| | | { |
| | | "http://sghycenter.funimpactgames.com:11000/center/appversion_new.php/?", |
| | | "http://47.250.213.171:11000/center/appversion_new.php/?", |
| | | "http://sghycenter.funimpactgames.com:11000/center/appversion_new.php?", |
| | | "http://47.250.213.171:11000/center/appversion_new.php?", |
| | | }; |
| | | break; |
| | | default: |
| | | VERSION_URL = new string[] |
| | | { |
| | | "http://xssgcenter.secondworld.net.cn:11000/center/appversion_new.php/?", |
| | | "http://106.55.151.92:11000/center/appversion_new.php/?", |
| | | "http://xssgcenter.secondworld.net.cn:11000/center/appversion_new.php?", |
| | | "http://106.55.151.92:11000/center/appversion_new.php?", |
| | | }; |
| | | break; |
| | | } |
| | | |
| | | #if TEST_URL |
| | | VERSION_URL = new string[] |
| | | // if (VersionConfigEx.config.versionAuthority == VersionConfigEx.VersionAuthority.InterTest) |
| | | { |
| | | "http://gamecenter.secondworld.net.cn:11000/center/appversion_new.php/?", |
| | | }; |
| | | VERSION_URL = new string[] |
| | | { |
| | | "http://gamecenter.secondworld.net.cn:11000/center/appversion_new.php?", |
| | | }; |
| | | } |
| | | #endif |
| | | } |
| | | |
| | |
| | | urlIndex++; |
| | | versionUrl = url; |
| | | Debug.LogWarning("http地址:versionUrl " + url); |
| | | HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnVersionCheckResult); |
| | | |
| | | // 改用 await 返回值 + 直接调用,避免 Action<bool,string> 委托 |
| | | // 经过 HybridCLR 解释器的 async 状态机桥接时触发 function signature mismatch |
| | | var (ok, result) = await HttpBehaviour.CreateAsync( |
| | | url, "GET", "", HttpRequest.defaultHttpContentType, 1); |
| | | OnVersionCheckResult(ok, result); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | |
| | | #if UNITY_EDITOR |
| | | await TryLoadInitialFunctionFromResourcesAsync(); |
| | | #else |
| | | bool configReady = await TryLoadInitialFunctionFromCdnAsync(initFuncUrl); |
| | | if (!configReady) |
| | | { |
| | | await InitializeYooAssetAndEnterReadBytesAsync(); |
| | | } |
| | | bool configReady = await TryLoadInitialFunctionFromCdnAsync(initFuncUrl); |
| | | if (!configReady) |
| | | { |
| | | await TryLoadInitialFunctionFromResourcesAsync(); |
| | | } |
| | | #endif |
| | | await InitializeYooAssetAndEnterReadBytesAsync(); |
| | | LogTiming("LoadInitialFunctionAndStartAsync", startTime); |
| | | LogTiming("LoadInitialFunctionAndStartAsync", startTime); |
| | | } |
| | | |
| | | private const int INIT_FUNC_MAX_RETRY = 5; |
| | |
| | | url = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?"; |
| | | break; |
| | | } |
| | | #if TEST_URL |
| | | url = "http://gamecenter.secondworld.net.cn:11000/center/eventreport.php?"; |
| | | #endif |
| | | } |
| | | |
| | | public void RecordLauchEvent(int _step) |
| | |
| | | public class VersionInfo |
| | | { |
| | | [Preserve] public JsonData notice_flag; |
| | | [Preserve] public JsonData resource_url; //这里只用到这个取下载地址 |
| | | [Preserve] public Dictionary<string, string> resource_url; //这里只用到这个取下载地址 |
| | | [Preserve] public string ResourceAward; |
| | | [Preserve] public int downAsset = 1; |
| | | [Preserve] public string downUrl; |
| | |
| | | |
| | | public string GetResourcesURL(int _branch) |
| | | { |
| | | if (resource_url != null) |
| | | string resourceUrl; |
| | | if (resource_url != null && resource_url.TryGetValue(_branch.ToString(), out resourceUrl)) |
| | | { |
| | | return resource_url[_branch.ToString()].ToString(); |
| | | return resourceUrl ?? string.Empty; |
| | | } |
| | | else |
| | | { |
| | | return string.Empty; |
| | | } |
| | | |
| | | return string.Empty; |
| | | } |
| | | |
| | | } |