Exemple #1
0
    public void ChangeMenu(GameMenu gameMenu, MenuParams parms) //切换场景
    {
        MenuInfo currentMenu = GetCurrentMenu();                //得到当前的场景

        if (gameMenu == currentMenu.menu)                       //如果就是切换到当前的场景那么就把当前的场景激活
        {
            if (parms != null)
            {
                currentMenu.SetParm(parms);  //重新的设置参数
                currentMenu.SetActive(true); //激活
                currentMenu.Init();          //初始化
            }
            else
            {
                currentMenu.UpdateMenu(); //跟新状态
            }
            ChangeBG(currentMenu);        //切换背景
            return;
        }

        if (currentMenu != null)
        {
            if (parms.bAdditive == false)
            {
                if (parms.bStack == false) //表示上面三种长存的界面是长存在栈中的
                {
                    PopMenu();
                    RemoveMenu(currentMenu);
                }
                else
                {
                    currentMenu.Uninit(false, false);
                    currentMenu.SetActive(false);
                }
            }
        }

        switch (gameMenu)
        {
        case GameMenu.Dungeon:
        case GameMenu.DungeonInfo:
            m_MenuStack.RemoveAll(e => e.menu == gameMenu);
            break;
        }

        MenuInfo newMenu = LoadMenu(gameMenu, parms);

        newMenu.IsBack = false;

        StackMenu(newMenu);
        ChangeBG(newMenu);
        if (m_TopFrame != null)
        {
            m_TopFrame.Init();//会在这里面来判断该显示top操作界面上面的东西
        }
    }