示例#1
0
 bool GetIsExits(UIWindowBase UI)
 {
     if (!m_UIs.ContainsKey(UI.name))
     {
         return(false);
     }
     else
     {
         return(m_UIs[UI.name].Contains(UI));
     }
 }
示例#2
0
        public void DestroyUI(UIWindowBase UI)
        {
            DebugHandler.Log("UIManager DestroyUI " + UI.name);

            if (GetIsExits(UI))
            {
                RemoveUI(UI);
            }
            UI.OnDestoryUI();
            Destroy(UI.gameObject);
        }
示例#3
0
 /// <summary>
 /// 关闭UI
 /// </summary>
 /// <param name="UI">目标UI</param>
 public void CloseUIWindow(UIWindowBase UI, GameFrameworkAction <UIWindowBase> callback = null)
 {
     if (!UI.GetActive())//如果关闭
     {
         return;
     }
     m_UILayerManagerCom.RemoveUI(UI);
     callback.InvokeGracefully <UIWindowBase>(UI);
     UI.OnCloseUI();
     UI.SetActive(false);
 }
        public void RemoveUI(UIWindowBase ui)
        {
            switch (ui.m_UIType)
            {
            case UIType.GameUI: break;

            case UIType.Fixed: break;

            case UIType.Normal:

                //normalUIList.Remove(ui);
                break;

            case UIType.TopBar: break;

            case UIType.PopUp: break;
            }
        }
示例#5
0
        public T OpenInstanceUIWindow <T>() where T : UIWindowBase
        {
            if (EUIManagerState != EUIManagerState.e_Idle)
            {
                return(null);
            }
            string       UIName = typeof(T).Name;
            UIWindowBase UIbase = GetUI(UIName);

            if (UIbase == null)
            {
                UIbase = OpenUIWindow <T>();
            }
            else
            {
                UIbase.SetActive(true);
                UIbase.OnOpenUI();
            }
            return(UIbase as T);
        }
示例#6
0
        void RemoveUI(UIWindowBase UI)
        {
            if (UI == null)
            {
                throw new Exception("UIManager: RemoveUI error l_UI is null: !");
            }

            if (!m_UIs.ContainsKey(UI.name))
            {
                throw new Exception("UIManager: RemoveUI error dont find UI name: ->" + UI.name + "<-  " + UI);
            }

            if (!m_UIs[UI.name].Contains(UI))
            {
                throw new Exception("UIManager: RemoveUI error dont find UI: ->" + UI.name + "<-  " + UI);
            }
            else
            {
                m_UIs[UI.name].Remove(UI);
            }
        }
示例#7
0
        public UIWindowBase CreateUIWindow <T>(string UIName)
        {
            UIWindowBase UIbase = null;

            try
            {
                int        assetid = UIManager.UI_Table.GetRowByUIType(UIName).assetid;
                GameObject UItmp   = GameObjectUtility.CreateGameObject(assetid, m_UIManagerGo);
                UIbase = UItmp.GetComponent <UIWindowBase>();


                UIbase.OnInitUI(GetUIID(UIName));
                m_UILayerManagerCom.SetLayer(UIbase);//设置层级
                AddUI(UIbase);
            }
            catch (Exception e)
            {
                DebugHandler.LogError("OnInit Exception: " + e.ToString());
            }


            return(UIbase);
        }