/// <summary> /// 村人:変数挿入 /// </summary> private void btnInsertValueMsg_Click(object sender, EventArgs e) { var Dlg = new Dialog.Text.Script.dlgInsertDB(this.dbList, false, true); if (Dlg.ShowDialog() == DialogResult.OK) { this.txtMessageMsg.SelectedText = "{" + Dlg.Result + "}"; } }
/// <summary> /// ノードから挿入コードを返します。 /// </summary> public string GetNodeCode(TreeNode node, out bool forbiddenCRLF) { var code = ""; var nodeTag = node.Tag?.ToString(); var nodes = node.FullPath.Split(new char[] { '\\' }); forbiddenCRLF = false; //ルートノードで判別 switch (nodes[0]) { case NodeSQValue: //スクリプト共通変数 var DlgDB1 = new Dialog.Text.Script.dlgInsertDB(this.dbCtl.DBList, false, true); if (DlgDB1.ShowDialog() != DialogResult.OK) { return(""); } code = DlgDB1.Result; break; case NodeTool: //各種ツール code = this.getCodeTool(node); forbiddenCRLF = true; break; case NodeEasyTool: //イベントコマンド簡易編集ツール if (!this.EnabledEasyEditorTools) { MessageBox.Show("Easyエディターはイベント編集時のみ有効です。", Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); break; } code = this.getCodeEasyTool(node); break; default: //一般的なコード挿入 code = this.getCodeObject(node); break; } return(code); }
/// <summary> /// ツールによって挿入コードを生成します。 /// </summary> private string getCodeTool(TreeNode node) { var nodeTag = node.Tag?.ToString(); switch (nodeTag) { case TagToolMessage: var DlgMsg = new Dialog.Text.Script.dlgEVcmdMessage(this.dbCtl.DBList); if (DlgMsg.ShowDialog() != DialogResult.OK) { return(""); } return(DlgMsg.Result); case TagToolFileName: var DlgFN = new Dialog.Common.dlgFileSelect(null, "", true, true, false); if (DlgFN.ShowDialog() != DialogResult.OK) { return(""); } //両端のダブルクォートとパス区切り記号のエスケープシーケンス化 return("\"" + DlgFN.FileName.Replace("\\", "\\\\") + "\""); case TagToolEVID: if (this.ParentForm is Dialog.Map.dlgEVSettings) { //イベント編集画面のときに限る if (this.mgrMap.MapData == null) { //編集中のマップが存在しない return(""); } var DlgEVID = new Dialog.Common.dlgSelectInList("イベントIDの挿入"); for (var i = 0; i < this.mgrMap.MapData.EVCount; i++) { DlgEVID.AddItem(this.mgrMap.MapData[i].VisibleID, this.mgrMap.MapData[i].Name); } if (DlgEVID.ShowDialog() != DialogResult.OK) { //ダイアログ中断 return(""); } if (!Settings.Default.Script_FixedIDHexMode) { //10進数のID表記 return(this.mgrMap.MapData[DlgEVID.GetResultIndex()].FixedID.ToString() + "/*" + DlgEVID.GetResultTitle() + "*/"); } else { //16進数のID表記 return("0x" + this.mgrMap.MapData[DlgEVID.GetResultIndex()].FixedID.ToString("X") + "/*" + DlgEVID.GetResultTitle() + "*/"); } } else { MessageBox.Show("イベントIDの挿入はマップエディター上のイベント編集画面でのみ有効です。", Resources.AppName, MessageBoxButtons.OK, MessageBoxIcon.Error); return(""); } case TagToolDBID: case TagToolDBColumn: var DlgDB2 = new Dialog.Text.Script.dlgInsertDB(this.dbCtl.DBList, (nodeTag == TagToolDBColumn) ? true : false, false); if (DlgDB2.ShowDialog() != DialogResult.OK) { return(""); } return(DlgDB2.Result); case TagToolChangeMap: var DlgMap = new Dialog.Text.Script.dlgEVcmdChangeMap(this.dbCtl.DBList); if (DlgMap.ShowDialog() != DialogResult.OK) { return(""); } return(DlgMap.Result); case TagToolColor: var DlgCLR = new ColorDialog { AllowFullOpen = true, FullOpen = true }; if (DlgCLR.ShowDialog() != DialogResult.OK) { return(""); } //RGBの順で3つの引数を作り、カラーコードを取得する関数をセットにする return(Resources.SQ_GetColor.Replace("$", $"{DlgCLR.Color.R}, {DlgCLR.Color.G}, {DlgCLR.Color.B}")); case TagToolPathNormalEV: case TagToolPathExtraEV: case TagToolPathExtraPlayer: var DlgPath = new Dialog.Text.Script.dlgEVcmdMoveTask( nodeTag != TagToolPathNormalEV, nodeTag == TagToolPathExtraPlayer ); if (DlgPath.ShowDialog() != DialogResult.OK) { return(""); } return(DlgPath.Result); case TagSQTagSummary: return(GenerateGlueCode.GenerateSQDocument.SQ_TAG + GenerateGlueCode.GenerateSQDocument.DOC_SUMMARY + "\r\n"); case TagSQTagNode: return(GenerateGlueCode.GenerateSQDocument.SQ_TAG + GenerateGlueCode.GenerateSQDocument.DOC_PATH + "\r\n"); case TagSQTagParameter: return(GenerateGlueCode.GenerateSQDocument.SQ_TAG + GenerateGlueCode.GenerateSQDocument.DOC_PARAM + "\r\n"); case TagSQTagReturn: return(GenerateGlueCode.GenerateSQDocument.SQ_TAG + GenerateGlueCode.GenerateSQDocument.DOC_RETURN + "\r\n"); case TagSQTagComment: return(GenerateGlueCode.GenerateSQDocument.SQ_TAG + GenerateGlueCode.GenerateSQDocument.DOC_COMMENT + "\r\n"); } return(""); }