示例#1
0
    /// <summary>
    /// 显示最顶部的UI面板
    /// </summary>
    public void ShowPanel()
    {
        var UIPanel = PanelStack.Peek();

        if (UIPanel.Panel_Type == PanelType.Subclass)
        {
            if (!PanelStack.Contains(UIPanel))
            {
                PanelStack.Push(UIPanel);
            }
            TakePanelToTop(UIPanel);
        }
    }
示例#2
0
 /// <summary>
 /// 显示UI面板
 /// </summary>
 /// <param name="UIPanel">指定被显示的UI面板</param>
 public void ShowPanel(BaseUIPanel UIPanel)
 {
     if (!UIPanel)
     {
         Debug.LogError("错误!,缓存中找不到该Panel");
         return;
     }
     //PanelStack.Push(UIPanel);
     if (!PanelStack.Contains(UIPanel))
     {
         PanelStack.Push(UIPanel);
     }
     TakePanelToTop(UIPanel);
     //UIPanel.gameObject.SetActive(true);
 }
示例#3
0
    /// <summary>
    /// 显示UI面板
    /// </summary>
    /// <param name="PanelName">UI面板的名称</param>
    public void ShowPanel(string PanelName)
    {
        var UIPanel = GetPanel(PanelName);

        if (!UIPanel)
        {
            CreateUIPanel(PanelName, PanelType.Singleton);
            return;
        }

        if (!PanelStack.Contains(UIPanel))
        {
            PanelStack.Push(UIPanel);
        }
        TakePanelToTop(UIPanel);
        //if (UIPanel) UIPanel.gameObject.SetActive(true);
    }
示例#4
0
        /// <summary>
        /// 推入一个面板并置于新的一层
        /// </summary>
        /// <param name="panelType"></param>
        public void PushPanel(PanelType panelType)
        {
            if (TryGetPanel(panelType, out BasePanel panel))
            {
                //将当前层隐藏,再推入新的一层
                if (PanelStack.Any())
                {
                    foreach (var item in PanelStack.Peek())
                    {
                        item.OnPause();
                    }
                }

                PanelStack.Push(new HashSet <BasePanel> {
                    panel
                });
                panel.OnEnter();
            }
        }
示例#5
0
    /// <summary>
    /// 显示UI面板
    /// </summary>
    /// <param name="PanelName">UI面板的名称</param>
    /// <param name="type">UI面板的类型</param>
    public void ShowPanel(string PanelName, PanelType type)
    {
        switch (type)
        {
        case PanelType.Subclass:
            CreateUIPanel(PanelName, type);
            break;

        default:
            var UIPanel = GetPanel(PanelName) ?? null;
            if (UIPanel == null)
            {
                CreateUIPanel(UIPanel);
            }
            if (!PanelStack.Contains(UIPanel))
            {
                PanelStack.Push(UIPanel);
            }
            TakePanelToTop(UIPanel);
            //UIPanel.gameObject.SetActive(true);
            break;
        }
    }