Exemple #1
0
        private void btnSelectGameDir_Click(Object sender, EventArgs e)
        {
            string path = "";

            var browser = new FolderBrowserDialog();
            var result  = browser.ShowDialog();

            if (result == DialogResult.OK)
            {
                path = browser.SelectedPath;
                if (!File.Exists(path + "/bin/Client.exe"))
                {
                    BstManager.DisplayErrorMessageBox(
                        this._i18N.LoadI18NValue("GuiUtil", "boxTitle"),
                        this._i18N.LoadI18NValue("GuiUtil", "boxMessage")
                        );
                }
                else
                {
                    this.textBoxGameDir.Text = path;
                    BstManager.Instance.SystemSettings["path"]["game"] = path;
                    BstManager.WriteJsonFile(BstManager.PathJsonSettings, BstManager.Instance.SystemSettings);
                }
            }
        }
Exemple #2
0
 private void btnReplace_Click(Object sender, EventArgs e)
 {
     // 替换模型
     if (this._originElementId == null)
     {
         BstManager.DisplayErrorMessageBox(
             this._i18N.LoadI18NValue("GuiItems", "actionReplaceErrorTitle"),
             this._i18N.LoadI18NValue("GuiItems", "actionOriginEmptyErrorMsg")
             );
         return;
     }
     if (this._targetElementId == null)
     {
         BstManager.DisplayErrorMessageBox(
             this._i18N.LoadI18NValue("GuiItems", "actionReplaceErrorTitle"),
             this._i18N.LoadI18NValue("GuiItems", "actionTargetEmptyErrorMsg")
             );
         return;
     }
     if (this._originElementId == this._targetElementId)
     {
         BstManager.DisplayErrorMessageBox(
             this._i18N.LoadI18NValue("GuiItems", "actionReplaceErrorTitle"),
             this._i18N.LoadI18NValue("GuiItems", "actionTargetSameErrorMsg")
             );
         return;
     }
     if (this._formType == BstManager.TypeWeapon) // 只有武器不可替换
     {
         // FIXME 后续制作功能,并开发这个限制
         BstManager.DisplayErrorMessageBox(
             this._i18N.LoadI18NValue("GuiItems", "actionFuncNotDoneTitle"),
             this._i18N.LoadI18NValue("GuiItems", "actionWaitForFuncMsg")
             );
         return;
     }
     if (BstManager.DisplayConfirmMessageBox(
             this._i18N.LoadI18NValue("GuiItems", "actionConfirmTitle"),
             this._i18N.LoadI18NValue("GuiItems", "actionReplaceMsg")) == DialogResult.OK)
     {
         string race = null;
         if (this._formType == BstManager.TypeAttach ||
             this._formType == BstManager.TypeCostume)
         {
             race = BstManager.Instance.RaceTypes[this.comboBoxRace.SelectedIndex];
         }
         BstManager.Instance.RunGrunt(this.textBoxOut, "replace", new string[]
         {
             "--part=" + BstManager.GetTypeName(this._formType),
             "--model=" + this._targetElementId,
             "--race=" + race
         });
     }
 }
Exemple #3
0
 private void btnView2DTarget_Click(Object sender, EventArgs e)
 {
     // 预览目标模型2D截图
     if (this._targetElementId == null)
     {
         BstManager.DisplayErrorMessageBox(
             this._i18N.LoadI18NValue("GuiItems", "actionSelectErrorTitle"),
             this._i18N.LoadI18NValue("GuiItems", "actionSelectTargetErrorMsg")
             );
         return;
     }
     this.CreatePictureForm(this._targetElementId);
 }
Exemple #4
0
 private void CheckBnsGamePath()
 {
     new Thread(() =>
     {
         var gamePath = (string)BstManager.Instance.SystemSettings["path"]["game"];
         if (!Directory.Exists(gamePath) || !File.Exists(gamePath + "/bin/Client.exe"))
         {
             // 游戏地址配置不存在或不正确,更新为null
             BstManager.Instance.SystemSettings["path"]["game"] = null;
             BstManager.WriteJsonFile(BstManager.PathJsonSettings, BstManager.Instance.SystemSettings);
             BstManager.DisplayErrorMessageBox(
                 BstI18NLoader.Instance.LoadI18NValue("App", "gamePathErrTitle"),
                 BstI18NLoader.Instance.LoadI18NValue("App", "gamePathErrContent")
                 );
         }
     }).Start();
 }
Exemple #5
0
 private void btnView3DInfo_Click(Object sender, EventArgs e)
 {
     // 预览选中的对象的3D模型
     if (this._selectedElementId == null)
     {
         BstManager.DisplayErrorMessageBox(
             this._i18N.LoadI18NValue("GuiItems", "actionSelectErrorTitle"),
             this._i18N.LoadI18NValue("GuiItems", "actionSelectTargetErrorMsg")
             );
         return;
     }
     BstManager.Instance.RunGrunt(this.textBoxOut, "upk_viewer", new string[]
     {
         "--part=" + BstManager.GetTypeName(this._formType),
         "--model=" + this._selectedElementId
     });
 }
