64 lines
1.8 KiB
C#
64 lines
1.8 KiB
C#
using FairyGUI;
|
|
using NBC;
|
|
using UnityEngine;
|
|
|
|
namespace NBF.Utils
|
|
{
|
|
public static class ItemHelper
|
|
{
|
|
public static ItemType GetItemType(this uint id)
|
|
{
|
|
return (ItemType)(id / 10000);
|
|
}
|
|
|
|
public static string GetName(this uint id)
|
|
{
|
|
return Lan.Get($"Name_{id}");
|
|
}
|
|
|
|
public static string GetDesc(this uint id)
|
|
{
|
|
return Lan.Get($"Desc_{id}");
|
|
}
|
|
|
|
public static string GetIcon(this uint id)
|
|
{
|
|
//Assets/Resources/Icons/baitfrog.png
|
|
return $"Icons/{id}";
|
|
}
|
|
|
|
public static void SetIcon(this GLoader loader, uint id)
|
|
{
|
|
loader.url = id.GetIcon();
|
|
}
|
|
|
|
public static void SetIcon(this GComponent loader, uint id)
|
|
{
|
|
loader.icon = id.GetIcon();
|
|
}
|
|
|
|
#region 品质相关
|
|
|
|
public static Color QualityColor0 = new Color(1, 1, 1, 0);
|
|
public static Color QualityColor1 = new Color(96 / 255f, 160 / 255f, 224 / 255f, 1);
|
|
public static Color QualityColor2 = new Color(0 / 255f, 138 / 255f, 255 / 255f, 1);
|
|
public static Color QualityColor3 = new Color(126 / 255f, 0 / 255f, 255 / 255f, 1);
|
|
public static Color QualityColor4 = new Color(220 / 255f, 50 / 255f, 50 / 255f, 1);
|
|
public static Color QualityColor5 = new Color(255 / 255f, 108 / 255f, 0 / 255f, 1);
|
|
|
|
public static Color GetItemQualityColor(uint quality)
|
|
{
|
|
return quality switch
|
|
{
|
|
1 => QualityColor1,
|
|
2 => QualityColor2,
|
|
3 => QualityColor3,
|
|
4 => QualityColor4,
|
|
5 => QualityColor5,
|
|
_ => QualityColor0
|
|
};
|
|
}
|
|
|
|
#endregion
|
|
}
|
|
} |