예제 #1
0
파일: UIManager.cs 프로젝트: zs9024/Jungle
    /// <summary>
    /// 在pop层弹出窗口并置顶,该层需要自己维护显示隐藏
    /// </summary>
    /// <typeparam name="T"></typeparam>
    /// <param name="params"></param>
    /// <param name="addMask"></param>
    /// <param name="parentPanel"></param>
    public static T PopPanel <T>(object[] @params = null, bool addMask = false, BasePanel parentPanel = null, LayerType layer = LayerType.POP) where T : BasePanel, new()
    {
        var panelName = typeof(T).Name;

        if (!m_panelDic.ContainsKey(panelName))
        {
            m_panelDic.Add(panelName, new T());
            m_panelLoopList.Add(m_panelDic[panelName]);
        }

        var popPanel = m_panelDic[panelName];

        popPanel.SetParams(@params);
        popPanel.ShowPanel(m_popLayer, addMask);
        popPanel.LayerType = LayerType.POP;
        if (parentPanel != null)
        {
            parentPanel.AddChildPanel(popPanel);
            popPanel.SetParent(parentPanel);
        }

        return(popPanel as T);
    }