[Bug] Name Remains after Deleting Pattern from Slot
Description:
When deleting a pattern from grid, the name of the last pattern stays in that slot.
Environment:
OS: Windows Version: 0.9.5p16 (latest)
Steps to Reproduce:
- Import a pattern into a slot
- Delete pattern from slot
Expected Behavior:
Name is set to "Empty" or "Design Pattern"
Actual Behavior:
Last pattern name remains
Screenshot:
Reproducibility:
Issue occurs consistently.
Related Issue:
Might be related to #41
Note:
When importing a pattern, the name is filled in successfully. This is only an issue when deleting patterns. This isn't an application-breaking bug, but more of a QoL thing.
The issue can be resolved by editing the following method: https://github.com/FluffyFishGames/ACNHDesignPatternEditor/blob/498aa02174c3bce744a9305f4f858d1e4c65e4cb/Assets/Plugins/DesignPatternExtension.cs#L278-L296
I've confirmed this to work, but I'm not a Unity developer and don't think I have my development environment set up correctly. I'm getting weird behavior even before making edits.
I've pushed the changes to my fork: https://github.com/JeffreyBytes/ACNHDesignPatternEditor/commit/f887f325f666fdac05e2c24fa1f751980789a451
Here's a code comparison between the old and new code:
public static void Empty(this DesignPattern pattern)
{
for (var i = 0; i < pattern.Palette.Length; i++)
{
pattern.Palette[i].R = EmptyPalette[i].Item1;
pattern.Palette[i].G = EmptyPalette[i].Item2;
pattern.Palette[i].B = EmptyPalette[i].Item3;
}
pattern.Image = new byte[(pattern.Width / 2) * pattern.Height];
if (pattern is ProDesignPattern)
{
pattern.Type = DesignPattern.TypeEnum.EmptyProPattern;
+ pattern.Name = "PRO Pattern";
Array.Copy(EmptyProPixels, 0, pattern.Image, 0, EmptyProPixels.Length);
}
else
{
+ pattern.Name = "Design Pattern";
Array.Copy(EmptyPixels, 0, pattern.Image, 0, pattern.Image.Length);
}
}
Not related to https://github.com/FluffyFishGames/ACNHDesignPatternEditor/issues/41 , but a sister issue with it and https://github.com/FluffyFishGames/ACNHDesignPatternEditor/issues/27 as well as https://github.com/FluffyFishGames/ACNHDesignPatternEditor/issues/30 in regards to some pattern logic issues.