using System.Collections.Generic; using UnityEngine; using ZXL.Manager; namespace ZXL.Scripts.UI { public enum UIType { LoginUI, AssetsUI, PushModelUI, ConctrolUI, } public class UIManager : Manager { Dictionary dic = new Dictionary(); public override void OnAwake() { base.OnAwake(); var uiBases = GameObject.FindObjectsOfType(); foreach (var uiBase in uiBases) { dic.Add(uiBase.uiType, uiBase); uiBase.Close(); Debug.Log($"[{uiBase.uiType.ToString()}] UIBase: {uiBase}"); } Open(UIType.AssetsUI); } public UIBase Open(UIType uiType) { dic[uiType].Open(); return dic[uiType]; } public UIBase GetUI(UIType uiType) { return dic[uiType]; } public void Close(UIType uiType) { dic[uiType].Close(); } } }