三国卡牌客户端基础资源仓库
hch
7 天以前 b3cac56ccfb061a4c905f9afcc4c194b8a611747
0312 调整游戏不同渠道请求的url,暂写死代码里
3个文件已修改
88 ■■■■ 已修改文件
Assets/Launch/HttpRequest/HttpRequest.cs 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/Launch.cs 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/Manager/LocalResManager.cs 76 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Assets/Launch/HttpRequest/HttpRequest.cs
@@ -39,7 +39,7 @@
        return await HttpBehaviour.CreateAsync(_url, "GET", "", _contentType, _retry, _result);
    }
    //2024-09-26 HttpWebRequest Get CDN资源在某些节日可能无法访问 包含keepalive的设定等不同情况 改用UnityWebRequest
    //2024-09-26 HttpWebRequest Get CDN资源在某些节点可能无法访问 包含keepalive的设定等不同情况 改用UnityWebRequest
    //获取CDN资源不建议使用HttpWebRequest
    public async UniTask<(bool ok, string message)> UnityWebRequestGet(string _url, int timeout = 5, Action<bool, string> _result = null)
    {
Assets/Launch/Launch.cs
@@ -86,6 +86,12 @@
    async void Start()
    {
        Debug.Log("Launch Start");
#if UNITY_WEBGL
            await VersionConfigEx.Get();
#endif
        LocalResManager.Instance.SetVersionUrl();
        LocalResManager.Instance.SetEventReportUrl();
        LocalResManager.Instance.RecordLauchEvent(1);
        InitPlugins();
@@ -171,9 +177,7 @@
            Debug.Log($"[Launch] cdnUrl={remoteCdnBaseUrl+ LocalResManager.fixPath}, PlayMode={playMode}");
            await YooAssetInitializer.Instance.InitializeAsync(playMode, remoteServices, remoteCdnBaseUrl + LocalResManager.fixPath);
#if UNITY_WEBGL
            await VersionConfigEx.Get();
#endif
            if (YooAssetInitializer.Instance.State == YooAssetInitializer.InitState.InitFailed)
            {
Assets/Launch/Manager/LocalResManager.cs
@@ -64,15 +64,7 @@
    public static int downLoadCount = 0;
    public static readonly string[] VERSION_URL = new string[]
    {
#if TEST_URL
        "http://gamecenter.secondworld.net.cn:11000/center/appversion_new.php/?",
#else
        "http://xssgcenter.secondworld.net.cn:11000/center/appversion_new.php/?",
#endif
        "http://106.55.151.92:11000/center/appversion_new.php/?",
    };
    public static string[] VERSION_URL;
    public int debugBranch { get; private set; }
@@ -134,6 +126,44 @@
        }
    }
    //根据不同 平台设置不同的版本url
    public void SetVersionUrl()
    {
        var appID = VersionConfigEx.Get().appId;
        switch (appID)
        {
            case "test":
            case "xssg":
            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/?",
                };
                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/?",
                };
                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/?",
                };
                break;
        }
#if TEST_URL
        VERSION_URL = new string[]
        {
            "http://gamecenter.secondworld.net.cn:11000/center/appversion_new.php/?",
        };
#endif
    }
    // 对齐 YooAssetService.ExecuteWithRetryAsync:指数退避重试(500→1000→2000ms)
    private const int YOO_MAX_RETRY = 3;
@@ -291,6 +321,7 @@
        urlIndex++;
        versionUrl = url;
        Debug.Log("http地址:versionUrl  " + url);
        HttpRequest.Instance.RequestHttpGet(url, HttpRequest.defaultHttpContentType, 1, OnVersionCheckResult);
    }
#endif
@@ -717,12 +748,29 @@
    #region 事件汇报
#if TEST_URL
    const string url = "http://gamecenter.secondworld.net.cn:11000/center/eventreport.php?";
#else
    const string url = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
#endif
    public string url;
    //根据不同 平台设置不同的版本url
    public void SetEventReportUrl()
    {
        var appID = VersionConfigEx.Get().appId;
        switch (appID)
        {
            case "test":
            case "xssg":
            case "ryzj":
                url = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
                break;
            case "sghy":
                url = "http://sghycenter.funimpactgames.com:11000/center/eventreport.php?";
                break;
            default:
                url = "http://xssgcenter.secondworld.net.cn:11000/center/eventreport.php?";
                break;
        }
    }
    public void RecordLauchEvent(int _step)
    {