Files
Cielonos/Assets/Scripts/MainGame/UI/Common/RewardUIFormatter.cs
SoulliesOfficial 39b43680a9 爆更
2026-07-18 03:16:20 -04:00

58 lines
1.7 KiB
C#

using Cielonos.MainGame.Inventory;
using UnityEngine;
namespace Cielonos.MainGame.UI
{
public static class RewardUIFormatter
{
public static string FormatItemType(ItemType type)
{
return type switch
{
ItemType.MainWeapon => "主武器",
ItemType.Support => "支援装备",
ItemType.Passive => "被动装备",
ItemType.Consumable => "消耗品",
_ => type.ToString()
};
}
public static string FormatRarity(ItemRarity rarity)
{
return rarity switch
{
ItemRarity.Tera => "Tera",
ItemRarity.Moser => "Moser",
ItemRarity.Graham => "Graham",
ItemRarity.Epsilon => "Epsilon",
ItemRarity.Aleph => "Aleph",
_ => rarity.ToString()
};
}
public static Color GetRarityColor(ItemRarity rarity)
{
return rarity switch
{
ItemRarity.Tera => new Color(0.68f, 0.86f, 1f, 0.95f),
ItemRarity.Moser => new Color(0.56f, 0.95f, 0.7f, 0.95f),
ItemRarity.Graham => new Color(0.94f, 0.82f, 0.43f, 0.95f),
ItemRarity.Epsilon => new Color(0.96f, 0.55f, 0.95f, 0.95f),
ItemRarity.Aleph => new Color(1f, 0.42f, 0.36f, 0.95f),
_ => new Color(0.8f, 0.8f, 0.8f, 0.85f)
};
}
public static string FormatTypeAndRarity(ContentData data)
{
if (data == null)
{
return string.Empty;
}
return $"{FormatItemType(data.itemType)} - {FormatRarity(data.itemRarity)}";
}
}
}