Fix Importing Donut (#4680)

Also fix donutEditor not following the variable naming convention
This commit is contained in:
Jonathan Herbert 2026-01-02 23:07:57 -04:00 committed by GitHub
parent 8c5eb6fa9f
commit fecd2a3ddb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 23 additions and 22 deletions

View File

@ -38,7 +38,7 @@ private void InitializeComponent()
mnuShinyAssortment = new System.Windows.Forms.ToolStripMenuItem();
B_ModifyAll = new System.Windows.Forms.Button();
B_Reset = new System.Windows.Forms.Button();
donutEditor = new DonutEditor9a();
DonutEditor = new DonutEditor9a();
B_Import = new System.Windows.Forms.Button();
B_Export = new System.Windows.Forms.Button();
DonutFlavorProfile = new DonutFlavorProfile9a();
@ -135,15 +135,15 @@ private void InitializeComponent()
//
// donutEditor
//
donutEditor.AllowDrop = true;
donutEditor.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
donutEditor.AutoSize = true;
donutEditor.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
donutEditor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
donutEditor.Location = new System.Drawing.Point(207, 15);
donutEditor.Name = "donutEditor";
donutEditor.Size = new System.Drawing.Size(647, 240);
donutEditor.TabIndex = 27;
DonutEditor.AllowDrop = true;
DonutEditor.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
DonutEditor.AutoSize = true;
DonutEditor.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
DonutEditor.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
DonutEditor.Location = new System.Drawing.Point(207, 15);
DonutEditor.Name = "donutEditor";
DonutEditor.Size = new System.Drawing.Size(647, 240);
DonutEditor.TabIndex = 27;
//
// B_Import
//
@ -185,7 +185,7 @@ private void InitializeComponent()
ClientSize = new System.Drawing.Size(894, 482);
Controls.Add(B_Export);
Controls.Add(B_Import);
Controls.Add(donutEditor);
Controls.Add(DonutEditor);
Controls.Add(B_Reset);
Controls.Add(B_ModifyAll);
Controls.Add(B_Save);
@ -216,7 +216,7 @@ private void InitializeComponent()
private System.Windows.Forms.ToolStripMenuItem mnuShinyAssortment;
private System.Windows.Forms.Button B_ModifyAll;
private System.Windows.Forms.Button B_Reset;
private DonutEditor9a donutEditor;
private DonutEditor9a DonutEditor;
private System.Windows.Forms.Button B_Import;
private System.Windows.Forms.Button B_Export;
private DonutFlavorProfile9a DonutFlavorProfile;

View File

@ -24,8 +24,8 @@ public SAV_Donut9a(SAV9ZA sav)
Donuts = SAV.Donuts;
var strings = GameInfo.Strings;
donutEditor.InitializeLists(strings.donutFlavor, strings.itemlist, strings.donutName);
donutEditor.ValueChanged += Editor_ValueChanged;
DonutEditor.InitializeLists(strings.donutFlavor, strings.itemlist, strings.donutName);
DonutEditor.ValueChanged += Editor_ValueChanged;
Loading = true;
LoadDonutNames();
@ -35,7 +35,7 @@ public SAV_Donut9a(SAV9ZA sav)
lastIndex = 0;
GetEntry(0);
AddDrop(this, LB_Donut, donutEditor);
AddDrop(this, LB_Donut, DonutEditor);
DonutFlavorProfile.BackgroundImage = DonutSpriteUtil.GetFlavorProfileImage();
}
@ -93,7 +93,6 @@ private void Editor_ValueChanged(object? sender, EventArgs e)
LB_Donut.Items[index] = currentName;
// Update profile if applicable
donutEditor.SaveDonut();
DonutFlavorProfile.LoadFromDonut(donut);
Loading = false;
}
@ -115,7 +114,7 @@ private void GetEntry(int index)
Loading = true;
var donut = Donuts.GetDonut(index);
donutEditor.LoadDonut(donut);
DonutEditor.LoadDonut(donut);
DonutFlavorProfile.LoadFromDonut(donut);
Loading = false;
}
@ -125,7 +124,7 @@ private void SetEntry(int index)
if (Loading || index < 0)
return;
donutEditor.SaveDonut();
DonutEditor.SaveDonut();
}
private void B_Cancel_Click(object sender, EventArgs e) => Close();
@ -167,7 +166,7 @@ private void ShinyAssortment(object sender, EventArgs e)
System.Media.SystemSounds.Asterisk.Play();
}
private void B_Reset_Click(object sender, EventArgs e) => donutEditor.Reset();
private void B_Reset_Click(object sender, EventArgs e) => DonutEditor.Reset();
private void B_ImportClick(object sender, EventArgs e)
{
@ -177,7 +176,8 @@ private void B_ImportClick(object sender, EventArgs e)
if (!TryLoadDonut(data))
return;
donutEditor.LoadDonut(current);
DonutEditor.LoadDonut(current);
DonutFlavorProfile.LoadFromDonut(current);
System.Media.SystemSounds.Asterisk.Play();
}
@ -224,7 +224,8 @@ private void DragoutDrop(object? sender, DragEventArgs? e)
var current = Donuts.GetDonut(lastIndex);
var data = current.Data;
ImportDonutFromPath(data, files[0]);
donutEditor.LoadDonut(current);
DonutEditor.LoadDonut(current);
DonutFlavorProfile.LoadFromDonut(current);
System.Media.SystemSounds.Asterisk.Play();
e.Effect = DragDropEffects.Copy;
@ -268,7 +269,7 @@ private void B_Export_Click(object sender, EventArgs e)
using var sfd = new SaveFileDialog();
sfd.Title = "Export Donut";
sfd.Filter = "Donut File (*.donut)|*.donut|All Files (*.*)|*.*";
sfd.FileName = $"{lastIndex + 1:000}_{donutEditor.GetDonutName()}.donut";
sfd.FileName = $"{lastIndex + 1:000}_{DonutEditor.GetDonutName()}.donut";
if (sfd.ShowDialog() != DialogResult.OK)
return;
System.IO.File.WriteAllBytes(sfd.FileName, data);