BasicBot - add sliders to probabilities
This commit is contained in:
parent
e4d6557145
commit
e73737a20a
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue