Commit 073c2cf7 authored by JoyJ's avatar JoyJ

add modify, copy and paste, double-click function

parent 0e68accd
......@@ -37,13 +37,16 @@
this.sfdJson = new System.Windows.Forms.SaveFileDialog();
this.btnLoad = new System.Windows.Forms.Button();
this.ofdJson = new System.Windows.Forms.OpenFileDialog();
this.btnModify = new System.Windows.Forms.Button();
this.SuspendLayout();
//
// txtString
//
this.txtString.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtString.Location = new System.Drawing.Point(12, 12);
this.txtString.Name = "txtString";
this.txtString.Size = new System.Drawing.Size(398, 19);
this.txtString.Size = new System.Drawing.Size(340, 19);
this.txtString.TabIndex = 6;
//
// listJsonType
......@@ -65,7 +68,7 @@
"activate|AI将一个效果发动时。{0}为发动的效果的卡名",
"summon|AI将怪兽出场时,包含召唤、反转召唤、特殊召唤。{0}为召唤的卡名",
"setmonster|AI将怪兽盖伏时",
"chaining|AI进行连锁时。{0}为连锁的卡名"});
"chaining|AI进行连锁时。{0}为AI发动的连锁的卡名"});
this.listJsonType.Location = new System.Drawing.Point(12, 37);
this.listJsonType.Name = "listJsonType";
this.listJsonType.Size = new System.Drawing.Size(398, 292);
......@@ -83,9 +86,12 @@
this.listJsonString.Name = "listJsonString";
this.listJsonString.Size = new System.Drawing.Size(235, 292);
this.listJsonString.TabIndex = 3;
this.listJsonString.DoubleClick += new System.EventHandler(this.listJsonString_DoubleClick);
this.listJsonString.KeyDown += new System.Windows.Forms.KeyEventHandler(this.listJsonString_KeyDown);
//
// btnAdd
//
this.btnAdd.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnAdd.Location = new System.Drawing.Point(416, 8);
this.btnAdd.Name = "btnAdd";
this.btnAdd.Size = new System.Drawing.Size(52, 23);
......@@ -96,6 +102,7 @@
//
// btnDeleteSelected
//
this.btnDeleteSelected.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnDeleteSelected.Location = new System.Drawing.Point(474, 8);
this.btnDeleteSelected.Name = "btnDeleteSelected";
this.btnDeleteSelected.Size = new System.Drawing.Size(63, 23);
......@@ -106,6 +113,7 @@
//
// btnSave
//
this.btnSave.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnSave.Location = new System.Drawing.Point(543, 8);
this.btnSave.Name = "btnSave";
this.btnSave.Size = new System.Drawing.Size(51, 23);
......@@ -122,6 +130,7 @@
//
// btnLoad
//
this.btnLoad.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnLoad.Location = new System.Drawing.Point(600, 8);
this.btnLoad.Name = "btnLoad";
this.btnLoad.Size = new System.Drawing.Size(51, 23);
......@@ -134,11 +143,23 @@
//
this.ofdJson.FileName = "openFileDialog1";
//
// Form1
// btnModify
//
this.btnModify.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnModify.Location = new System.Drawing.Point(358, 8);
this.btnModify.Name = "btnModify";
this.btnModify.Size = new System.Drawing.Size(52, 23);
this.btnModify.TabIndex = 11;
this.btnModify.Text = "修改";
this.btnModify.UseVisualStyleBackColor = true;
this.btnModify.Click += new System.EventHandler(this.btnModify_Click);
//
// WBJsonGenerator
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(663, 339);
this.Controls.Add(this.btnModify);
this.Controls.Add(this.btnLoad);
this.Controls.Add(this.btnSave);
this.Controls.Add(this.btnDeleteSelected);
......@@ -146,8 +167,8 @@
this.Controls.Add(this.txtString);
this.Controls.Add(this.listJsonString);
this.Controls.Add(this.listJsonType);
this.Name = "Form1";
this.Text = "Windbot台词生成器 v0.1 by JoyJ";
this.Name = "WBJsonGenerator";
this.Text = "Windbot台词生成器 v1.0 by JoyJ";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout();
......@@ -165,6 +186,7 @@
private System.Windows.Forms.SaveFileDialog sfdJson;
private System.Windows.Forms.Button btnLoad;
private System.Windows.Forms.OpenFileDialog ofdJson;
private System.Windows.Forms.Button btnModify;
}
}
......@@ -95,6 +95,12 @@ namespace WBJsonGenerator
}
newDic.Add(kvp.Key, kvp.Value);
}
int i = 0;
while (File.Exists($"Lucky{i}.zh-CN.json"))
{
i++;
}
sfdJson.FileName = $"Lucky{i}.zh-CN.json";
if (sfdJson.ShowDialog() == DialogResult.OK)
{
File.WriteAllText(sfdJson.FileName,jss.Serialize(newDic));
......@@ -112,10 +118,6 @@ namespace WBJsonGenerator
dic.Clear();
foreach(var kvp in obj)
{
if (kvp.Key == "facedownmonstername")
{
}
dic.Add(kvp.Key, new List<string>());
if (kvp.Value is string)
{
......@@ -133,5 +135,42 @@ namespace WBJsonGenerator
listJsonString.Items.Clear();
}
}
private void listJsonString_DoubleClick(object sender, EventArgs e)
{
if (listJsonString.SelectedItem == null)
{
return;
}
txtString.Text = listJsonString.SelectedItem.ToString();
}
private void listJsonString_KeyDown(object sender, KeyEventArgs e)
{
if (listJsonString.SelectedItem == null)
{
return;
}
if (e.Control && e.KeyCode == Keys.C)
{
Clipboard.SetText(listJsonString.SelectedItem.ToString());
}
if (e.Control && e.KeyCode == Keys.V)
{
dic[listJsonType.SelectedItem.ToString().Split('|')[0]].Add(Clipboard.GetText());
listJsonString.Items.Add(Clipboard.GetText());
}
}
private void btnModify_Click(object sender, EventArgs e)
{
if (listJsonString.SelectedItem == null)
{
return;
}
int insert = listJsonString.SelectedIndex;
dic[listJsonType.SelectedItem.ToString().Split('|')[0]][insert] = txtString.Text;
listJsonString.Items[insert] = txtString.Text;
}
}
}
{"welcome":["喂,来决斗吧。"],"deckerror":["{0}用不了啊?"],"duelstart":["请多指教。","打牌打牌。","我看看这个卡组能不能摆烂啊。"],"newturn":["到我。","抽卡。","抽一张,有没有事?","抽卡,准备,主要,有没有事?"],"endturn":["回合结束。","结束。","到你。","就这样吧。"],"directattack":["{0}直击。","{0}直击有没有事?"],"attack":["{0}打{1}有没有事?","{0}打{1}。","{0}攻击{1}。","用{0}攻击{1}。","{0}摸一下{1}。","{0}摸一下{1}有没有事?"],"ondirectattack":["吃了。","哎哟,有点疼。","吃下。","掉血。","扣血。","没有连锁。"],"facedownmonstername":"盖卡","activate":["{0}发动。","{0}发动,有没有事?","{0}发效。","{0}发效有没有事?","{0}发效有连锁吗?"],"summon":["{0}。","那就{0}。","那就{0}吧。","召唤{0}。"],"setmonster":["盖一张怪。","盖只怪。","盖怪。"],"chaining":["等一下,连锁{0}。","停,我连锁{0}。","连锁{0}。"]}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment