using System; using System.Collections.Generic; using TMPro; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.UI; public abstract class UI_Base : MonoBehaviour { Dictionary _objects = new Dictionary(); public abstract void Init(); // Bind<제네릭>(인자) protected void Bind(Type type) where T : UnityEngine.Object { string[] names = Enum.GetNames(type); UnityEngine.Object[] objects = new UnityEngine.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); } if (objects[i] == null) { Debug.Log($"Fail to Bind({names[i]})"); } } } protected T Get(int idx) where T : UnityEngine.Object { UnityEngine.Object[] objects = null; if (_objects.TryGetValue(typeof(T), out objects) == false) { return null; } return objects[idx] as T; } protected GameObject GetObject(int idx) { return Get(idx); } protected TextMeshProUGUI GetText(int idx) { return Get(idx); } protected Button GetButton(int idx) { return Get