using System; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; using Object = UnityEngine.Object; public abstract class UI_Base : MonoBehaviour { Dictionary _objects = new Dictionary(); public abstract void Init(); protected void Bind(Type type) where T : Object { string[] names = Enum.GetNames(type); Object[] objects = new Object[names.Length]; _objects.Add(typeof(T), objects); for (int i = 0; i < names.Length; i++) { if(typeof(T) == typeof(GameObject)) { objects[i] = Util.FindChild(gameObject, names[i],true); } else { objects[i] = Util.FindChild(gameObject, names[i],true); } } } protected T Get(int idx) where T : Object { Object[] objects = null; if (_objects.TryGetValue(typeof(T), out objects) == false || idx < 0 || idx >= objects.Length) return null; return objects[idx] as T; } protected TextMeshProUGUI GetText(int idx) { return Get(idx); } protected Button GetButton(int idx) { return Get