Example #1
0
 protected void RemoveChildPanel(int uitag, UIPanelParent childUIPanel)
 {
     if (SubPanelDic.ContainsKey(uitag))
     {
         SubPanelDic[uitag].Remove(childUIPanel);
     }
     else
     {
         AFLogger.e("父级面板并不包含此子级面板,请注意");
     }
 }
Example #2
0
 /// <summary>
 /// 释放单个UI面板,根据UITag与obj,一般是给面板的closeself调用
 /// </summary>
 public void CloseUI(int UITag, UIPanelParent panel, int CacheCount = -1, bool destoryCache = false,
                     bool recycleParent = true)
 {
     if (UITagToScriptsName.ContainsKey(UITag))
     {
         CloseUI(UITagToScriptsName[UITag], panel, CacheCount, destoryCache, recycleParent);
     }
     else
     {
         AFLogger.e("当前并不存在 : " + UITag + "面板");
     }
 }
Example #3
0
 protected void AddChildPanel(int uitag, UIPanelParent childUIPanel)
 {
     if (SubPanelDic.ContainsKey(uitag))
     {
         SubPanelDic[uitag].AddValue(childUIPanel);
     }
     else
     {
         List <UIPanelParent> panelList = new List <UIPanelParent>();
         panelList.Add(childUIPanel);
         SubPanelDic.Add(uitag, panelList);
     }
 }
Example #4
0
 public void Open(int UITag, string UIPath, UIDataParent UIDataParent = null, ResFromType resFromType = ResFromType.ABRes,
                  UIPanelParent ParentPanel = null)
 {
     this.UITag       = UITag;
     this.resFromType = resFromType;
     this.ParentPanel = ParentPanel;
     this.UIPath      = UIPath;
     if (!isInit)
     {
         TransformBind();
         InitUI(UIDataParent);
         RegisterUIEvent();
         isInit = true;
     }
     InitUIAll(UIDataParent);
 }
Example #5
0
 protected void CloseUI(string scriptName, UIPanelParent panel, int CacheCount = -1,
                        bool destoryCache = false, bool recycleParent = true)
 {
     //面板销毁 : 因此首先销毁其父物体与子物体
     if (CacheCount == 0)
     {
         panel.RecycleParAndChild();
     }
     resLoader.ReleaseObj(ScriptsNameToPanel[scriptName].gameObject, CacheCount, destoryCache, recycleParent);
     RemoveParentPanel(scriptName);
     UITagToScriptsName.Remove(GetUITagByScriptName(scriptName));
     if (ScriptsNameToPanel.ContainsKey(scriptName))
     {
         ScriptsNameToPanel.Remove(scriptName);
     }
 }
Example #6
0
 public void RecycleParAndChild()
 {
     //从其父类面板中移除
     if (ParentPanel != null)
     {
         ParentPanel.RemoveChildPanel(UITag, this);
         ParentPanel = null;
     }
     //物体被销毁,其内的子物体也一同销毁,防止内存泄漏
     SubPanelDic.ForEach((uitag, panelList) =>
     {
         panelList.ForEach((panel) =>
         {
             //isRemoveFromPar : false不要从父物体中移除,避免引起SubPanelDic的变化
             panel.CloseSelf(0, true, isRemoveFromPar: false);
         });
     });
     Destroy();
 }