| | 1 | | using UnityEngine; |
| | 2 | |
|
| | 3 | | [CreateAssetMenu(fileName = "NftRarityBackground", menuName = "Variables/NftRarityBackground")] |
| | 4 | | public class NftRarityBackgroundSO : ScriptableObject |
| | 5 | | { |
| | 6 | | private const string DEFAULT_RARITY = "default"; |
| | 7 | | [SerializeField] public SerializableKeyValuePair<string, Sprite>[] rarityIcons; |
| | 8 | |
|
| | 9 | | public Sprite GetRarityImage(string nftRarity) |
| | 10 | | { |
| 151 | 11 | | nftRarity = string.IsNullOrEmpty(nftRarity) ? DEFAULT_RARITY : nftRarity; |
| 1854 | 12 | | foreach (var icon in rarityIcons) |
| | 13 | | { |
| 849 | 14 | | if(icon.key == nftRarity) |
| 146 | 15 | | return icon.value; |
| | 16 | | } |
| | 17 | |
|
| 5 | 18 | | return null; |
| | 19 | | } |
| | 20 | | } |