Basic Bot - Run btn validation
This commit is contained in:
parent
e73737a20a
commit
b34449a820
BizHawk.Client.EmuHawk/tools/BasicBot
|
@ -39,9 +39,9 @@
|
|||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.ExitMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.OptionsSubMenu = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.TurboWhileBottingMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.MemoryDomainsMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.TurboWhileBottingMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.RunBtn = new System.Windows.Forms.Button();
|
||||
this.BotStatusStrip = new System.Windows.Forms.StatusStrip();
|
||||
this.MessageLabel = new System.Windows.Forms.ToolStripStatusLabel();
|
||||
|
@ -197,13 +197,6 @@
|
|||
this.OptionsSubMenu.Text = "&Options";
|
||||
this.OptionsSubMenu.DropDownOpened += new System.EventHandler(this.OptionsSubMenu_DropDownOpened);
|
||||
//
|
||||
// TurboWhileBottingMenuItem
|
||||
//
|
||||
this.TurboWhileBottingMenuItem.Name = "TurboWhileBottingMenuItem";
|
||||
this.TurboWhileBottingMenuItem.Size = new System.Drawing.Size(181, 22);
|
||||
this.TurboWhileBottingMenuItem.Text = "Turbo While Botting";
|
||||
this.TurboWhileBottingMenuItem.Click += new System.EventHandler(this.TurboWhileBottingMenuItem_Click);
|
||||
//
|
||||
// MemoryDomainsMenuItem
|
||||
//
|
||||
this.MemoryDomainsMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -216,7 +209,14 @@
|
|||
// toolStripSeparator3
|
||||
//
|
||||
this.toolStripSeparator3.Name = "toolStripSeparator3";
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(149, 6);
|
||||
this.toolStripSeparator3.Size = new System.Drawing.Size(57, 6);
|
||||
//
|
||||
// TurboWhileBottingMenuItem
|
||||
//
|
||||
this.TurboWhileBottingMenuItem.Name = "TurboWhileBottingMenuItem";
|
||||
this.TurboWhileBottingMenuItem.Size = new System.Drawing.Size(181, 22);
|
||||
this.TurboWhileBottingMenuItem.Text = "Turbo While Botting";
|
||||
this.TurboWhileBottingMenuItem.Click += new System.EventHandler(this.TurboWhileBottingMenuItem_Click);
|
||||
//
|
||||
// RunBtn
|
||||
//
|
||||
|
@ -602,6 +602,7 @@
|
|||
this.MaximizeAddressBox.Nullable = true;
|
||||
this.MaximizeAddressBox.Size = new System.Drawing.Size(95, 20);
|
||||
this.MaximizeAddressBox.TabIndex = 1001;
|
||||
this.MaximizeAddressBox.TextChanged += new System.EventHandler(this.FrameLengthNumeric_ValueChanged);
|
||||
//
|
||||
// maximizeLabeltext
|
||||
//
|
||||
|
@ -637,6 +638,7 @@
|
|||
0,
|
||||
0,
|
||||
0});
|
||||
this.FrameLengthNumeric.ValueChanged += new System.EventHandler(this.FrameLengthNumeric_ValueChanged);
|
||||
//
|
||||
// label3
|
||||
//
|
||||
|
|
|
@ -90,7 +90,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
ButtonName = button,
|
||||
Probability = 0.0,
|
||||
Location = new Point(marginLeft, starty + accumulatedy),
|
||||
TabIndex = count + 1
|
||||
TabIndex = count + 1,
|
||||
ProbabilityChangedCallback = AssessRunButtonStatus
|
||||
};
|
||||
|
||||
ControlProbabilityPanel.Controls.Add(control);
|
||||
|
@ -757,7 +758,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
if (!CanStart())
|
||||
{
|
||||
MessageBox.Show("Please fill out all the things!");
|
||||
MessageBox.Show("Unable to run with current settings");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -838,5 +839,18 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
GlobalWin.MainForm.Throttle();
|
||||
}
|
||||
|
||||
private void AssessRunButtonStatus()
|
||||
{
|
||||
RunBtn.Enabled =
|
||||
FrameLength > 0
|
||||
&& !string.IsNullOrWhiteSpace(MaximizeAddressBox.Text)
|
||||
&& ControlProbabilities.Any(kvp => kvp.Value > 0);
|
||||
}
|
||||
|
||||
private void FrameLengthNumeric_ValueChanged(object sender, EventArgs e)
|
||||
{
|
||||
AssessRunButtonStatus();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,6 +12,8 @@ namespace BizHawk.Client.EmuHawk
|
|||
InitializeComponent();
|
||||
}
|
||||
|
||||
public Action ProbabilityChangedCallback { get; set; }
|
||||
|
||||
public string ButtonName
|
||||
{
|
||||
get { return ButtonNameLabel.Text; }
|
||||
|
@ -33,6 +35,7 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_programmaticallyChangingValues = true;
|
||||
ProbabilitySlider.Value = (int)ProbabilityUpDown.Value;
|
||||
ChangedCallback();
|
||||
_programmaticallyChangingValues = false;
|
||||
}
|
||||
|
||||
|
@ -40,7 +43,16 @@ namespace BizHawk.Client.EmuHawk
|
|||
{
|
||||
_programmaticallyChangingValues = true;
|
||||
ProbabilityUpDown.Value = ProbabilitySlider.Value;
|
||||
ChangedCallback();
|
||||
_programmaticallyChangingValues = false;
|
||||
}
|
||||
|
||||
private void ChangedCallback()
|
||||
{
|
||||
if (ProbabilityChangedCallback != null)
|
||||
{
|
||||
ProbabilityChangedCallback();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue