add RMSE method, MatchCount option

This commit is contained in:
sup39 2022-07-31 02:19:51 +09:00
parent 6b37c1c326
commit fd78232340
9 changed files with 910 additions and 829 deletions

View file

@ -13,7 +13,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("supAutoSplit")]
[assembly: AssemblyCopyright("Copyright © 2021 sup39[サポミク]")]
[assembly: AssemblyCopyright("Copyright © 2021-2022 sup39[サポミク]")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]

View file

@ -18,6 +18,8 @@ namespace LiveSplit.SupAutoSplit {
private TimerModel Model { get; }
public Component(LiveSplitState state) {
// TODO
Environment.SetEnvironmentVariable("OPENCV_VIDEOIO_MSMF_ENABLE_HW_TRANSFORMS", "0", EnvironmentVariableTarget.User);
Settings = new UI.Settings();
State = state;
Model = new TimerModel {
@ -126,7 +128,10 @@ namespace LiveSplit.SupAutoSplit {
private readonly Predicate<double> fMatch;
private readonly Predicate<double> fMatchNeg;
public Action<TimerModel> Action { get; }
private bool ready = false;
private int ready = 0;
private readonly int maxReady;
private int count = 0;
private readonly int maxCount;
public MatchHandler(UI.TemplateSettings settings) {
fEnabled = settings.EnableIf;
@ -137,18 +142,15 @@ namespace LiveSplit.SupAutoSplit {
var threshold = settings.MatchThreshold;
var thresholdNeg = settings.MatchThresholdNeg;
if (thresholdNeg <= 0) thresholdNeg = threshold;
if (settings.IsActionOnPosedge) {
maxReady = settings.IsActionOnPosedge ? 1 : 2;
fMatch = sim => sim <= threshold;
fMatchNeg = sim => sim >= thresholdNeg;
} else {
fMatch = sim => sim >= threshold;
fMatchNeg = sim => sim <= thresholdNeg;
}
maxCount = settings.MatchCount;
Action = settings.MatchAction;
}
public bool Reset(LiveSplitState state) {
ready = false;
ready = count = 0;
return fEnabled(state);
}
public bool Match(Mat frame) {
@ -157,10 +159,12 @@ namespace LiveSplit.SupAutoSplit {
var sim = fSim(fimg);
// sw.Stop();
// Debug.WriteLine($"#sim {sim} | {sw.ElapsedMilliseconds} ({sw.ElapsedTicks})");
if (ready) {
return fMatch(sim);
} else if (fMatchNeg(sim)) {
ready = true;
Debug.WriteLine($"#[{count}/{maxCount}] {sim} {ready}");
if (((ready & 1) == 0 ? fMatchNeg : fMatch)(sim)) {
if (++ready > maxReady) {
ready = 0;
return ++count >= maxCount;
}
}
return false;
}

View file

@ -16,11 +16,11 @@ namespace LiveSplit.SupAutoSplit {
public string UpdateName => ComponentName;
public string XMLURL => "https://301.sup39.ml/LiveSplit/supAutoSplit.xml"; // TODO
public string XMLURL => "https://link.sup39.dev/LiveSplit/supAutoSplit.xml"; // TODO
public string UpdateURL => "https://301.sup39.ml/LiveSplit/supAutoSplit/update"; // TODO
public string UpdateURL => "https://link.sup39.dev/LiveSplit/supAutoSplit/update"; // TODO
public Version Version => Version.Parse("0.1.0");
public Version Version => Version.Parse("0.1.1");
public IComponent Create(LiveSplitState state) => new Component(state);
}

View file

@ -18,7 +18,7 @@ namespace LiveSplit.SupAutoSplit {
static public readonly ListItem<EnableIfFactory>[] EnableIfFactories = {
("Index", "Split Index in range", arg => {
var testers = arg.Split(',').Select(s => {
string[] ns = arg.Split(':');
string[] ns = s.Split(':');
if (ns.Length == 0 || ns.Length > 3) return null;
int start = 0, end = int.MaxValue, step = 1;
if (ns[0] != "" && !int.TryParse(ns[0], out start)) return null;
@ -90,6 +90,15 @@ namespace LiveSplit.SupAutoSplit {
return d2/f1/b1;
};
}),
("RMSE", "Root Mean Squared Error", timg => {
Mat[] bimgs = timg.Split();
Mat bimg = new Mat();
Mat mask = bimgs[3];
Array.Resize(ref bimgs, 3);
Cv2.Merge(bimgs, bimg);
var div = Math.Sqrt(3*bimg.Total())*255.0;
return fimg => Math.Sqrt(Cv2.Norm(fimg, bimg, NormTypes.L2SQR, mask))/div;
}),
("V128_BINARY", "V128 Binary Classification: MAX(R,G,B)<128 or not", timg => {
Mat bimg;
{

View file

@ -76,17 +76,24 @@ namespace LiveSplit.SupAutoSplit.UI {
private void AddTemplateSettings(XmlElement settings) {
var irow = tlpTemplates.RowCount;
tlpTemplates.RowCount = irow + 1;
tlpTemplates.RowStyles.Add(new RowStyle(SizeType.AutoSize));
tlpTemplates.RowStyles.Insert(0, new RowStyle(SizeType.AutoSize));
var v = new TemplateSettings(settings, o => {
tlpTemplates.Controls.Remove(o);
tlpTemplates.RowCount = irow;
tlpTemplates.RowStyles.RemoveAt(irow);
var irowD = tlpTemplates.RowCount - 1;
tlpTemplates.RowCount = irowD;
tlpTemplates.RowStyles.RemoveAt(0); // remove 1 TemplateSettings RowStyle
TemplateSettings.Remove(o);
// move button to the last row
tlpTemplates.Controls.Remove(btnAddTemplate);
tlpTemplates.Controls.Add(btnAddTemplate, 0, irowD - 1);
});
// tlpTemplates.RowStyles.Add(new RowStyle(SizeType.Absolute, v.Height));
// v.Width = tlpTemplates.Width;
tlpTemplates.Controls.Add(v, 0, irow);
// move button to the last row
tlpTemplates.Controls.Remove(btnAddTemplate);
tlpTemplates.Controls.Add(btnAddTemplate, 0, irow);
// add new template view
tlpTemplates.Controls.Add(v, 0, irow - 1);
TemplateSettings.Add(v);
// TODO scroll to bottom
}
}
}

View file

@ -23,9 +23,11 @@
/// コード エディターで変更しないでください。
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.ofdTemplate = new System.Windows.Forms.OpenFileDialog();
this.gpbRoot = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.label8 = new System.Windows.Forms.Label();
this.ttbThresholdNeg = new System.Windows.Forms.TextBox();
this.cbbEnableIf = new System.Windows.Forms.ComboBox();
this.cbbActionTiming = new System.Windows.Forms.ComboBox();
@ -51,9 +53,13 @@
this.btnRemove = new System.Windows.Forms.Button();
this.label3 = new System.Windows.Forms.Label();
this.label6 = new System.Windows.Forms.Label();
this.nudMatchCount = new System.Windows.Forms.NumericUpDown();
this.templateSettingsBindingSource = new System.Windows.Forms.BindingSource(this.components);
this.gpbRoot.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.flowLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudMatchCount)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.templateSettingsBindingSource)).BeginInit();
this.SuspendLayout();
//
// ofdTemplate
@ -70,7 +76,7 @@
this.gpbRoot.Dock = System.Windows.Forms.DockStyle.Fill;
this.gpbRoot.Location = new System.Drawing.Point(0, 0);
this.gpbRoot.Name = "gpbRoot";
this.gpbRoot.Size = new System.Drawing.Size(434, 314);
this.gpbRoot.Size = new System.Drawing.Size(434, 318);
this.gpbRoot.TabIndex = 16;
this.gpbRoot.TabStop = false;
this.gpbRoot.Text = "Template: ";
@ -81,6 +87,7 @@
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 126F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Controls.Add(this.label8, 0, 9);
this.tableLayoutPanel3.Controls.Add(this.ttbThresholdNeg, 1, 8);
this.tableLayoutPanel3.Controls.Add(this.cbbEnableIf, 1, 1);
this.tableLayoutPanel3.Controls.Add(this.cbbActionTiming, 1, 3);
@ -98,13 +105,14 @@
this.tableLayoutPanel3.Controls.Add(this.flowLayoutPanel3, 1, 5);
this.tableLayoutPanel3.Controls.Add(this.btnImage, 1, 4);
this.tableLayoutPanel3.Controls.Add(this.ttbEnableIfArg, 2, 1);
this.tableLayoutPanel3.Controls.Add(this.btnRemove, 2, 9);
this.tableLayoutPanel3.Controls.Add(this.btnRemove, 2, 10);
this.tableLayoutPanel3.Controls.Add(this.label3, 0, 3);
this.tableLayoutPanel3.Controls.Add(this.label6, 0, 8);
this.tableLayoutPanel3.Controls.Add(this.nudMatchCount, 1, 9);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 18);
this.tableLayoutPanel3.Location = new System.Drawing.Point(3, 15);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 10;
this.tableLayoutPanel3.RowCount = 11;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
@ -115,17 +123,29 @@
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel3.Size = new System.Drawing.Size(428, 293);
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(428, 300);
this.tableLayoutPanel3.TabIndex = 2;
//
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(3, 253);
this.label8.Margin = new System.Windows.Forms.Padding(3);
this.label8.Name = "label8";
this.label8.Padding = new System.Windows.Forms.Padding(3);
this.label8.Size = new System.Drawing.Size(78, 18);
this.label8.TabIndex = 29;
this.label8.Text = "Match Count:";
//
// ttbThresholdNeg
//
this.tableLayoutPanel3.SetColumnSpan(this.ttbThresholdNeg, 2);
this.ttbThresholdNeg.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "MatchThresholdNegStr", true));
this.ttbThresholdNeg.Dock = System.Windows.Forms.DockStyle.Fill;
this.ttbThresholdNeg.Location = new System.Drawing.Point(97, 239);
this.ttbThresholdNeg.Location = new System.Drawing.Point(105, 228);
this.ttbThresholdNeg.Name = "ttbThresholdNeg";
this.ttbThresholdNeg.Size = new System.Drawing.Size(328, 22);
this.ttbThresholdNeg.Size = new System.Drawing.Size(320, 19);
this.ttbThresholdNeg.TabIndex = 28;
//
// cbbEnableIf
@ -133,7 +153,7 @@
this.cbbEnableIf.Dock = System.Windows.Forms.DockStyle.Fill;
this.cbbEnableIf.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbbEnableIf.FormattingEnabled = true;
this.cbbEnableIf.Location = new System.Drawing.Point(97, 31);
this.cbbEnableIf.Location = new System.Drawing.Point(105, 28);
this.cbbEnableIf.Name = "cbbEnableIf";
this.cbbEnableIf.Size = new System.Drawing.Size(120, 20);
this.cbbEnableIf.TabIndex = 26;
@ -144,19 +164,19 @@
this.cbbActionTiming.Dock = System.Windows.Forms.DockStyle.Fill;
this.cbbActionTiming.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbbActionTiming.FormattingEnabled = true;
this.cbbActionTiming.Location = new System.Drawing.Point(97, 85);
this.cbbActionTiming.Location = new System.Drawing.Point(105, 80);
this.cbbActionTiming.Name = "cbbActionTiming";
this.cbbActionTiming.Size = new System.Drawing.Size(328, 20);
this.cbbActionTiming.Size = new System.Drawing.Size(320, 20);
this.cbbActionTiming.TabIndex = 25;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(3, 59);
this.label1.Location = new System.Drawing.Point(3, 54);
this.label1.Margin = new System.Windows.Forms.Padding(3);
this.label1.Name = "label1";
this.label1.Padding = new System.Windows.Forms.Padding(3);
this.label1.Size = new System.Drawing.Size(45, 18);
this.label1.Size = new System.Drawing.Size(46, 18);
this.label1.TabIndex = 22;
this.label1.Text = "Action:";
//
@ -165,19 +185,19 @@
this.tableLayoutPanel3.SetColumnSpan(this.ttbThreshold, 2);
this.ttbThreshold.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "MatchThresholdStr", true));
this.ttbThreshold.Dock = System.Windows.Forms.DockStyle.Fill;
this.ttbThreshold.Location = new System.Drawing.Point(97, 211);
this.ttbThreshold.Location = new System.Drawing.Point(105, 203);
this.ttbThreshold.Name = "ttbThreshold";
this.ttbThreshold.Size = new System.Drawing.Size(328, 22);
this.ttbThreshold.Size = new System.Drawing.Size(320, 19);
this.ttbThreshold.TabIndex = 8;
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(3, 211);
this.label10.Location = new System.Drawing.Point(3, 203);
this.label10.Margin = new System.Windows.Forms.Padding(3);
this.label10.Name = "label10";
this.label10.Padding = new System.Windows.Forms.Padding(3);
this.label10.Size = new System.Drawing.Size(87, 18);
this.label10.Size = new System.Drawing.Size(91, 18);
this.label10.TabIndex = 17;
this.label10.Text = "Max Difference:";
//
@ -188,40 +208,40 @@
this.label7.Margin = new System.Windows.Forms.Padding(3);
this.label7.Name = "label7";
this.label7.Padding = new System.Windows.Forms.Padding(3);
this.label7.Size = new System.Drawing.Size(41, 18);
this.label7.Size = new System.Drawing.Size(42, 18);
this.label7.TabIndex = 14;
this.label7.Text = "Name:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(3, 157);
this.label5.Location = new System.Drawing.Point(3, 152);
this.label5.Margin = new System.Windows.Forms.Padding(3);
this.label5.Name = "label5";
this.label5.Padding = new System.Windows.Forms.Padding(3);
this.label5.Size = new System.Drawing.Size(88, 18);
this.label5.Size = new System.Drawing.Size(96, 18);
this.label5.TabIndex = 6;
this.label5.Text = "Template Offset:";
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(3, 111);
this.label4.Location = new System.Drawing.Point(3, 106);
this.label4.Margin = new System.Windows.Forms.Padding(3);
this.label4.Name = "label4";
this.label4.Padding = new System.Windows.Forms.Padding(3);
this.label4.Size = new System.Drawing.Size(57, 18);
this.label4.Size = new System.Drawing.Size(60, 18);
this.label4.TabIndex = 5;
this.label4.Text = "Template:";
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(3, 31);
this.label2.Location = new System.Drawing.Point(3, 28);
this.label2.Margin = new System.Windows.Forms.Padding(3);
this.label2.Name = "label2";
this.label2.Padding = new System.Windows.Forms.Padding(3);
this.label2.Size = new System.Drawing.Size(57, 18);
this.label2.Size = new System.Drawing.Size(58, 18);
this.label2.TabIndex = 4;
this.label2.Text = "Enable If:";
//
@ -231,9 +251,9 @@
this.cbbAction.Dock = System.Windows.Forms.DockStyle.Fill;
this.cbbAction.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbbAction.FormattingEnabled = true;
this.cbbAction.Location = new System.Drawing.Point(97, 59);
this.cbbAction.Location = new System.Drawing.Point(105, 54);
this.cbbAction.Name = "cbbAction";
this.cbbAction.Size = new System.Drawing.Size(328, 20);
this.cbbAction.Size = new System.Drawing.Size(320, 20);
this.cbbAction.TabIndex = 3;
//
// ttbName
@ -241,19 +261,19 @@
this.tableLayoutPanel3.SetColumnSpan(this.ttbName, 2);
this.ttbName.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "TemplateName", true, System.Windows.Forms.DataSourceUpdateMode.OnPropertyChanged));
this.ttbName.Dock = System.Windows.Forms.DockStyle.Fill;
this.ttbName.Location = new System.Drawing.Point(97, 3);
this.ttbName.Location = new System.Drawing.Point(105, 3);
this.ttbName.Name = "ttbName";
this.ttbName.Size = new System.Drawing.Size(328, 22);
this.ttbName.Size = new System.Drawing.Size(320, 19);
this.ttbName.TabIndex = 1;
//
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(3, 185);
this.label9.Location = new System.Drawing.Point(3, 177);
this.label9.Margin = new System.Windows.Forms.Padding(3);
this.label9.Name = "label9";
this.label9.Padding = new System.Windows.Forms.Padding(3);
this.label9.Size = new System.Drawing.Size(82, 18);
this.label9.Size = new System.Drawing.Size(85, 18);
this.label9.TabIndex = 16;
this.label9.Text = "Match Method:";
//
@ -263,9 +283,9 @@
this.cbbMethod.Dock = System.Windows.Forms.DockStyle.Fill;
this.cbbMethod.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbbMethod.FormattingEnabled = true;
this.cbbMethod.Location = new System.Drawing.Point(97, 185);
this.cbbMethod.Location = new System.Drawing.Point(105, 177);
this.cbbMethod.Name = "cbbMethod";
this.cbbMethod.Size = new System.Drawing.Size(328, 20);
this.cbbMethod.Size = new System.Drawing.Size(320, 20);
this.cbbMethod.TabIndex = 7;
//
// flowLayoutPanel3
@ -278,17 +298,17 @@
this.flowLayoutPanel3.Controls.Add(this.ttbOffsetY);
this.flowLayoutPanel3.Controls.Add(this.label13);
this.flowLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.flowLayoutPanel3.Location = new System.Drawing.Point(94, 154);
this.flowLayoutPanel3.Location = new System.Drawing.Point(102, 149);
this.flowLayoutPanel3.Margin = new System.Windows.Forms.Padding(0);
this.flowLayoutPanel3.Name = "flowLayoutPanel3";
this.flowLayoutPanel3.Size = new System.Drawing.Size(334, 28);
this.flowLayoutPanel3.Size = new System.Drawing.Size(326, 25);
this.flowLayoutPanel3.TabIndex = 18;
//
// label12
//
this.label12.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(3, 8);
this.label12.Location = new System.Drawing.Point(3, 6);
this.label12.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(9, 12);
@ -300,14 +320,14 @@
this.ttbOffsetX.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "ImageOffsetXStr", true));
this.ttbOffsetX.Location = new System.Drawing.Point(15, 3);
this.ttbOffsetX.Name = "ttbOffsetX";
this.ttbOffsetX.Size = new System.Drawing.Size(48, 22);
this.ttbOffsetX.Size = new System.Drawing.Size(48, 19);
this.ttbOffsetX.TabIndex = 5;
//
// label11
//
this.label11.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(66, 13);
this.label11.Location = new System.Drawing.Point(66, 10);
this.label11.Margin = new System.Windows.Forms.Padding(0, 3, 0, 3);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(11, 12);
@ -319,14 +339,14 @@
this.ttbOffsetY.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "ImageOffsetYStr", true));
this.ttbOffsetY.Location = new System.Drawing.Point(80, 3);
this.ttbOffsetY.Name = "ttbOffsetY";
this.ttbOffsetY.Size = new System.Drawing.Size(48, 22);
this.ttbOffsetY.Size = new System.Drawing.Size(48, 19);
this.ttbOffsetY.TabIndex = 6;
//
// label13
//
this.label13.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.label13.AutoSize = true;
this.label13.Location = new System.Drawing.Point(131, 8);
this.label13.Location = new System.Drawing.Point(131, 6);
this.label13.Margin = new System.Windows.Forms.Padding(0, 3, 3, 3);
this.label13.Name = "label13";
this.label13.Size = new System.Drawing.Size(9, 12);
@ -337,7 +357,7 @@
//
this.btnImage.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch;
this.tableLayoutPanel3.SetColumnSpan(this.btnImage, 2);
this.btnImage.Location = new System.Drawing.Point(97, 111);
this.btnImage.Location = new System.Drawing.Point(105, 106);
this.btnImage.Name = "btnImage";
this.btnImage.Size = new System.Drawing.Size(40, 40);
this.btnImage.TabIndex = 4;
@ -348,9 +368,9 @@
//
this.ttbEnableIfArg.DataBindings.Add(new System.Windows.Forms.Binding("Text", this, "EnableIfArg", true));
this.ttbEnableIfArg.Dock = System.Windows.Forms.DockStyle.Fill;
this.ttbEnableIfArg.Location = new System.Drawing.Point(223, 31);
this.ttbEnableIfArg.Location = new System.Drawing.Point(231, 28);
this.ttbEnableIfArg.Name = "ttbEnableIfArg";
this.ttbEnableIfArg.Size = new System.Drawing.Size(202, 22);
this.ttbEnableIfArg.Size = new System.Drawing.Size(194, 19);
this.ttbEnableIfArg.TabIndex = 2;
//
// btnRemove
@ -358,9 +378,9 @@
this.btnRemove.AutoSize = true;
this.btnRemove.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
this.btnRemove.Dock = System.Windows.Forms.DockStyle.Right;
this.btnRemove.Location = new System.Drawing.Point(325, 267);
this.btnRemove.Location = new System.Drawing.Point(318, 278);
this.btnRemove.Name = "btnRemove";
this.btnRemove.Size = new System.Drawing.Size(100, 23);
this.btnRemove.Size = new System.Drawing.Size(107, 19);
this.btnRemove.TabIndex = 23;
this.btnRemove.TabStop = false;
this.btnRemove.Text = "Remove Template";
@ -370,37 +390,66 @@
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(3, 85);
this.label3.Location = new System.Drawing.Point(3, 80);
this.label3.Margin = new System.Windows.Forms.Padding(3);
this.label3.Name = "label3";
this.label3.Padding = new System.Windows.Forms.Padding(3);
this.label3.Size = new System.Drawing.Size(82, 18);
this.label3.Size = new System.Drawing.Size(84, 18);
this.label3.TabIndex = 24;
this.label3.Text = "Action Timing:";
//
// label6
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(3, 239);
this.label6.Location = new System.Drawing.Point(3, 228);
this.label6.Margin = new System.Windows.Forms.Padding(3);
this.label6.Name = "label6";
this.label6.Padding = new System.Windows.Forms.Padding(3);
this.label6.Size = new System.Drawing.Size(88, 18);
this.label6.Size = new System.Drawing.Size(90, 18);
this.label6.TabIndex = 27;
this.label6.Text = "Ready Min Diff:";
//
// nudMatchCount
//
this.nudMatchCount.Location = new System.Drawing.Point(105, 253);
this.nudMatchCount.Maximum = new decimal(new int[] {
2147483647,
0,
0,
0});
this.nudMatchCount.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudMatchCount.Name = "nudMatchCount";
this.nudMatchCount.Size = new System.Drawing.Size(60, 19);
this.nudMatchCount.TabIndex = 30;
this.nudMatchCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.nudMatchCount.Value = new decimal(new int[] {
1,
0,
0,
0});
//
// templateSettingsBindingSource
//
this.templateSettingsBindingSource.DataSource = typeof(LiveSplit.SupAutoSplit.UI.TemplateSettings);
//
// TemplateSettings
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.gpbRoot);
this.Name = "TemplateSettings";
this.Size = new System.Drawing.Size(434, 314);
this.Size = new System.Drawing.Size(434, 318);
this.gpbRoot.ResumeLayout(false);
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.flowLayoutPanel3.ResumeLayout(false);
this.flowLayoutPanel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudMatchCount)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.templateSettingsBindingSource)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -435,5 +484,8 @@
private System.Windows.Forms.ComboBox cbbEnableIf;
private System.Windows.Forms.TextBox ttbThresholdNeg;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Label label8;
private System.Windows.Forms.NumericUpDown nudMatchCount;
private System.Windows.Forms.BindingSource templateSettingsBindingSource;
}
}

