add size rating indications when viewing pkm data

This commit is contained in:
Kurt 2018-12-13 21:10:38 -08:00
parent fc65a65fd9
commit fb10a1f983
4 changed files with 71 additions and 35 deletions

View file

@ -704,15 +704,15 @@ namespace PKHeX.Core
WeightAbsolute = updated;
}
public static int GetHeightRating(int heightScalar)
public static int GetSizeRating(int scalar)
{
if (heightScalar < 0x10)
if (scalar < 0x10)
return 0; // 1/16 = XS
if (heightScalar < 0x30u)
if (scalar < 0x30u)
return 1; // 2/16 = S
if (heightScalar < 0xD0u)
if (scalar < 0xD0u)
return 2; // average (10/16)
if (heightScalar < 0xF0u)
if (scalar < 0xF0u)
return 3; // 2/16 = L
return 4; // 1/16 = XL
}

View file

@ -41,6 +41,8 @@
this.NUD_WeightScalar = new System.Windows.Forms.NumericUpDown();
this.TB_WeightAbs = new System.Windows.Forms.TextBox();
this.FLP_Height = new System.Windows.Forms.FlowLayoutPanel();
this.L_SizeH = new System.Windows.Forms.Label();
this.L_SizeW = new System.Windows.Forms.Label();
this.FLP_CP.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.NUD_HeightScalar)).BeginInit();
this.tableLayoutPanel1.SuspendLayout();
@ -48,9 +50,9 @@
((System.ComponentModel.ISupportInitialize)(this.NUD_WeightScalar)).BeginInit();
this.FLP_Height.SuspendLayout();
this.SuspendLayout();
//
//
// FLP_CP
//
//
this.FLP_CP.Controls.Add(this.MT_CP);
this.FLP_CP.Controls.Add(this.CHK_Auto);
this.FLP_CP.Location = new System.Drawing.Point(63, 0);
@ -58,9 +60,9 @@
this.FLP_CP.Name = "FLP_CP";
this.FLP_CP.Size = new System.Drawing.Size(140, 23);
this.FLP_CP.TabIndex = 1;
//
//
// MT_CP
//
//
this.MT_CP.Location = new System.Drawing.Point(0, 0);
this.MT_CP.Margin = new System.Windows.Forms.Padding(0);
this.MT_CP.Mask = "00000";
@ -68,9 +70,9 @@
this.MT_CP.Size = new System.Drawing.Size(36, 20);
this.MT_CP.TabIndex = 3;
this.MT_CP.TextChanged += new System.EventHandler(this.MT_CP_TextChanged);
//
//
// CHK_Auto
//
//
this.CHK_Auto.AutoSize = true;
this.CHK_Auto.Location = new System.Drawing.Point(39, 3);
this.CHK_Auto.Name = "CHK_Auto";
@ -79,9 +81,9 @@
this.CHK_Auto.Text = "Auto";
this.CHK_Auto.UseVisualStyleBackColor = true;
this.CHK_Auto.CheckedChanged += new System.EventHandler(this.UpdateFlagState);
//
//
// L_CP
//
//
this.L_CP.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.L_CP.Location = new System.Drawing.Point(3, 0);
this.L_CP.Name = "L_CP";
@ -89,9 +91,9 @@
this.L_CP.TabIndex = 0;
this.L_CP.Text = "CP:";
this.L_CP.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
//
// L_Height
//
//
this.L_Height.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.L_Height.Location = new System.Drawing.Point(3, 23);
this.L_Height.Name = "L_Height";
@ -99,9 +101,9 @@
this.L_Height.TabIndex = 1;
this.L_Height.Text = "Height:";
this.L_Height.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
//
// L_Weight
//
//
this.L_Weight.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.L_Weight.Location = new System.Drawing.Point(3, 46);
this.L_Weight.Name = "L_Weight";
@ -109,9 +111,9 @@
this.L_Weight.TabIndex = 2;
this.L_Weight.Text = "Weight:";
this.L_Weight.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
//
// NUD_HeightScalar
//
//
this.NUD_HeightScalar.Location = new System.Drawing.Point(0, 0);
this.NUD_HeightScalar.Margin = new System.Windows.Forms.Padding(0);
this.NUD_HeightScalar.Maximum = new decimal(new int[] {
@ -128,18 +130,19 @@
0,
0});
this.NUD_HeightScalar.ValueChanged += new System.EventHandler(this.NUD_HeightScalar_ValueChanged);
//
//
// TB_HeightAbs
//
//
this.TB_HeightAbs.Location = new System.Drawing.Point(40, 0);
this.TB_HeightAbs.Margin = new System.Windows.Forms.Padding(0);
this.TB_HeightAbs.Name = "TB_HeightAbs";
this.TB_HeightAbs.Size = new System.Drawing.Size(100, 20);
this.TB_HeightAbs.Size = new System.Drawing.Size(67, 20);
this.TB_HeightAbs.TabIndex = 7;
this.TB_HeightAbs.Text = "123.456789";
this.TB_HeightAbs.TextChanged += new System.EventHandler(this.TB_HeightAbs_TextChanged);
//
//
// tableLayoutPanel1
//
//
this.tableLayoutPanel1.ColumnCount = 2;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 31F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 69F));
@ -156,21 +159,23 @@
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(204, 68);
this.tableLayoutPanel1.TabIndex = 2;
//
//
// FLP_Weight
//
//
this.FLP_Weight.Controls.Add(this.NUD_WeightScalar);
this.FLP_Weight.Controls.Add(this.TB_WeightAbs);
this.FLP_Weight.Controls.Add(this.L_SizeW);
this.FLP_Weight.Location = new System.Drawing.Point(63, 46);
this.FLP_Weight.Margin = new System.Windows.Forms.Padding(0);
this.FLP_Weight.Name = "FLP_Weight";
this.FLP_Weight.Size = new System.Drawing.Size(140, 21);
this.FLP_Weight.TabIndex = 4;
//
//
// NUD_WeightScalar
//
//
this.NUD_WeightScalar.Location = new System.Drawing.Point(0, 0);
this.NUD_WeightScalar.Margin = new System.Windows.Forms.Padding(0);
this.NUD_WeightScalar.Maximum = new decimal(new int[] {
@ -187,28 +192,50 @@
0,
0});
this.NUD_WeightScalar.ValueChanged += new System.EventHandler(this.NUD_WeightScalar_ValueChanged);
//
//
// TB_WeightAbs
//
//
this.TB_WeightAbs.Location = new System.Drawing.Point(40, 0);
this.TB_WeightAbs.Margin = new System.Windows.Forms.Padding(0);
this.TB_WeightAbs.Name = "TB_WeightAbs";
this.TB_WeightAbs.Size = new System.Drawing.Size(100, 20);
this.TB_WeightAbs.Size = new System.Drawing.Size(67, 20);
this.TB_WeightAbs.TabIndex = 7;
this.TB_WeightAbs.Text = "123.456789";
this.TB_WeightAbs.TextChanged += new System.EventHandler(this.TB_WeightAbs_TextChanged);
//
//
// FLP_Height
//
//
this.FLP_Height.Controls.Add(this.NUD_HeightScalar);
this.FLP_Height.Controls.Add(this.TB_HeightAbs);
this.FLP_Height.Controls.Add(this.L_SizeH);
this.FLP_Height.Location = new System.Drawing.Point(63, 23);
this.FLP_Height.Margin = new System.Windows.Forms.Padding(0);
this.FLP_Height.Name = "FLP_Height";
this.FLP_Height.Size = new System.Drawing.Size(140, 21);
this.FLP_Height.TabIndex = 3;
//
//
// L_SizeH
//
this.L_SizeH.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.L_SizeH.Location = new System.Drawing.Point(110, 0);
this.L_SizeH.Name = "L_SizeH";
this.L_SizeH.Size = new System.Drawing.Size(24, 20);
this.L_SizeH.TabIndex = 8;
this.L_SizeH.Text = "XL";
this.L_SizeH.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// L_SizeW
//
this.L_SizeW.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.L_SizeW.Location = new System.Drawing.Point(110, 0);
this.L_SizeW.Name = "L_SizeW";
this.L_SizeW.Size = new System.Drawing.Size(24, 20);
this.L_SizeW.TabIndex = 9;
this.L_SizeW.Text = "XS";
this.L_SizeW.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// SizeCP
//
//
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "SizeCP";
@ -240,5 +267,7 @@
private System.Windows.Forms.NumericUpDown NUD_WeightScalar;
private System.Windows.Forms.TextBox TB_WeightAbs;
private System.Windows.Forms.FlowLayoutPanel FLP_Height;
private System.Windows.Forms.Label L_SizeW;
private System.Windows.Forms.Label L_SizeH;
}
}

