优化道具稀有度的 UI 表现
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
using System;
|
||||
using SepCore.Definition;
|
||||
using UnityEngine;
|
||||
|
||||
namespace SepCore.UI
|
||||
{
|
||||
[CreateAssetMenu(menuName = "UI/Rarity Palette")]
|
||||
public class RarityPalette : ScriptableObject
|
||||
{
|
||||
[Serializable]
|
||||
public struct Colors
|
||||
{
|
||||
public Color Border;
|
||||
public Color CardBackground;
|
||||
public Color IconBackground;
|
||||
}
|
||||
|
||||
[SerializeField] private Colors _none;
|
||||
[SerializeField] private Colors _white;
|
||||
[SerializeField] private Colors _blue;
|
||||
[SerializeField] private Colors _purple;
|
||||
[SerializeField] private Colors _red;
|
||||
|
||||
public Colors Get(Rarity rarity)
|
||||
{
|
||||
return rarity switch
|
||||
{
|
||||
Rarity.None => _none,
|
||||
Rarity.White => _white,
|
||||
Rarity.Blue => _blue,
|
||||
Rarity.Purple => _purple,
|
||||
Rarity.Red => _red,
|
||||
_ => throw new ArgumentOutOfRangeException(nameof(rarity), rarity, "Unsupported UI rarity.")
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user