Commit a1b09cc3 authored by JoyJ's avatar JoyJ

add SetCountLimit to effect creator

parent d97f836d
namespace DataEditorX
{
partial class CountLimitForm
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.checkIsOath = new System.Windows.Forms.CheckBox();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.checkIsSingle = new System.Windows.Forms.CheckBox();
this.checkIsHasCode = new System.Windows.Forms.CheckBox();
this.checkIsInDuel = new System.Windows.Forms.CheckBox();
this.btnOK = new System.Windows.Forms.Button();
this.btnCancel = new System.Windows.Forms.Button();
this.numCount = new System.Windows.Forms.NumericUpDown();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.groupBox1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numCount)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
this.SuspendLayout();
//
// checkIsOath
//
this.checkIsOath.AutoSize = true;
this.checkIsOath.Location = new System.Drawing.Point(6, 20);
this.checkIsOath.Name = "checkIsOath";
this.checkIsOath.Size = new System.Drawing.Size(276, 16);
this.checkIsOath.TabIndex = 0;
this.checkIsOath.Text = "誓约效果(发动被无效不计数,效果被无效计数)";
this.checkIsOath.UseVisualStyleBackColor = true;
//
// groupBox1
//
this.groupBox1.Controls.Add(this.label2);
this.groupBox1.Controls.Add(this.checkIsSingle);
this.groupBox1.Controls.Add(this.numericUpDown1);
this.groupBox1.Controls.Add(this.checkIsHasCode);
this.groupBox1.Controls.Add(this.checkIsInDuel);
this.groupBox1.Controls.Add(this.checkIsOath);
this.groupBox1.Location = new System.Drawing.Point(12, 12);
this.groupBox1.Name = "groupBox1";
this.groupBox1.Size = new System.Drawing.Size(290, 109);
this.groupBox1.TabIndex = 1;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "效果特点";
//
// checkIsSingle
//
this.checkIsSingle.AutoSize = true;
this.checkIsSingle.Location = new System.Drawing.Point(6, 86);
this.checkIsSingle.Name = "checkIsSingle";
this.checkIsSingle.Size = new System.Drawing.Size(240, 16);
this.checkIsSingle.TabIndex = 3;
this.checkIsSingle.Text = "与其他效果共用次数,且没有同名卡限制";
this.checkIsSingle.UseVisualStyleBackColor = true;
//
// checkIsHasCode
//
this.checkIsHasCode.AutoSize = true;
this.checkIsHasCode.Location = new System.Drawing.Point(6, 64);
this.checkIsHasCode.Name = "checkIsHasCode";
this.checkIsHasCode.Size = new System.Drawing.Size(108, 16);
this.checkIsHasCode.TabIndex = 2;
this.checkIsHasCode.Text = "同名卡1回合X次";
this.checkIsHasCode.UseVisualStyleBackColor = true;
//
// checkIsInDuel
//
this.checkIsInDuel.AutoSize = true;
this.checkIsInDuel.Location = new System.Drawing.Point(6, 42);
this.checkIsInDuel.Name = "checkIsInDuel";
this.checkIsInDuel.Size = new System.Drawing.Size(126, 16);
this.checkIsInDuel.TabIndex = 1;
this.checkIsInDuel.Text = "决斗中只能发动X次";
this.checkIsInDuel.UseVisualStyleBackColor = true;
//
// btnOK
//
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnOK.DialogResult = System.Windows.Forms.DialogResult.OK;
this.btnOK.Location = new System.Drawing.Point(146, 129);
this.btnOK.Name = "btnOK";
this.btnOK.Size = new System.Drawing.Size(75, 23);
this.btnOK.TabIndex = 2;
this.btnOK.Text = "确定";
this.btnOK.UseVisualStyleBackColor = true;
this.btnOK.Click += new System.EventHandler(this.btnOK_Click);
//
// btnCancel
//
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnCancel.Location = new System.Drawing.Point(227, 129);
this.btnCancel.Name = "btnCancel";
this.btnCancel.Size = new System.Drawing.Size(75, 23);
this.btnCancel.TabIndex = 3;
this.btnCancel.Text = "取消";
this.btnCancel.UseVisualStyleBackColor = true;
//
// numCode
//
this.numCount.Location = new System.Drawing.Point(75, 130);
this.numCount.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numCount.Name = "numCode";
this.numCount.Size = new System.Drawing.Size(57, 21);
this.numCount.TabIndex = 4;
this.numCount.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(16, 133);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(53, 12);
this.label1.TabIndex = 5;
this.label1.Text = "次数限制";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(156, 64);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(53, 12);
this.label2.TabIndex = 7;
this.label2.Text = "code偏移";
//
// numericUpDown1
//
this.numericUpDown1.Location = new System.Drawing.Point(215, 61);
this.numericUpDown1.Maximum = new decimal(new int[] {
10000,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(57, 21);
this.numericUpDown1.TabIndex = 6;
//
// CountLimitForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(319, 164);
this.Controls.Add(this.label1);
this.Controls.Add(this.numCount);
this.Controls.Add(this.btnCancel);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.groupBox1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "CountLimitForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
this.Text = "使用次数限制";
this.groupBox1.ResumeLayout(false);
this.groupBox1.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numCount)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.CheckBox checkIsOath;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.CheckBox checkIsSingle;
private System.Windows.Forms.CheckBox checkIsHasCode;
private System.Windows.Forms.CheckBox checkIsInDuel;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.NumericUpDown numCount;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.NumericUpDown numericUpDown1;
}
}
\ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DataEditorX
{
public partial class CountLimitForm : Form
{
public EffectCountLimit CountLimit;
public CountLimitForm(EffectCountLimit ecl)
{
this.InitializeComponent();
CountLimit = ecl;
this.checkIsOath.Checked = ecl.IsOath;
this.checkIsInDuel.Checked = ecl.IsInDuel;
this.checkIsHasCode.Checked = ecl.IsHasCode;
this.checkIsSingle.Checked = ecl.IsSingle;
this.numCount.Value = ecl.Count;
}
private void btnOK_Click(object sender, EventArgs e)
{
CountLimit.IsOath = this.checkIsOath.Checked;
CountLimit.IsInDuel = this.checkIsInDuel.Checked;
CountLimit.IsHasCode = this.checkIsHasCode.Checked;
CountLimit.IsSingle = this.checkIsSingle.Checked;
CountLimit.Count = this.numCount.Value;
}
}
public class EffectCountLimit
{
public bool IsOath = false;
public bool IsInDuel = false;
public bool IsHasCode = false;
public bool IsSingle = false;
public decimal Code;
public decimal Offset;
public decimal Count;
public EffectCountLimit(decimal code)
{
Code = code;
Offset = 0;
}
public EffectCountLimit(decimal code, decimal offset)
{
Code = code;
Offset = offset;
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file
......@@ -149,6 +149,12 @@
<Compile Include="Core\TaskHelper.cs" />
<Compile Include="Core\TCGEditor\CardSet.cs" />
<Compile Include="Core\YGOUtil.cs" />
<Compile Include="CountLimitForm.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="CountLimitForm.Designer.cs">
<DependentUpon>CountLimitForm.cs</DependentUpon>
</Compile>
<Compile Include="DataEditForm.cs">
<SubType>Form</SubType>
</Compile>
......@@ -240,6 +246,9 @@
<EmbeddedResource Include="Controls\FastColoredTextBoxEx.resx">
<DependentUpon>FastColoredTextBoxEx.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="CountLimitForm.resx">
<DependentUpon>CountLimitForm.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="DataEditForm.resx">
<DependentUpon>DataEditForm.cs</DependentUpon>
</EmbeddedResource>
......
This diff is collapsed.
......@@ -90,11 +90,57 @@ private void btnStart_Click(object sender, EventArgs e)
sb.Append(this.ProcessSpecialOptions());
sb.Append(this.ProcessEffectType());
sb.Append(this.ProcessEffectCategory());
sb.Append(this.ProcessEffectCountLimit());
sb.Append(this.ProcessEffectProperty());
sb.Append(this.ProcessEffectCode());
txtOutput.Text = sb.ToString();
}
private string LinkStrings(List<string> list)
{
if (list.Count == 0)
{
return "";
}
string result = list[0];
for (int i = 1; i < list.Count; i++)
{
result += $"+{list[i]}";
}
return result;
}
private string ProcessEffectCountLimit()
{
if (!checkCountLimit.Checked || countLimit == null)
{
return "";
}
List<string> extraOptions = new List<string>();
if (countLimit.IsHasCode)
{
extraOptions.Add(countLimit.Code.ToString());
if (countLimit.Offset > 0)
{
extraOptions.Add(countLimit.Offset.ToString());
}
}
if (countLimit.IsInDuel)
{
extraOptions.Add("EFFECT_COUNT_CODE_DUEL");
}
if (countLimit.IsOath)
{
extraOptions.Add("EFFECT_COUNT_CODE_OATH");
}
if (countLimit.IsSingle)
{
extraOptions.Add("EFFECT_COUNT_CODE_SINGLE");
}
if (extraOptions.Count > 0)
{
return $"e{numEffectNum}:SetCountLimit({countLimit.Count},{this.LinkStrings(extraOptions)})";
}
return $"e{numEffectNum}:SetCountLimit({countLimit.Count})";
}
private string ProcessEffectProperty()
{
var selected = (from EffectCreatorItem item in listEffectProperty.Items.Cast<EffectCreatorItem>()
......@@ -263,5 +309,22 @@ private void txtSearchProperty_TextChanged(object sender, EventArgs e)
{
this.SearchListBoxWithTextBox(ref listEffectProperty, txtSearchProperty);
}
EffectCountLimit countLimit = null;
private void checkCountLimit_CheckedChanged(object sender, EventArgs e)
{
if (checkCountLimit.Checked)
{
if (countLimit == null)
{
countLimit = new EffectCountLimit(numCardCode.Value);
}
CountLimitForm form = new CountLimitForm(countLimit);
if (form.ShowDialog() == DialogResult.OK)
{
countLimit = form.CountLimit;
}
}
}
}
}
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