mirror of
https://github.com/kwsch/pk3DS.git
synced 2026-08-27 04:06:45 -05:00
Misc fixes
range check on click move for typechart
This commit is contained in:
@@ -48,13 +48,17 @@ private void moveMouse(object sender, MouseEventArgs e)
|
||||
{
|
||||
GetCoordinate((PictureBox)sender, e, out int X, out int Y);
|
||||
int index = Y * TypeCount + X;
|
||||
|
||||
if (index >= chart.Length)
|
||||
return;
|
||||
updateLabel(X, Y, chart[index]);
|
||||
}
|
||||
private void clickMouse(object sender, MouseEventArgs e)
|
||||
{
|
||||
GetCoordinate((PictureBox)sender, e, out int X, out int Y);
|
||||
int index = Y * TypeCount + X;
|
||||
if (index >= chart.Length)
|
||||
return;
|
||||
|
||||
chart[index] = ToggleEffectiveness(chart[index], e.Button == MouseButtons.Left);
|
||||
|
||||
updateLabel(X, Y, chart[index]);
|
||||
@@ -62,6 +66,8 @@ private void clickMouse(object sender, MouseEventArgs e)
|
||||
}
|
||||
private void updateLabel(int X, int Y, int value)
|
||||
{
|
||||
if (value >= effects.Length || X >= types.Length || Y >= types.Length)
|
||||
return; // clicking and moving outside the box has invalid values
|
||||
L_Hover.Text = $"[{X:00}x{Y:00}: {value:00}] {types[Y]} attacking {types[X]} {effects[value]}";
|
||||
}
|
||||
private readonly string[] effects =
|
||||
|
||||
9
pk3DS/Subforms/Gen7/TMEditor7.Designer.cs
generated
9
pk3DS/Subforms/Gen7/TMEditor7.Designer.cs
generated
@@ -40,8 +40,9 @@ private void InitializeComponent()
|
||||
this.dgvTM.AllowUserToDeleteRows = false;
|
||||
this.dgvTM.AllowUserToResizeColumns = false;
|
||||
this.dgvTM.AllowUserToResizeRows = false;
|
||||
this.dgvTM.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)));
|
||||
this.dgvTM.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.dgvTM.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
|
||||
this.dgvTM.Location = new System.Drawing.Point(9, 25);
|
||||
this.dgvTM.Name = "dgvTM";
|
||||
@@ -67,7 +68,7 @@ private void InitializeComponent()
|
||||
this.B_RTM.UseVisualStyleBackColor = true;
|
||||
this.B_RTM.Click += new System.EventHandler(this.B_RandomTM_Click);
|
||||
//
|
||||
// TMHMEditor7
|
||||
// TMEditor7
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
@@ -78,7 +79,7 @@ private void InitializeComponent()
|
||||
this.MaximizeBox = false;
|
||||
this.MaximumSize = new System.Drawing.Size(520, 670);
|
||||
this.MinimumSize = new System.Drawing.Size(275, 370);
|
||||
this.Name = "TMHMEditor7";
|
||||
this.Name = "TMEditor7";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||
this.Text = "TM Editor";
|
||||
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.formClosing);
|
||||
|
||||
@@ -62,21 +62,26 @@ private void moveMouse(object sender, MouseEventArgs e)
|
||||
{
|
||||
TypeChart6.GetCoordinate((PictureBox)sender, e, out int X, out int Y);
|
||||
int index = Y*TypeCount + X;
|
||||
|
||||
if (index >= chart.Length)
|
||||
return;
|
||||
updateLabel(X, Y, chart[index]);
|
||||
}
|
||||
private void clickMouse(object sender, MouseEventArgs e)
|
||||
{
|
||||
TypeChart6.GetCoordinate((PictureBox)sender, e, out int X, out int Y);
|
||||
int index = Y * TypeCount + X;
|
||||
if (index >= chart.Length)
|
||||
return;
|
||||
|
||||
chart[index] = TypeChart6.ToggleEffectiveness(chart[index], e.Button == MouseButtons.Left);
|
||||
|
||||
updateLabel(X, Y, chart[index]);
|
||||
populateChart();
|
||||
}
|
||||
|
||||
private void updateLabel(int X, int Y, int value)
|
||||
{
|
||||
if (value >= effects.Length || X >= types.Length || Y >= types.Length)
|
||||
return; // clicking and moving outside the box has invalid values
|
||||
L_Hover.Text = $"[{X:00}x{Y:00}: {value:00}] {types[Y]} attacking {types[X]} {effects[value]}";
|
||||
}
|
||||
private readonly string[] effects =
|
||||
|
||||
Reference in New Issue
Block a user