Beispiel #1
0
        public void PopPanel(UIPanelType panelType, bool isDestory = false)
        {
            if (panelList == null || panelList.Count <= 0)
            {
                return;
            }

            BaseUI topPanel = panelDict[panelType];

            topPanel.OnExit();
            panelList.Remove(topPanel);
            if (isDestory)
            {
                GameObject.Destroy(topPanel.gameObject);
                panelDict.Remove(panelType);
            }
        }
Beispiel #2
0
        public BaseUI PushPanel(UIPanelType panelType, bool isExit = false)
        {
            BaseUI topPanel = null;

            if (panelList.Count > 0 && isExit)
            {
                topPanel = panelList[panelList.Count - 1];
                topPanel.OnExit();
            }
            BaseUI panel = GetPanel(panelType);

            if (!panelList.Contains(panel))
            {
                panelList.Add(panel);
                panel.OnEnter();
            }
            return(panel);
        }