using System; using System.Collections; using System.Collections.Generic; using TMPro; using UnityEngine; /// /// This class' only purpose is to set the class of an item view prototype. Could be the item itself, or the infobox, or anything! /// [RequireComponent(typeof(TextMeshProUGUI))] public class ItemClassDisplay : MonoBehaviour { private TextMeshProUGUI text; private void Start() { text = GetComponent(); // Because of the meta tag, Unity will make sure this exists. No sanity checks } public void SetClass(ItemRarity clas) { if(text == null) text = GetComponent(); // Just in case this gets called before Start() text.text = clas.ToString(); //text.color = new Color32((byte)((uint)clas >> 24), (byte)((uint)clas >> 16), (byte)((uint)clas >> 8), (byte)((uint)clas)); text.color = new Color32((byte)((int)clas >> 16), (byte)((int)clas >> 8), (byte)((int)clas), 0xFF); } }