示例#1
0
 public void ClossAllPanel(bool absClear = false)
 {
     foreach (KeyValuePair <string, BaseUi> kv in m_Panels)
     {
         BaseUi panel = kv.Value;
         BeforeClose(panel, kv.Key);
         panel.gameObject.SetActive(false);
         if (m_LastingPanelNames.Contains(panel.GetName()))
         {
             panel.transform.SetParent(m_RootNodeTsf, false);
             panel.Recycle();
             m_LastingPanel.Add(panel.GetName(), panel);
         }
         else
         {
             panel.Release();
         }
     }
     foreach (BaseUi panel in m_CachePanel.Values)
     {
         panel.gameObject.SetActive(false);
         if (m_LastingPanelNames.Contains(panel.GetName()))
         {
             panel.transform.SetParent(m_RootNodeTsf, false);
             panel.Recycle();
             m_LastingPanel.Add(panel.GetName(), panel);
         }
         else
         {
             panel.Release();
         }
     }
     if (absClear)
     {
         foreach (BaseUi panel in m_LastingPanel.Values)
         {
             panel.gameObject.SetActive(false);
             panel.Release();
         }
         m_LastingPanel.Clear();
         m_LastingPanelNames.Clear();
     }
     m_Panels.Clear();
     m_CachePanel.Clear();
     m_CachePanelNames.Clear();
     m_TopLayer            = 0;
     m_NeedRefreshTopLayer = false;
     m_LayerDic.Clear();
 }
示例#2
0
 private void BeforeClose(BaseUi baseUi, string panelName)
 {
     if (!m_LastingPanelNames.Contains(panelName) && !panelName.Equals(Wndid.HomeUI))
     {
         //Debug.Log(panelName + DateTimeUtil.GetMills(System.DateTime.Now));
         NewbieGuideButton ngb = baseUi.GetComponentInChildren <NewbieGuideButton>();
         //Debug.Log(panelName + (ngb == null));
         if (ngb == null)
         {
             //Debug.Log("close " + baseUi.name);
             Global.gApp.gMsgDispatcher.Broadcast <bool>(MsgIds.HideGameGuideAD, true);
         }
         //Debug.Log(panelName + DateTimeUtil.GetMills(System.DateTime.Now));
     }
 }
示例#3
0
        public void OpenPanelImp <T>(UIInfo uiInfo, string name, T arg)
        {
            string assetName = uiInfo.ResPath;
            BaseUi baseUi    = GetPanel(uiInfo, name);

            if (uiInfo.AddRoot)
            {
                Canvas[] canvas = baseUi.gameObject.GetComponentsInChildren <Canvas>();
                if (canvas.Length > 0)
                {
                    baseUi.transform.SetParent(m_RootNodeTsf, false);
                    foreach (Canvas mCanvas in canvas)
                    {
                        mCanvas.worldCamera = Global.gApp.gUICameraCmpt;
                        //if (uiInfo.Order > 0)
                        {
                            mCanvas.sortingOrder = uiInfo.Order;
                        }
                        GameAdapterUtils.AdaptCanvas(mCanvas);
                    }
                }
                else
                {
                    Transform canvasTsf = CreateCanvas(name, uiInfo.Order);
                    baseUi.transform.SetParent(canvasTsf, false);
                }
            }
            else
            {
                baseUi.transform.SetParent(m_UiCanvasTsf, false);
            }
            baseUi.Init(name, uiInfo, arg);
            //if (name != Wndid.RewardEffectUi)
            //{
            m_Panels.Add(name, baseUi);
            //}
            //if (!m_LastingPanelNames.Contains(name) && !name.Equals(Wndid.HomeUI))
            //{
            //    //Debug.Log(name + DateTimeUtil.GetMills(System.DateTime.Now));
            //    NewbieGuideButton ngb = baseUi.GetComponentInChildren<NewbieGuideButton>();
            //    //Debug.Log(name + (ngb == null));
            //    if (ngb == null)
            //    {
            //        //Debug.Log("open " + baseUi.name);
            //        Global.gApp.gMsgDispatcher.Broadcast<bool>(MsgIds.HideGameGuideAD, false);
            //    }
            //    //Debug.Log(name + DateTimeUtil.GetMills(System.DateTime.Now));
            //}
            if (uiInfo.Layer > 0)
            {
                List <BaseUi> uiList;
                if (!m_LayerDic.TryGetValue(uiInfo.Layer, out uiList))
                {
                    uiList = new List <BaseUi>();
                    m_LayerDic[uiInfo.Layer] = uiList;
                }
                if (!uiList.Contains(baseUi))
                {
                    uiList.Add(baseUi);
                    m_NeedRefreshTopLayer = true;
                }
            }
            Global.gApp.gMsgDispatcher.Broadcast(MsgIds.UIPanelOpen, name);
        }