Example #1
0
        private void RegisterAllPanel()
        {
            UIDataTable.SetABMode(true);
            UIDataTable.AddPanelData(UIID.LoadingPanel, "UI/Prefabs/LoadingPanel/LoadingPanel");
            UIDataTable.AddPanelData(UIID.GamingPanel, "UI/Prefabs/GamingPanel/GamingPanel");
            UIDataTable.AddPanelData(UIID.RolePanel, "UI/Prefabs/RolePanel/RolePanel");
            UIDataTable.AddPanelData(UIID.GameOverPanel, "UI/Prefabs/GameOverPanel/GameOverPanel");
            UIDataTable.AddPanelData(UIID.TipPanel, "UI/Prefabs/TipPanel/TipPanel");
            UIDataTable.AddPanelData(UIID.HomePanel, "UI/Prefabs/HomePanel/HomePanel");
            UIDataTable.AddPanelData(UIID.EggPanel, "UI/Prefabs/EggPanel/EggPanel");
            UIDataTable.AddPanelData(UIID.ChestPanel, "UI/Prefabs/ChestPanel/ChestPanel");
            UIDataTable.AddPanelData(UIID.PausePanel, "UI/Prefabs/PausePanel/PausePanel");
            UIDataTable.AddPanelData(UIID.PrisonPanel, "UI/Prefabs/PrisonPanel/PrisonPanel");
            UIDataTable.AddPanelData(UIID.ChestUnlockPanel, "UI/Prefabs/ChestUnlockPanel/ChestUnlockPanel");
            UIDataTable.AddPanelData(UIID.BasePropertyPanel, "UI/Prefabs/BasePropertyPanel/BasePropertyPanel");
            UIDataTable.AddPanelData(UIID.ShopPanel, "UI/Prefabs/ShopPanel/ShopPanel");
            UIDataTable.AddPanelData(UIID.BossFightPanel, "UI/Prefabs/BossFightPanel/BossFightPanel");
            UIDataTable.AddPanelData(UIID.ChestOpenPanel, "UI/Prefabs/ChestOpenPanel/ChestOpenPanel", PanelShowMode.Pop);
            UIDataTable.AddPanelData(UIID.MainPanel, "UI/Prefabs/MainPanel/MainPanel", PanelShowMode.Pop);

            UIDataTable.SetABMode(false);
            UIDataTable.AddPanelData(UIID.MaskPanel, "MaskPanel");
            UIDataTable.AddPanelData(UIID.FloatMessagePanel, "FloatMessagePanel", PanelShowMode.Pop);
            UIDataTable.AddPanelData(UIID.GuideTipPanel, "GuideTipPanel");
            UIDataTable.AddPanelData(UIID.UIClipPanel, "UIClipPanel");
            UIDataTable.AddPanelData(UIID.GuideHandPanel, "GuideHandPanel");
        }
Example #2
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 #3
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 #4
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 #5
0
 public void Init()
 {
     InitUIPath();
     UIDataTable.SetABMode(false);
     RegisterAllPanel();
 }