/// <summary> /// 初始化FairyGUI /// </summary> public void Awake() { MonoInstance = ETModel.Game.Scene.GetComponent <ETModel.FairyGUIComponent>(); baseUIContainer = ComponentFactory.Create <FairyGUIContainer>(); _LayerDictionary = new Dictionary <FairyGUIType, List <FairyGUIBaseUI> >(); _LayerDictionary.Add(ETModel.FairyGUIType.UITYPE_FIXED, new List <FairyGUIBaseUI>()); _LayerDictionary.Add(ETModel.FairyGUIType.UITYPE_POPUP, new List <FairyGUIBaseUI>()); }
/// <summary> /// 非泛型方法创建UI /// </summary> /// <param name="uIType"></param> /// <returns></returns> internal FairyGUIBaseUI Create(Type uIType) { if (baseUIContainer.IsDisposed) { baseUIContainer = ComponentFactory.Create <FairyGUIContainer>(); } FairyGUIBaseUI t = baseUIContainer.GetComponent(uIType) as FairyGUIBaseUI; if (t == null) { t = baseUIContainer.AddComponent(uIType) as FairyGUIBaseUI; t.gObj = MonoInstance.Create(t.pakName, t.cmpName); //加入到对应层中。 _LayerDictionary[t.UIType].Add(t); ShowLayer(); } t.InitUI(); return(t); }