BasicBot - add sliders to probabilities

This commit is contained in:
adelikat 2015-09-06 20:28:37 -04:00
parent e4d6557145
commit e73737a20a
2 changed files with 37 additions and 4 deletions

View File

@ -30,7 +30,9 @@
{
this.ButtonNameLabel = new System.Windows.Forms.Label();
this.ProbabilityUpDown = new System.Windows.Forms.NumericUpDown();
this.ProbabilitySlider = new System.Windows.Forms.TrackBar();
((System.ComponentModel.ISupportInitialize)(this.ProbabilityUpDown)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.ProbabilitySlider)).BeginInit();
this.SuspendLayout();
//
// ButtonNameLabel
@ -44,28 +46,42 @@
//
// ProbabilityUpDown
//
this.ProbabilityUpDown.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.ProbabilityUpDown.DecimalPlaces = 1;
this.ProbabilityUpDown.Increment = new decimal(new int[] {
1,
0,
0,
65536});
this.ProbabilityUpDown.Location = new System.Drawing.Point(81, -2);
this.ProbabilityUpDown.Location = new System.Drawing.Point(92, 0);
this.ProbabilityUpDown.Name = "ProbabilityUpDown";
this.ProbabilityUpDown.Size = new System.Drawing.Size(79, 20);
this.ProbabilityUpDown.Size = new System.Drawing.Size(49, 20);
this.ProbabilityUpDown.TabIndex = 1;
this.ProbabilityUpDown.ValueChanged += new System.EventHandler(this.ProbabilityUpDown_ValueChanged);
//
// ProbabilitySlider
//
this.ProbabilitySlider.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.ProbabilitySlider.Location = new System.Drawing.Point(147, -2);
this.ProbabilitySlider.Maximum = 100;
this.ProbabilitySlider.Name = "ProbabilitySlider";
this.ProbabilitySlider.Size = new System.Drawing.Size(111, 45);
this.ProbabilitySlider.TabIndex = 2;
this.ProbabilitySlider.TickFrequency = 25;
this.ProbabilitySlider.ValueChanged += new System.EventHandler(this.ProbabilitySlider_ValueChanged);
//
// BotControlsRow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.ProbabilitySlider);
this.Controls.Add(this.ProbabilityUpDown);
this.Controls.Add(this.ButtonNameLabel);
this.Name = "BotControlsRow";
this.Size = new System.Drawing.Size(163, 20);
this.Size = new System.Drawing.Size(258, 29);
this.Load += new System.EventHandler(this.BotControlsRow_Load);
((System.ComponentModel.ISupportInitialize)(this.ProbabilityUpDown)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.ProbabilitySlider)).EndInit();
this.ResumeLayout(false);
this.PerformLayout();
@ -75,5 +91,6 @@
private System.Windows.Forms.Label ButtonNameLabel;
private System.Windows.Forms.NumericUpDown ProbabilityUpDown;
private System.Windows.Forms.TrackBar ProbabilitySlider;
}
}

View File

@ -5,6 +5,8 @@ namespace BizHawk.Client.EmuHawk
{
public partial class BotControlsRow : UserControl
{
private bool _programmaticallyChangingValues;
public BotControlsRow()
{
InitializeComponent();
@ -26,5 +28,19 @@ namespace BizHawk.Client.EmuHawk
{
}
private void ProbabilityUpDown_ValueChanged(object sender, EventArgs e)
{
_programmaticallyChangingValues = true;
ProbabilitySlider.Value = (int)ProbabilityUpDown.Value;
_programmaticallyChangingValues = false;
}
private void ProbabilitySlider_ValueChanged(object sender, EventArgs e)
{
_programmaticallyChangingValues = true;
ProbabilityUpDown.Value = ProbabilitySlider.Value;
_programmaticallyChangingValues = false;
}
}
}