mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-03-21 17:48:28 -05:00
Add Star Display to Donut Editor (#4662)
This commit is contained in:
parent
311314c3d3
commit
bb41fb70e6
12
PKHeX.Drawing.Misc/Properties/Resources.Designer.cs
generated
12
PKHeX.Drawing.Misc/Properties/Resources.Designer.cs
generated
|
|
@ -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 {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
public static System.Drawing.Bitmap star {
|
||||
get {
|
||||
object obj = ResourceManager.GetObject("star", resourceCulture);
|
||||
return ((System.Drawing.Bitmap)(obj));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -1819,4 +1819,7 @@
|
|||
<data name="donut_bitter03" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\img\donut\donut_bitter03.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="star" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\img\misc\star.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
</root>
|
||||
BIN
PKHeX.Drawing.Misc/Resources/img/misc/star.png
Normal file
BIN
PKHeX.Drawing.Misc/Resources/img/misc/star.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
|
|
@ -18,6 +18,7 @@ public static class DonutSpriteUtil
|
|||
/// <param name="donut">The donut to get the sprite for.</param>
|
||||
/// <returns>A <see cref="Bitmap"/> representing the sprite image.</returns>
|
||||
public static Bitmap? Sprite(this Donut9a donut) => GetDonutImage(donut);
|
||||
public static Bitmap? StarSprite => (Bitmap?)Resources.ResourceManager.GetObject("star");
|
||||
|
||||
private static Bitmap? GetDonutImage(Donut9a donut)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -64,6 +64,8 @@ public void InitializeLists(ReadOnlySpan<string> flavors, ReadOnlySpan<string> 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<T>(ComboBox cb, List<T> 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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user