From bb41fb70e6b81c34ca97e7c99d7571caa1406645 Mon Sep 17 00:00:00 2001 From: RandomGuy <69272011+RandomGuy155@users.noreply.github.com> Date: Thu, 18 Dec 2025 00:36:49 -0500 Subject: [PATCH] Add Star Display to Donut Editor (#4662) --- .../Properties/Resources.Designer.cs | 12 ++- PKHeX.Drawing.Misc/Properties/Resources.resx | 3 + .../Resources/img/misc/star.png | Bin 0 -> 2091 bytes PKHeX.Drawing.Misc/Util/DonutSpriteUtil.cs | 1 + .../Gen9/DonutEditor9a.Designer.cs | 72 +++++++++++++++++- .../Save Editors/Gen9/DonutEditor9a.cs | 14 ++++ 6 files changed, 100 insertions(+), 2 deletions(-) create mode 100644 PKHeX.Drawing.Misc/Resources/img/misc/star.png diff --git a/PKHeX.Drawing.Misc/Properties/Resources.Designer.cs b/PKHeX.Drawing.Misc/Properties/Resources.Designer.cs index 61a98aefc..388aa685e 100644 --- a/PKHeX.Drawing.Misc/Properties/Resources.Designer.cs +++ b/PKHeX.Drawing.Misc/Properties/Resources.Designer.cs @@ -19,7 +19,7 @@ namespace PKHeX.Drawing.Misc.Properties { // class via a tool like ResGen or Visual Studio. // To add or remove a member, edit your .ResX file then rerun ResGen // with the /str option, or rebuild your VS project. - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "18.0.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] public class Resources { @@ -4400,6 +4400,16 @@ public class Resources { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + public static System.Drawing.Bitmap star { + get { + object obj = ResourceManager.GetObject("star", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/PKHeX.Drawing.Misc/Properties/Resources.resx b/PKHeX.Drawing.Misc/Properties/Resources.resx index d522c4a72..c7ac9ceed 100644 --- a/PKHeX.Drawing.Misc/Properties/Resources.resx +++ b/PKHeX.Drawing.Misc/Properties/Resources.resx @@ -1819,4 +1819,7 @@ ..\Resources\img\donut\donut_bitter03.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\img\misc\star.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/PKHeX.Drawing.Misc/Resources/img/misc/star.png b/PKHeX.Drawing.Misc/Resources/img/misc/star.png new file mode 100644 index 0000000000000000000000000000000000000000..8005d67ceff213951f78bd24b9af3ec314690d16 GIT binary patch literal 2091 zcmV+`2-Nq9P)EX>4Tx04R}tkv&MmKp2MKrbUL09CV$ zOfoL!3#($_6+w(ZpfxHnQ%_|VbMPEr_we!kF2b|C>;4==O3`G1Pb7{p-LQx^i03vf zo%23%h*czo_?&p!pbHW|a$R=$jdR&yfoFz{TqZ#rA{NU%EcY<07%K5Baad6`$`|r3 zE1b7DtF;E}+>^gBSkzXsT&FpKB$kju8X{ygP(=+EBD8Cyn8?t1+`~Wa_|xQ)$yEg- z#{%k5Avu2VKlt5SvosTRlY()e|HZaHCV{{%&~DoH_pxoaPXPZjaHVzq^%gMyNqV!Z zg^z&YZQ$a%tI2!7A(Ki)<(OY0}&Fx#~9H$RJj(W9x0~{Oz zQ)S9t_jva}Z{Pl{>Gbahs}*v+)hdBn00006VoOIv0RI600RN!9r;`8x010qNS#tmY zE+YT{E+YYWr9XB6000McNliru=?oGA5&*dmHbMXZ02y>eSad^gZEa<4bO1wgWnpw> zWFU8GbZ8()Nlj2!fese{00sj|L_t(&-qo6WP*hbM$3N@JvZTlg1c)Mv3MwLCilC8> zO=;4YO+!<@QZZ|)$sUxcf7DFHWN1#K(=?7&lTGGhY#gCIv)=1vOED5m3Nv z*a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)iCa`!ym(8@ZPaz7D2c zdpn#fg^V3=C|iARULvet1xc|mQ0urObO}nf8W_y3+2WykaeL>T}&FWb?KFSf(Dg|KC}>edzDRbUFzs~b5;e;cGC1)~Aj zx(6nu!iKGqKW=M3aaHm`dhJ3y5rwEZDgEPAeFE`qdZ*Vj1aKR8vttKzF zRW=$gWFO&cM-$OO@&&%6!}}{%SB<0j(Va9L__;&xRR9|SS03sEWuUSSD*x&%#Q#5? VR}Kqg2i*Vw002ovPDHLkV1oJ1v8Vt5 literal 0 HcmV?d00001 diff --git a/PKHeX.Drawing.Misc/Util/DonutSpriteUtil.cs b/PKHeX.Drawing.Misc/Util/DonutSpriteUtil.cs index a1ff7d69c..7fb99105c 100644 --- a/PKHeX.Drawing.Misc/Util/DonutSpriteUtil.cs +++ b/PKHeX.Drawing.Misc/Util/DonutSpriteUtil.cs @@ -18,6 +18,7 @@ public static class DonutSpriteUtil /// The donut to get the sprite for. /// A representing the sprite image. public static Bitmap? Sprite(this Donut9a donut) => GetDonutImage(donut); + public static Bitmap? StarSprite => (Bitmap?)Resources.ResourceManager.GetObject("star"); private static Bitmap? GetDonutImage(Donut9a donut) { diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen9/DonutEditor9a.Designer.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen9/DonutEditor9a.Designer.cs index cffa3eb83..6a3714770 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen9/DonutEditor9a.Designer.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen9/DonutEditor9a.Designer.cs @@ -63,6 +63,11 @@ private void InitializeComponent() CB_Donut = new System.Windows.Forms.ComboBox(); CAL_Date = new System.Windows.Forms.DateTimePicker(); L_Milliseconds = new System.Windows.Forms.Label(); + PB_Star1 = new System.Windows.Forms.PictureBox(); + PB_Star2 = new System.Windows.Forms.PictureBox(); + PB_Star3 = new System.Windows.Forms.PictureBox(); + PB_Star4 = new System.Windows.Forms.PictureBox(); + PB_Star5 = new System.Windows.Forms.PictureBox(); tableLayoutPanel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)PB_Berry0).BeginInit(); ((System.ComponentModel.ISupportInitialize)PB_Berry1).BeginInit(); @@ -79,6 +84,11 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)NUD_Stars).BeginInit(); ((System.ComponentModel.ISupportInitialize)NUD_LevelBoost).BeginInit(); ((System.ComponentModel.ISupportInitialize)NUD_Calories).BeginInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star1).BeginInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star2).BeginInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star3).BeginInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star4).BeginInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star5).BeginInit(); SuspendLayout(); // // tableLayoutPanel1 @@ -451,7 +461,7 @@ private void InitializeComponent() // PB_Donut.Location = new System.Drawing.Point(466, 0); PB_Donut.Name = "PB_Donut"; - PB_Donut.Size = new System.Drawing.Size(80, 80); + PB_Donut.Size = new System.Drawing.Size(72, 72); PB_Donut.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; PB_Donut.TabIndex = 62; PB_Donut.TabStop = false; @@ -686,10 +696,60 @@ private void InitializeComponent() L_Milliseconds.Text = "Milliseconds:"; L_Milliseconds.TextAlign = System.Drawing.ContentAlignment.MiddleRight; // + // PB_Star1 + // + PB_Star1.Location = new System.Drawing.Point(540, 2); + PB_Star1.Name = "PB_Star1"; + PB_Star1.Size = new System.Drawing.Size(20, 20); + PB_Star1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + PB_Star1.TabIndex = 64; + PB_Star1.TabStop = false; + // + // PB_Star2 + // + PB_Star2.Location = new System.Drawing.Point(560, 2); + PB_Star2.Name = "PB_Star2"; + PB_Star2.Size = new System.Drawing.Size(20, 20); + PB_Star2.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + PB_Star2.TabIndex = 65; + PB_Star2.TabStop = false; + // + // PB_Star3 + // + PB_Star3.Location = new System.Drawing.Point(580, 2); + PB_Star3.Name = "PB_Star3"; + PB_Star3.Size = new System.Drawing.Size(20, 20); + PB_Star3.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + PB_Star3.TabIndex = 66; + PB_Star3.TabStop = false; + // + // PB_Star4 + // + PB_Star4.Location = new System.Drawing.Point(600, 2); + PB_Star4.Name = "PB_Star4"; + PB_Star4.Size = new System.Drawing.Size(20, 20); + PB_Star4.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + PB_Star4.TabIndex = 67; + PB_Star4.TabStop = false; + // + // PB_Star5 + // + PB_Star5.Location = new System.Drawing.Point(620, 2); + PB_Star5.Name = "PB_Star5"; + PB_Star5.Size = new System.Drawing.Size(20, 20); + PB_Star5.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + PB_Star5.TabIndex = 68; + PB_Star5.TabStop = false; + // // DonutEditor9a // AutoSize = true; AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + Controls.Add(PB_Star5); + Controls.Add(PB_Star4); + Controls.Add(PB_Star3); + Controls.Add(PB_Star2); + Controls.Add(PB_Star1); Controls.Add(PB_Donut); Controls.Add(flowLayoutPanel1); Name = "DonutEditor9a"; @@ -712,6 +772,11 @@ private void InitializeComponent() ((System.ComponentModel.ISupportInitialize)NUD_Stars).EndInit(); ((System.ComponentModel.ISupportInitialize)NUD_LevelBoost).EndInit(); ((System.ComponentModel.ISupportInitialize)NUD_Calories).EndInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star1).EndInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star2).EndInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star3).EndInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star4).EndInit(); + ((System.ComponentModel.ISupportInitialize)PB_Star5).EndInit(); ResumeLayout(false); PerformLayout(); } @@ -764,5 +829,10 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox CB_Donut; private System.Windows.Forms.DateTimePicker CAL_Date; private System.Windows.Forms.Label L_Milliseconds; + private System.Windows.Forms.PictureBox PB_Star1; + private System.Windows.Forms.PictureBox PB_Star2; + private System.Windows.Forms.PictureBox PB_Star3; + private System.Windows.Forms.PictureBox PB_Star4; + private System.Windows.Forms.PictureBox PB_Star5; } } diff --git a/PKHeX.WinForms/Subforms/Save Editors/Gen9/DonutEditor9a.cs b/PKHeX.WinForms/Subforms/Save Editors/Gen9/DonutEditor9a.cs index 783dcc638..06cb608e1 100644 --- a/PKHeX.WinForms/Subforms/Save Editors/Gen9/DonutEditor9a.cs +++ b/PKHeX.WinForms/Subforms/Save Editors/Gen9/DonutEditor9a.cs @@ -64,6 +64,8 @@ public void InitializeLists(ReadOnlySpan flavors, ReadOnlySpan i CAL_Date.ValueChanged += ChangeDateTime; TB_Milliseconds.TextChanged += OnValueChanged; TB_Milliseconds.TextChanged += ChangeMilliseconds; + NUD_Stars.ValueChanged += OnValueChanged; + NUD_Stars.ValueChanged += NUD_Stars_ValueChanged; } private static void SetDataSource(ComboBox cb, List list) @@ -133,6 +135,8 @@ public void LoadDonut(Donut9a donut) CB_Donut.SelectedValue = (int)donut.Donut; + LoadDonutStarCount(donut.Stars); // acknowledge existing star count + CB_Berry0.SelectedValue = (int)donut.BerryName; CB_Berry1.SelectedValue = (int)donut.Berry1; CB_Berry2.SelectedValue = (int)donut.Berry2; @@ -240,6 +244,14 @@ private static ulong GetDonutFlavorHash(ComboBox cb) return hash; } + private void LoadDonutStarCount(byte count) + { + var star = DonutSpriteUtil.StarSprite; + PictureBox[] starBoxes = [PB_Star1, PB_Star2, PB_Star3, PB_Star4, PB_Star5]; + for (int i = 0; i < starBoxes.Length; i++) + starBoxes[i].Image = i < count ? star : null; + } + private void CB_Donut_SelectedIndexChanged(object? sender, EventArgs e) { _donut.Donut = (ushort)CB_Donut.SelectedIndex; @@ -333,4 +345,6 @@ private void ChangeDateTime(object? sender, EventArgs e) private sealed record ComboText(string Text, string Value); // ReSharper enable NotAccessedPositionalProperty.Local public string GetDonutName() => CB_Donut.Text; + + private void NUD_Stars_ValueChanged(object? sender, EventArgs e) => LoadDonutStarCount((byte)NUD_Stars.Value); }