Пример #1
0
            public AbstractPage GetPage(int uiID)
            {
                PageWrap wrap = FindPageWrap(uiID);

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

                return(wrap.page);
            }
Пример #2
0
            public void LoadPageResAsync(int uiID, Transform parent, bool singleton, Action <AbstractPage> listener)
            {
                UIData data = UIDataTable.Get(uiID);

                if (data == null)
                {
                    Log.e("Failed to load UI, Not Find UIData For:" + uiID);
                    return;
                }

                if (singleton)
                {
                    if (m_PageWrapList == null)
                    {
                        m_PageWrapList = new List <PageWrap>();
                    }

                    PageWrap wrap = FindPageWrap(uiID);

                    if (wrap != null)
                    {
                        wrap.AddListener(listener);
                        return;
                    }
                    else
                    {
                        wrap = new PageWrap(uiID);
                        wrap.AddListener(listener);

                        m_PageWrapList.Add(wrap);
                    }
                }

                if (m_ResLoader == null)
                {
                    m_ResLoader = ResLoader.Allocate("PanelInfo");
                }

                CollectDynamicResource(data, m_ResLoader);

                m_ResLoader.Add2Load(data.fullPath, (state, res) =>
                {
                    if (!state)
                    {
                        return;
                    }

                    OnPageResLoadSuccess(uiID, parent, (GameObject)res.asset, singleton, listener);
                });

                m_ResLoader.LoadSync();
            }
Пример #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);
                    }
                }
            }