public static string GetItemTip(ItemTips value) { FieldInfo fi = value.GetType().GetField(value.ToString()); DescriptionAttribute[] attributes = (DescriptionAttribute[])fi.GetCustomAttributes( typeof(DescriptionAttribute), false); if (attributes != null && attributes.Length > 0) { return(attributes[0].Description); } else { return(value.ToString()); } }
private void Awake() { if (instance == null) { instance = this; } pop = (RectTransform)PopUI.instance.transform; Transform parent = btns.transform; btn_count = parent.childCount; tfbtns = new Button[btn_count]; txtbtns = new Text[btn_count]; for (int i = 0; i < btn_count; i++) { Transform child = parent.GetChild(i); tfbtns[i] = child.GetComponent <Button>(); txtbtns[i] = child.GetComponentInChildren <Text>(); } }