Exemple #6
0
        private void btnSelectTarget_Click(Object sender, EventArgs e)
        {
            // 将当前选中的物件设为目标模型
            if (this._selectedElementId == null)
            {
                BstManager.DisplayErrorMessageBox(
                    this._i18N.LoadI18NValue("GuiItems", "actionSelectErrorTitle"),
                    this._i18N.LoadI18NValue("GuiItems", "actionSelectTargetErrorMsg")
                    );
                return; // 没有选中的元素,直接退出
            }
            this._targetElementId = this._selectedElementId;
            var element = (JObject)this._data[this._selectedElementId];

            // 展示icon,该icon应该已经有本地缓存,直接读取本地缓存
            this.LoadOriginAndTargetIconPic(this.pictureBoxTarget, element);
            // 显示模型数据
            this.textBoxTarget.Text = element.ToString();
        }
Exemple #7
0
        private void btnSelectOrigin_Click(Object sender, EventArgs e)
        {
            // 将当前选中的物件设为原始模型
            if (this._selectedElementId == null)
            {
                BstManager.DisplayErrorMessageBox(
                    this._i18N.LoadI18NValue("GuiItems", "actionSelectErrorTitle"),
                    this._i18N.LoadI18NValue("GuiItems", "actionSelectTargetErrorMsg")
                    );
                return; // 没有选中的元素,直接退出
            }
            var element = (JObject)this._data[this._selectedElementId];

            this._originElementId = this._selectedElementId;
            // 展示icon,该icon应该已经有本地缓存,直接读取本地缓存
            this.LoadOriginAndTargetIconPic(this.pictureBoxOrigin, element);
            // 显示模型数据
            this.textBoxOrigin.Text = element.ToString();
            // 存储原始模型数据
            var originData = new JObject();

            originData["id"]   = this._originElementId;
            originData["data"] = element;
            if (this._formType == BstManager.TypeAttach ||
                this._formType == BstManager.TypeCostume)
            {
                var originRace = (string)element["race"];
                if (Regex.IsMatch(originRace, BstManager.Instance.RaceTypes[BstManager.RaceIdLyn], RegexOptions.IgnoreCase))
                {
                    originRace = BstManager.Instance.RaceTypes[BstManager.RaceIdLyn];
                }
                this._originSettings[originRace] = originData;
            }
            else
            {
                this._originSettings = originData;
            }
            BstManager.WriteJsonFile(BstManager.GetItemOriginJsonPath(this._formType), this._originSettings);
        }
Exemple #8
0
        private void btnReportIssue_Click(Object sender, EventArgs e)
        {
            // 获得数据
            var originInfo  = this.textBoxOrigin.Text;
            var targetInfo  = this.textBoxTarget.Text;
            var consoleInfo = this.textBoxOut.Text;

            // 检查数据
            if (string.IsNullOrEmpty(originInfo))
            {
                BstManager.DisplayErrorMessageBox(
                    this._i18N.LoadI18NValue("GuiItems", "actionReportErrorTitle"),
                    this._i18N.LoadI18NValue("GuiItems", "actionSelectOriginErrorMsg")
                    );
                return;
            }
            if (string.IsNullOrEmpty(targetInfo))
            {
                BstManager.DisplayErrorMessageBox(
                    this._i18N.LoadI18NValue("GuiItems", "actionReportErrorTitle"),
                    this._i18N.LoadI18NValue("GuiItems", "actionSelectTargetErrorMsg")
                    );
                return;
            }
            var hasGruntRunSign = false;

            for (var lineNo = 0; lineNo < this.textBoxOut.Lines.Length; lineNo++)
            {
                var lineText = this.textBoxOut.Lines[lineNo];
                if (lineText.Contains(BstManager.GruntRunSign))
                {
                    hasGruntRunSign = true;
                    break;
                }
            }
            if (!hasGruntRunSign)
            {
                BstManager.DisplayErrorMessageBox(
                    this._i18N.LoadI18NValue("GuiItems", "actionReportErrorTitle"),
                    this._i18N.LoadI18NValue("GuiItems", "actionReportErrorMsg")
                    );
                return;
            }

            // 发送报告
            using (var wb = new WebClient())
            {
                var data = new NameValueCollection();
                data["origin"]  = originInfo;
                data["target"]  = targetInfo;
                data["console"] = consoleInfo;

                var response    = wb.UploadValues(BstManager.BstReportServerUrl, "POST", data);
                var responseStr = System.Text.Encoding.ASCII.GetString(response, 0, response.Length);

                if (Regex.IsMatch(responseStr, BstManager.BstReportAlreadyExists))
                {
                    responseStr = responseStr.Substring(3); // remove prefix "-3|"
                    BstManager.DisplayInfoMessageBox(
                        this._i18N.LoadI18NValue("GuiItems", "reportErrorTitle"),
                        string.Format(this._i18N.LoadI18NValue("GuiItems", "reportAlreadyExists"), responseStr)
                        );
                }
                else
                {
                    switch (responseStr)
                    {
                    case BstManager.BstReportMissingInfo:
                        BstManager.DisplayErrorMessageBox(
                            this._i18N.LoadI18NValue("GuiItems", "reportErrorTitle"),
                            this._i18N.LoadI18NValue("GuiItems", "reportMissingInfo")
                            );
                        break;

                    case BstManager.BstReportInvalidJson:
                        BstManager.DisplayErrorMessageBox(
                            this._i18N.LoadI18NValue("GuiItems", "reportErrorTitle"),
                            this._i18N.LoadI18NValue("GuiItems", "reportInvalidJson")
                            );
                        break;

                    default:
                        BstManager.DisplayInfoMessageBox(
                            this._i18N.LoadI18NValue("GuiItems", "reportSucceedTitle"),
                            string.Format(this._i18N.LoadI18NValue("GuiItems", "reportSucceedMsg"), responseStr)
                            );
                        break;
                    }
                }
            }
        }