예제 #1
0
 /// <summary>
 /// 清除导航栈内所有数据,通常来说,跳转场景前需要进行这种操作,除非某些GameObject是DontDestroyed,同时需要声明的是,栈内页面的顺序和正确性需要自己维护好
 /// </summary>
 public void ClearNavigationStack()
 {
     if (mNavigationStack != null && mNavigationStack.Count > 0)
     {
         while (mNavigationStack.Count > 0)
         {
             UIBasePanel top = mNavigationStack.Pop();
             top.OnExit();
         }
     }
     mNavigationStack.Clear();
     Resources.UnloadUnusedAssets();
 }
예제 #2
0
 /// <summary>
 /// 关闭栈顶页面,如果允许回退的页面,就不pop出栈
 /// </summary>
 /// <param name="target">当前页面,需要注意的是,页面导航栈需要自行维护好</param>
 public void PopPanel(UIBasePanel target)
 {
     if (target == null && !target.ActiveSelf)
     {
         return;
     }
     if (mNavigationStack != null && mNavigationStack.Count > 0)
     {
         if (CheckIfNeedBack(target))
         {
             target.OnExit();
         }
         else
         {
             mNavigationStack.Pop().OnExit();
         }
     }
     else
     {
         target.OnExit();
     }
 }
예제 #3
0
    /// <summary>
    /// 出栈并移除显示
    /// </summary>
    public void PopPanel()
    {
        if (m_PanelStack.Count <= 0)
        {
            return;
        }
        UIBasePanel topPanel = m_PanelStack.Pop();

        topPanel.OnExit();

        if (m_PanelStack.Count <= 0)
        {
            return;
        }
        topPanel = m_PanelStack.Peek();
        topPanel.OnResume();
    }