Ejemplo n.º 1
0
    /// <summary>
    /// 上电视
    /// </summary>
    /// <param name="message"></param>
    //public static void ShowTv(string message)
    //{
    //    PanelTv.AddMsg(message);

    //    var panelName = typeof(PanelTv).Name;
    //    if (!m_panelDic.ContainsKey(panelName))
    //    {
    //        m_panelDic.Add(panelName, new PanelTv());
    //        m_panelLoopList.Add(m_panelDic[panelName]);
    //    }

    //    if (m_panelDic[panelName].IsOpen())
    //        return;

    //    if (m_tvPanel != null)
    //        m_tvPanel.HidePanel();
    //    m_tvPanel = m_panelDic[panelName];

    //    m_tvPanel.ShowPanel(m_tvLayer);
    //}

    /// <summary>
    /// 上喇叭
    /// </summary>
    /// <param name="record"></param>
    //public static void ShowLaba(ChatRecord record)
    //{
    //    PanelLaba.AddMsg(record);

    //    var panelName = typeof(PanelLaba).Name;
    //    if (!m_panelDic.ContainsKey(panelName))
    //    {
    //        m_panelDic.Add(panelName, new PanelLaba());
    //        m_panelLoopList.Add(m_panelDic[panelName]);
    //    }

    //    if (m_panelDic[panelName].IsOpen())
    //        return;

    //    if (m_labaPanel != null)
    //        m_labaPanel.HidePanel();
    //    m_labaPanel = m_panelDic[panelName];

    //    m_labaPanel.ShowPanel(m_labaLayer);
    //}

    /// <summary>
    /// 执行返回
    /// </summary>
    public static void BackPanel(object[] newParams = null)
    {
        if (m_contentPanel == null)
        {
            return;
        }

        if (m_layerNameStack.Count <= 0 || m_layerNameStack.Peek() != m_contentPanel.GetType().Name)
        {
            return;
        }

        PopStack();

        m_contentPanel.HidePanel();

        string prePanel = m_layerNameStack.Peek();

        object[] @params = newParams == null?m_layerParamsStack.Peek() : newParams;

        if (!m_panelDic.ContainsKey(prePanel))
        {
            Debug.LogError("can not find panel: " + prePanel);
            return;
        }

        m_contentPanel = m_panelDic[prePanel];
        m_contentPanel.SetActive(true);
        m_contentPanel.SetBackParams(@params);
        m_contentPanel.OnBack();
    }
Ejemplo n.º 2
0
        public static void DealPanel(BasePanel panel)
        {
            var type = FindPanel(panel.GetType());

            if (type != null)
            {
                RemovePanel(type);
                return;
            }

            AddPanel(panel);
        }
Ejemplo n.º 3
0
        public static void DealPanel(BasePanel panel)
        {
            var type = FindPanel(panel.GetType());

            if (type != null)
            {
                RemovePanel(type);
                return;
            }

            SoundManager.Play("System", "OpenForm.mp3");
            AddPanel(panel);
        }
Ejemplo n.º 4
0
    public void PopPanelIntro()
    {
        if (panelStack == null)
        {
            panelStack = new Stack <BasePanel>();
        }

        if (panelStack.Count <= 0)
        {
            return;
        }
        BasePanel temp = panelStack.Peek();

        if (temp.GetType() == typeof(IntroducePanel))
        {
            PopPanel();
        }
    }
Ejemplo n.º 5
0
    public static void PopPanel()
    {
        if (panelStack.Count <= 0)
        {
            return;
        }

        //关闭当前界面
        BasePanel toppanel = panelStack.Pop();
        string    name     = toppanel.GetType().ToString();

        Close(name);

        Debug.Log("stack count: " + panelStack.Count);
        //恢复上一个界面
        if (panelStack.Count > 0)
        {
            BasePanel panel = panelStack.Peek();
            panel.OnResume();
        }
    }
Ejemplo n.º 6
0
        public static void RemovePanel(BasePanel panel)
        {
            var type = FindPanel(panel.GetType());

            if (type == null)
            {
                return;
            }

            if (panel.IsChangeBgm)
            {
                SoundManager.PlayLastBGM();
            }
            if (panel.NeedBlackForm)
            {
                BlackWallForm.Instance.OnRemove();
                MainForm.Instance.RemovePanelAct(BlackWallForm.Instance);
            }
            panel.OnRemove();
            MainForm.Instance.RemovePanelAct(panel);
            panelList.Remove(panel);
            PanelCount--;
        }