Example #1
0
        private AbstractPage ProcessAttachPage(int panelID, int uiID, GameObject go)
        {
            if (go == null)
            {
                return(null);
            }

            PanelInfo panelInfo = FindPanelInfoByPanelID(panelID);

            if (panelInfo == null || panelInfo.abstractPanel == null)
            {
                Log.e("AttachPage Failed To Find Panel:" + panelID);
                return(null);
            }

            panelInfo.SetSortingOrderDirty();

            AbstractPage page = go.GetComponent <AbstractPage>();

            if (page == null)
            {
                Log.e("Failed To Find Page In UI:" + uiID);
                go.SetActive(true);
                SetPanelSortingOrderDirty();
                return(null);
            }

            UIData panelData = UIDataTable.Get(uiID);

            if (panelData.panelClassType != null)
            {
                if (page.GetType() != panelData.panelClassType)
                {
                    Log.e("ERROR: Prefab Bind C# Class Is Not Same With Define:" + panelData.name);
                }
            }

            page.parentPage = panelInfo.abstractPanel;

            page.uiID = uiID;

            go.SetActive(true);

            page.OpenPage();

            SetPanelSortingOrderDirty();

            return(page);
        }
        protected void OnDestroy()
        {
            if (Framework.IsApplicationQuit)
            {
                return;
            }

            ClosePage();

            int panelID = GetParentPanelID();

            if (panelID > 0)
            {
                UIMgr.Instance.uiEventSystem.UnRegister(panelID, OnParentPanelEvent);
            }

            BeforDestroy();

            m_ParentPage = null;
        }
Example #3
0
            private void OnPageResLoadSuccess(int uiID, Transform parent, GameObject prefab, bool singleton, Action <AbstractPage> listener)
            {
                if (m_NextMaster < 0)
                {
                    Log.i("PanelInfo Already Close,But Still Call OnPageResLoadSuccess");
                    return;
                }

                if (prefab == null)
                {
                    Log.e(string.Format("Failed to Attach Page!"));
                    return;
                }

                GameObject go = UIMgr.Instance.InstantiateUIPrefab(prefab);

                go.SetActive(false);
                UIMgr.Instance.InitOpenUIParam(go, parent);

                AbstractPage page = UIMgr.Instance.ProcessAttachPage(m_PanelID, uiID, go);

                if (singleton)
                {
                    PageWrap wrap = FindPageWrap(uiID);
                    if (wrap == null)
                    {
                        return;
                    }

                    wrap.page = page;
                }
                else
                {
                    if (listener != null)
                    {
                        listener(page);
                    }
                }
            }