コード例 #1
0
        public void DoGetToken(string username, string password, Action <string> onTokenGetted)
        {
            var form = new WWWForm();

            form.AddField("username", username);
            form.AddField("password", password);

            EditorHttp.Post("https://api.liangxiegame.com/qf/v4/token", form, response =>
            {
                if (response.Type == ResponseType.SUCCEED)
                {
                    Debug.Log(response.Text);

                    var responseJson =
                        JsonUtility.FromJson <QFrameworkServerResultFormat <ResultFormatData> >(response.Text);

                    var code = responseJson.code;

                    if (code == 1)
                    {
                        var token = responseJson.data.token;
                        onTokenGetted(token);
                    }
                }
                else if (response.Type == ResponseType.EXCEPTION)
                {
                    Debug.LogError(response.Error);
                }
            });
        }
コード例 #2
0
        public void GetAllRemotePackageInfoV5(Action <List <PackageRepository>, List <string> > onResponse)
        {
            if (User.Logined)
            {
                var form = new WWWForm();

                form.AddField("username", User.Username.Value);
                form.AddField("password", User.Password.Value);

                EditorHttp.Post("https://api.liangxiegame.com/qf/v5/package/list", form,
                                (response) => OnResponseV5(response, onResponse));
            }
            else
            {
                EditorHttp.Post("https://api.liangxiegame.com/qf/v5/package/list", new WWWForm(),
                                (response) => OnResponseV5(response, onResponse));
            }
        }
コード例 #3
0
        public void DeletePackage(string packageId, System.Action onResponse)
        {
            var form = new WWWForm();

            form.AddField("username", User.Username.Value);
            form.AddField("password", User.Password.Value);
            form.AddField("id", packageId);

            EditorHttp.Post("https://api.liangxiegame.com/qf/v4/package/delete", form, (response) =>
            {
                if (response.Type == ResponseType.SUCCEED)
                {
                    var result = JsonUtility.FromJson <QFrameworkServerResultFormat <object> >(response.Text);

                    if (result.code == 1)
                    {
                        Debug.Log("删除成功");

                        onResponse();
                    }
                }
            });
        }
コード例 #4
0
        public override void Execute()
        {
            var tempFile = "Assets/" + mRequestPackageData.name + ".unitypackage";

            Debug.Log(mRequestPackageData.latestDownloadUrl + ">>>>>>:");

            EditorUtility.DisplayProgressBar("插件更新", "插件下载中 ...", 0.1f);

            EditorHttp.Download(mRequestPackageData.latestDownloadUrl, response =>
            {
                if (response.Type == ResponseType.SUCCEED)
                {
                    File.WriteAllBytes(tempFile, response.Bytes);

                    EditorUtility.ClearProgressBar();

                    AssetDatabase.ImportPackage(tempFile, false);

                    File.Delete(tempFile);

                    AssetDatabase.Refresh();

                    Debug.Log("PackageManager:插件下载成功");


                    this.GetModel <ILocalPackageVersionModel>()
                    .Reload();
                }
                else
                {
                    EditorUtility.ClearProgressBar();

                    EditorUtility.DisplayDialog(mRequestPackageData.name,
                                                "插件安装失败,请联系 [email protected] 或者加入 QQ 群:623597263" + response.Error + ";", "OK");
                }
            }, OnProgressChanged);
        }
コード例 #5
0
        public static void Do(PackageRepository requestPackageData)
        {
            var tempFile = "Assets/" + requestPackageData.name + ".unitypackage";

            Debug.Log(requestPackageData.latestDownloadUrl + ">>>>>>:");

            EditorUtility.DisplayProgressBar("插件更新", "插件下载中 ...", 0.1f);

            EditorHttp.Download(requestPackageData.latestDownloadUrl, response =>
            {
                if (response.Type == ResponseType.SUCCEED)
                {
                    File.WriteAllBytes(tempFile, response.Bytes);

                    EditorUtility.ClearProgressBar();

                    AssetDatabase.ImportPackage(tempFile, false);

                    File.Delete(tempFile);

                    AssetDatabase.Refresh();

                    Debug.Log("PackageManager:插件下载成功");


                    PackageKitArchitectureConfig.GetModel <IInstalledPackageVersionsConfigModel>()
                    .Reload();
                }
                else
                {
                    EditorUtility.ClearProgressBar();

                    EditorUtility.DisplayDialog(requestPackageData.name,
                                                "插件安装失败,请联系 [email protected] 或者加入 QQ 群:623597263" + response.Error + ";", "OK");
                }
            }, OnProgressChanged);
        }
コード例 #6
0
        public static void DoUpload(PackageVersion packageVersion, System.Action succeed)
        {
            EditorUtility.DisplayProgressBar("插件上传", "打包中...", 0.1f);

            var fileName = packageVersion.Name + "_" + packageVersion.Version + ".unitypackage";
            var fullpath = ExportPaths(fileName, packageVersion.IncludeFileOrFolders.ToArray());
            var file     = File.ReadAllBytes(fullpath);

            var form = new WWWForm();

            form.AddField("username", User.Username.Value);
            form.AddField("password", User.Password.Value);
            form.AddField("name", packageVersion.Name);
            form.AddField("version", packageVersion.Version);
            form.AddBinaryData("file", file);
            form.AddField("releaseNote", packageVersion.Readme.content);
            form.AddField("installPath", packageVersion.InstallPath);
            form.AddField("accessRight", packageVersion.AccessRight.ToString().ToLower());
            form.AddField("docUrl", packageVersion.DocUrl);

            if (packageVersion.Type == PackageType.FrameworkModule)
            {
                form.AddField("type", "fm");
            }
            else if (packageVersion.Type == PackageType.Shader)
            {
                form.AddField("type", "s");
            }
            else if (packageVersion.Type == PackageType.AppOrGameDemoOrTemplate)
            {
                form.AddField("type", "agt");
            }
            else if (packageVersion.Type == PackageType.Plugin)
            {
                form.AddField("type", "p");
            }
            else if (packageVersion.Type == PackageType.Master)
            {
                form.AddField("type", "master");
            }

            Debug.Log(fullpath);

            EditorUtility.DisplayProgressBar("插件上传", "上传中...", 0.2f);

            EditorHttp.Post(UPLOAD_URL, form, (response) =>
            {
                if (response.Type == ResponseType.SUCCEED)
                {
                    EditorUtility.ClearProgressBar();
                    Debug.Log(response.Text);
                    if (succeed != null)
                    {
                        succeed();
                    }

                    File.Delete(fullpath);
                }
                else
                {
                    EditorUtility.ClearProgressBar();
                    EditorUtility.DisplayDialog("插件上传", string.Format("上传失败!{0}", response.Error), "确定");
                    File.Delete(fullpath);
                }
            });
        }