mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-24 04:53:08 +00:00
3b54ac6ecc
new Visual Studio version made my designer code ugly maybe I should refactor the GUI like they recommend :P
47 lines
1.2 KiB
C#
47 lines
1.2 KiB
C#
using System.Drawing;
|
|
using PKHeX.Core;
|
|
using PKHeX.Drawing.Misc.Properties;
|
|
|
|
namespace PKHeX.Drawing.Misc;
|
|
|
|
public static class RibbonSpriteUtil
|
|
{
|
|
public static Image? GetRibbonSprite(RibbonIndex ribbon)
|
|
{
|
|
var name = $"Ribbon{ribbon}";
|
|
return GetRibbonSprite(name);
|
|
}
|
|
|
|
public static Image? GetRibbonSprite(string name)
|
|
{
|
|
var resource = name.Replace("CountG3", "G3").ToLowerInvariant();
|
|
return (Bitmap?)Resources.ResourceManager.GetObject(resource);
|
|
}
|
|
|
|
public static Image? GetRibbonSprite(string name, int max, int value)
|
|
{
|
|
var resource = GetRibbonSpriteName(name, max, value);
|
|
return (Bitmap?)Resources.ResourceManager.GetObject(resource);
|
|
}
|
|
|
|
private static string GetRibbonSpriteName(string name, int max, int value)
|
|
{
|
|
if (max != 4) // Memory
|
|
{
|
|
var sprite = name.ToLowerInvariant();
|
|
if (max == value)
|
|
return sprite + "2";
|
|
return sprite;
|
|
}
|
|
|
|
// Count ribbons
|
|
string n = name.Replace("Count", string.Empty).ToLowerInvariant();
|
|
return value switch
|
|
{
|
|
2 => n + "super",
|
|
3 => n + "hyper",
|
|
4 => n + "master",
|
|
_ => n,
|
|
};
|
|
}
|
|
}
|