Example #1
0
 private void PushPanel2Stack(AbstractPanel panel)
 {
     if (m_PopStack != null && m_PopStack.Count > 0)
     {
         AbstractPanel topPanel = m_PopStack.Peek();
         topPanel.PanelClose();
     }
     m_PopStack.Push(panel);
 }
Example #2
0
        public AbstractPanel GetPanelLoaded(UIID uiID)
        {
            AbstractPanel panel = null;

            if (m_AllPanelMap.TryGetValue(uiID, out panel))
            {
                return(panel);
            }
            return(null);
        }
Example #3
0
        public AbstractPanel GetPanel(UIID uiID)
        {
            PanelData panelData = null;
            var       data      = UIDataTable.Get(uiID);

            if (data != null)
            {
                panelData = data as PanelData;
            }
            AbstractPanel panel = null;

            if (!m_AllPanelMap.TryGetValue(uiID, out panel))
            {
                GameObject panelGo = null;
                GameObject uiGo    = m_UILoader.LoadSync(data.fullPath) as GameObject;
                panelGo = GameObject.Instantiate(uiGo);
                panel   = panelGo.GetComponent <AbstractPanel>();
                m_AllPanelMap.Add(uiID, panel);
                panel.uiID = uiID;
            }

            if (panel != null)
            {
                panel.ShowMode = panelData.m_PanelShowMode;
                switch (panel.ShowMode)
                {
                case PanelShowMode.Normal:
                    panel.transform.SetParent(m_UIRoot.NormalRoot);
                    break;

                case PanelShowMode.Pop:
                    panel.transform.SetParent(m_UIRoot.PopRoot);
                    break;

                case PanelShowMode.HideOther:
                    panel.transform.SetParent(m_UIRoot.NormalRoot);
                    break;
                }

                panel.GetComponent <RectTransform>().offsetMax = new Vector2(0, 0);
                panel.GetComponent <RectTransform>().offsetMin = new Vector2(0, 0);
                //panelGo.transform.localRotation = Quaternion.Euler(Vector3.zero);
                panel.transform.localScale    = Vector3.one;
                panel.transform.localPosition = Vector3.zero;
                return(panel);
            }
            return(null);
        }
Example #4
0
        private void AdjustSiblingIndex(AbstractPanel panel)
        {
            switch (panel.ShowMode)
            {
            case PanelShowMode.Normal:
                //处理panel层级关系
                UpdatePanelSibling();
                break;

            case PanelShowMode.Pop:
                PushPanel2Stack(panel);
                break;

            case PanelShowMode.HideOther:
                HideOtherPanels(panel);
                break;
            }
        }
Example #5
0
        public void ClosePanel(UIID uiID)
        {
            PanelData panelData = null;
            var       data      = UIDataTable.Get(uiID);

            if (data != null)
            {
                panelData = data as PanelData;
            }
            AbstractPanel panel = null;

            if (m_CurrentShowMap.TryGetValue(uiID, out panel))
            {
                if (panel != null && panelData != null)
                {
                    m_CurrentShowMap.Remove(uiID);
                    m_CurrentShowList.Remove(panel);
                    panel.PanelClose();
                    switch (panelData.m_PanelShowMode)
                    {
                    case PanelShowMode.Pop:
                        if (m_PopStack != null && m_PopStack.Count > 0)
                        {
                            m_PopStack.Pop();
                            if (m_PopStack.Count > 0)
                            {
                                AbstractPanel topPanel = m_PopStack.Peek();
                                topPanel.PanelOpen();
                            }
                        }
                        break;

                    case PanelShowMode.HideOther:
                        m_UIRoot.NormalRoot.gameObject.SetActive(true);
                        m_UIRoot.PopRoot.gameObject.SetActive(true);
                        break;
                    }
                }
                else
                {
                    Log.I("Close Panel failed:" + uiID);
                }
            }
        }
Example #6
0
        public void OpenPanelTop(UIID uiID, params object[] args)
        {
            AbstractPanel panel = null;

            if (!m_AllPanelMap.TryGetValue(uiID, out panel))
            {
                panel = GetPanel(uiID);
                panel.PanelInit();
                if (panel == null)
                {
                    Log.I("No find panel:{0}", uiID.ToString());
                    return;
                }
            }
            panel.transform.SetParent(m_UIRoot.TopRoot);

            if (!m_CurrentShowMap.ContainsValue(panel))
            {
                m_CurrentShowMap.Add(uiID, panel);
            }
            m_CurrentShowList.Add(panel);
            panel.PanelOpen(args);
        }
Example #7
0
        public void OpenPanel(UIID uiID, params object[] args)
        {
            AbstractPanel panel = null;

            if (!m_AllPanelMap.TryGetValue(uiID, out panel))
            {
                panel = GetPanel(uiID);
                panel.PanelInit();
                if (panel == null)
                {
                    Log.I("No find panel:{0}", uiID.ToString());
                    return;
                }
            }
            panel.SortIndex = m_UIRoot.RequireNextPanelSortingOrder(panel.ShowMode);
            AdjustSiblingIndex(panel);
            if (!m_CurrentShowMap.ContainsValue(panel))
            {
                m_CurrentShowMap.Add(uiID, panel);
            }
            m_CurrentShowList.Add(panel);
            panel.PanelOpen(args);
        }
Example #8
0
        public static RectTransform FindTransformInPanel(string targetPanelName, string targetUINodePath)
        {
            UIData data = UIDataTable.Get(targetPanelName);

            if (data == null)
            {
                return(null);
            }
            AbstractPanel panel = UIMgr.S.GetPanel((UIID)data.uiID);//UIMgr.S.uiRoot.panelRoot.Find(targetPanelName);

            if (panel == null)
            {
                return(null);
            }

            Transform targetPanel = panel.transform;

            if (targetPanel == null)
            {
                return(null);
            }

            if (string.IsNullOrEmpty(targetUINodePath))
            {
                return(targetPanel as RectTransform);
            }

            RectTransform result = targetPanel.Find(targetUINodePath) as RectTransform;

            if (result == null || !result.gameObject.activeSelf)
            {
                return(null);
            }

            return(result);
        }
Example #9
0
 private int PanelCompare(AbstractPanel a, AbstractPanel b)
 {
     return(a.SortIndex - b.SortIndex);
 }
Example #10
0
 private void HideOtherPanels(AbstractPanel curPanel)
 {
     m_UIRoot.NormalRoot.gameObject.SetActive(false);
     m_UIRoot.PopRoot.gameObject.SetActive(false);
 }