コード例 #1
0
        private void refreshVersionList()
        {
            using (UnityWebRequest webRequest = UnityWebRequest.Get("https://servicewechat.com/engine/engine-version")) {
                // if(UnityVersion.UNITY_2017_1_OR_NEWER){
                //     webRequest.SendWebRequest ();
                // }
                // else if(UnityVersion.UNITY_5_5_OR_NEWER){
                webRequest.Send();
                // }
                // else{
                //     return;
                // }

                while (!webRequest.isDone)
                {
                }

                string localVersion = PluginHub.readVersionFromFile();

                if (webRequest.responseCode == 200)
                {
                    PluginHub.versionList.Clear();
                    WeChatFrameWork.JSONObject result          = WeChatFrameWork.JSONObject.Create(System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data));
                    WeChatFrameWork.JSONObject versionListJSON = result.GetField("version");
                    // 如果是测试版本号
                    if (localVersion.StartsWith("0."))
                    {
                        PluginHub.versionList.Add(localVersion);
                        PluginHub.versionIndex = 0;
                    }
                    bool latestVersionDirty = false;
                    for (int i = versionListJSON.Count - 1; i >= 0; i--)
                    {
                        string version = versionListJSON[i].GetField("engine").GetRawString();
                        PluginHub.versionList.Add(version);
                        if (version == localVersion)
                        {
                            PluginHub.versionIndex = PluginHub.versionList.Count - 1;
                        }

                        if (version.CompareTo(latestVersion) > 0)
                        {
                            latestVersion      = version;
                            latestVersionDirty = true;
                            Debug.Log("1:" + latestVersion);
                        }
                    }
                    if (latestVersionDirty)
                    {
                        Debug.Log(latestVersion);
                        // ChangeModuleVersion(ModulePackageName.FRAMEWORK, latestVersion);
                    }
                }
            }
        }
コード例 #2
0
        private void refreshVersionList()
        {
            using (UnityWebRequest webRequest = UnityWebRequest.Get("https://servicewechat.com/engine/engine-version")) {
                // if(UnityVersion.UNITY_2017_1_OR_NEWER){
                //     webRequest.SendWebRequest ();
                // }
                // else if(UnityVersion.UNITY_5_5_OR_NEWER){
                webRequest.Send();
                // }
                // else{
                //     return;
                // }

                while (!webRequest.isDone)
                {
                }

                if (webRequest.responseCode == 200)
                {
                    PluginHub.versionList.Clear();
                    WeChatFrameWork.JSONObject result          = WeChatFrameWork.JSONObject.Create(System.Text.Encoding.UTF8.GetString(webRequest.downloadHandler.data));
                    WeChatFrameWork.JSONObject versionListJSON = result.GetField("version");
                    // 如果是测试版本号
                    if (PluginHub.frameworkVersion.StartsWith("0."))
                    {
                        PluginHub.versionList.Add(PluginHub.frameworkVersion);
                        PluginHub.versionIndex = 0;
                    }
                    for (int i = versionListJSON.Count - 1; i >= 0; i--)
                    {
                        string version = versionListJSON[i].GetField("engine").GetRawString();
                        PluginHub.versionList.Add(version);
                        if (version == PluginHub.frameworkVersion)
                        {
                            PluginHub.versionIndex = PluginHub.versionList.Count - 1;
                        }
                    }
                }
            }
        }