View file

@ -15,6 +15,7 @@ namespace PKHeX.WinForms.Controls
}
private readonly bool Initialized;
private static readonly string[] SizeClass = {"XS", "S", "", "L", "XL"};
public void LoadPKM(PKM pk)
{
@ -64,6 +65,8 @@ namespace PKHeX.WinForms.Controls
private void NUD_HeightScalar_ValueChanged(object sender, EventArgs e)
{
pkm.HeightScalar = (byte) NUD_HeightScalar.Value;
L_SizeH.Text = SizeClass[PB7.GetSizeRating(pkm.HeightScalar)];
if (!CHK_Auto.Checked || Loading)
return;
pkm.ResetHeight();
@ -73,6 +76,8 @@ namespace PKHeX.WinForms.Controls
private void NUD_WeightScalar_ValueChanged(object sender, EventArgs e)
{
pkm.WeightScalar = (byte) NUD_WeightScalar.Value;
L_SizeW.Text = SizeClass[PB7.GetSizeRating(pkm.WeightScalar)];
if (!CHK_Auto.Checked || Loading)
return;
pkm.ResetWeight();

View file

@ -81,6 +81,8 @@ namespace PKHeX.WinForms
nameof(SplashScreen),
"Gender=", // editor gender labels
"BTN_Shinytize", // ☆
"Main.L_SizeH", // height rating
"Main.L_SizeW", // weight rating
"Main.B_Box", // << and >> arrows
"Main.L_Characteristic=", // Characterstic (dynamic)
"Main.L_Potential", // ★☆☆☆ IV judge evaluation