View file

@ -99,6 +99,8 @@ namespace LiveSplit.SupAutoSplit.UI {
get => MatchThresholdNeg.ToString();
set => double.TryParse(value, out matchThresholdNeg);
}
public int MatchCount { get; set; }
#endregion
public TemplateSettings(XmlElement settings, Action<TemplateSettings> removeHandler) {
@ -115,6 +117,8 @@ namespace LiveSplit.SupAutoSplit.UI {
cbbActionTiming.DataBindings.Add("SelectedIndex", this, "ActionTimingISel", false, DataSourceUpdateMode.OnPropertyChanged);
cbbMethod.DataSource = MatchTemplate.MatchMethodItems;
cbbMethod.DataBindings.Add("SelectedIndex", this, "MatchMethodISel", false, DataSourceUpdateMode.OnPropertyChanged);
nudMatchCount.DataBindings.Add("Value", this, "MatchCount", true, DataSourceUpdateMode.OnPropertyChanged);
}
private void BtnTemplate_Click(object sender, EventArgs e) {
@ -138,6 +142,7 @@ namespace LiveSplit.SupAutoSplit.UI {
SettingsHelper.CreateSetting(document, parent, "Method", MatchMethodSel.key) ^
SettingsHelper.CreateSetting(document, parent, "Threshold", MatchThreshold);
SettingsHelper.CreateSetting(document, parent, "ThresholdNeg", MatchThresholdNeg);
SettingsHelper.CreateSetting(document, parent, "MatchCount", MatchCount);
return hashCode;
}
private void SetSettings(XmlElement settings) {
@ -152,6 +157,7 @@ namespace LiveSplit.SupAutoSplit.UI {
MatchMethodISel = SupSettingsHelper.ParseListISel(settings?["Method"], MatchTemplate.MatchMethodFactories, 0);
matchThreshold = SettingsHelper.ParseDouble(settings?["Threshold"], 0);
matchThresholdNeg = SettingsHelper.ParseDouble(settings?["ThresholdNeg"], 0);
MatchCount = SettingsHelper.ParseInt(settings?["MatchCount"], 1);
}
}
}

View file

@ -120,4 +120,7 @@
<metadata name="ofdTemplate.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="templateSettingsBindingSource.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>138, 17</value>
</metadata>
</root>

View file

@ -35,7 +35,7 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="LiveSplit.Core">
<HintPath>..\..\..\..\..\..\Software\LiveSplit\LiveSplit.Core.dll</HintPath>
<HintPath>..\..\..\..\Software\LiveSplit\LiveSplit.Core.dll</HintPath>
</Reference>
<Reference Include="OpenCvSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=6adad1e807fea099, processorArchitecture=MSIL">
<HintPath>..\packages\OpenCvSharp4.4.5.3.20210817\lib\net461\OpenCvSharp.dll</HintPath>
@ -76,7 +76,7 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UpdateManager">
<HintPath>..\..\..\..\..\..\Software\LiveSplit\UpdateManager.dll</HintPath>
<HintPath>..\..\..\..\Software\LiveSplit\UpdateManager.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
@ -122,8 +122,8 @@
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<PropertyGroup>
<PathMap>$(MSBuildProjectDirectory)\$(IntermediateOutputPath)=.</PathMap>
<PostBuildEvent>copy $(TargetDir)$(TargetFileName) C:\Software\LiveSplit\Components\</PostBuildEvent>
<!-- <PathMap>$(MSBuildProjectDirectory)\$(IntermediateOutputPath)=.</PathMap> -->
<PostBuildEvent>copy $(TargetDir)$(TargetFileName) C:\Users\sup39\Software\LiveSplit\Components\</PostBuildEvent>
</PropertyGroup>
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
<PropertyGroup>