コード例 #1
0
    private void SetActiveMenu(string menu)
    {
        helpScreen.Hide();
        primaryMenu.Hide();
        loadMenu.Hide();
        optionsMenu.Hide();
        saveMenu.Hide();

        switch (menu)
        {
        case "primary":
            primaryMenu.Show();
            break;

        case "help":
            helpScreen.Show();
            break;

        case "load":
            loadMenu.Show();
            break;

        case "options":
            optionsMenu.OpenFromInGame(GameProperties);
            break;

        case "save":
            saveMenu.Show();
            break;

        default:
            throw new ArgumentException("unknown menu", nameof(menu));
        }
    }
コード例 #2
0
    internal void ToggleHelpScreen()
    {
        GUICommon.Instance.PlayButtonPressSound();

        if (!helpScreen.Visible)
        {
            menu.Hide();
            helpScreen.Show();
            helpScreen.RandomizeEasterEgg();
        }
        else
        {
            helpScreen.Hide();
            menu.Show();
        }
    }
コード例 #3
0
ファイル: MicrobeHUD.cs プロジェクト: rhythms06/Thrive
    public void ToggleHelpScreen()
    {
        GUICommon.Instance.PlayButtonPressSound();

        if (!helpScreen.Visible)
        {
            GetTree().Paused = true;

            menu.Hide();
            helpScreen.Show();
            helpScreen.RandomizeEasterEgg();
        }
        else
        {
            helpScreen.Hide();
            menu.Show();
        }
    }
コード例 #4
0
        //ќбработка нажатий на клавиши
        void KeyboardHandle()
        {
            KeyboardState kbState = Keyboard.GetState();

            interval++;
            if (interval >= 5)
            {
                interval = 0;
                if (menuScreen.Enabled)
                {
                    if (kbState.IsKeyDown(Keys.Up))
                    {
                        currentMenuItem--;
                        if (currentMenuItem < 1)
                        {
                            currentMenuItem = 3;
                        }
                        menuScreen.GetKey(currentMenuItem);
                    }
                    if (kbState.IsKeyDown(Keys.Down))
                    {
                        currentMenuItem++;
                        if (currentMenuItem > 3)
                        {
                            currentMenuItem = 1;
                        }
                        menuScreen.GetKey(currentMenuItem);
                    }
                    if (kbState.IsKeyDown(Keys.Enter))
                    {
                        switch (currentMenuItem)
                        {
                        case 1:
                            menuScreen.Hide();
                            GameState.StartNewGame();
                            gameScreen.Show();
                            break;

                        case 2:
                            menuScreen.Hide();
                            helpScreen.Show();
                            break;

                        case 3:
                            Exit();
                            break;
                        }
                    }
                }
                if (gamePauseScreen.Enabled)
                {
                    if (kbState.IsKeyDown(Keys.Up))
                    {
                        currentMenuItem--;
                        if (currentMenuItem < 1)
                        {
                            currentMenuItem = 2;
                        }
                        gamePauseScreen.GetKey(currentMenuItem);
                    }
                    if (kbState.IsKeyDown(Keys.Down))
                    {
                        currentMenuItem++;
                        if (currentMenuItem > 2)
                        {
                            currentMenuItem = 1;
                        }
                        gamePauseScreen.GetKey(currentMenuItem);
                    }
                    if (kbState.IsKeyDown(Keys.Enter))
                    {
                        switch (currentMenuItem)
                        {
                        case 1:
                            GameState.IsPaused = false;
                            gamePauseScreen.Hide();
                            break;

                        case 2:
                            GameState.IsPaused = false;
                            gamePauseScreen.Hide();
                            gameScreen.Hide();
                            menuScreen.Show();
                            currentMenuItem = 1;
                            break;
                        }
                    }
                }
                if (gameRestartScreen.Enabled)
                {
                    GameState.ShowMenu = false;
                    if (kbState.IsKeyDown(Keys.Up))
                    {
                        currentMenuItem--;
                        if (currentMenuItem < 1)
                        {
                            currentMenuItem = 2;
                        }
                        gameRestartScreen.GetKey(currentMenuItem);
                    }
                    if (kbState.IsKeyDown(Keys.Down))
                    {
                        currentMenuItem++;
                        if (currentMenuItem > 2)
                        {
                            currentMenuItem = 1;
                        }
                        gameRestartScreen.GetKey(currentMenuItem);
                    }
                    if (kbState.IsKeyDown(Keys.Enter))
                    {
                        switch (currentMenuItem)
                        {
                        case 1:
                            GameState.IsPaused = false;
                            gameRestartScreen.Hide();
                            GameState.StartNewGame();
                            break;

                        case 2:
                            GameState.IsPaused = false;
                            gameRestartScreen.Hide();
                            gameScreen.Hide();
                            menuScreen.Show();
                            currentMenuItem = 1;
                            break;
                        }
                    }
                }
            }
            if (helpScreen.Enabled)
            {
                if (kbState.IsKeyDown(Keys.Escape))
                {
                    helpScreen.Hide();
                    menuScreen.Show();
                }
            }
            if (gameScreen.Enabled)
            {
                if (kbState.IsKeyDown(Keys.Escape))
                {
                    GameState.IsPaused = true;
                    gamePauseScreen.Show();
                    currentMenuItem = 1;
                }
                if (GameState.ShowMenu)
                {
                    GameState.IsPaused = true;
                    gameRestartScreen.Show();
                    currentMenuItem = 1;
                }
            }
        }
コード例 #5
0
    public void Start()
    {
        //TO DO
        Hardware           hardware     = new Hardware(SCREEN_WIDTH, SCREEN_HEIGHT, 24, false);
        IntroScreen        intro        = new IntroScreen(hardware);
        GameScreen         game         = new GameScreen(hardware);
        CreditsScreen      credits      = new CreditsScreen(hardware);
        PlayerSelectScreen playerSelect = new PlayerSelectScreen(hardware);
        ScoreBoardScreen   scoreBoard;
        MainMenuScreen     mainMenu      = new MainMenuScreen(hardware);
        HelpScreen         helpScreen    = new HelpScreen(hardware);
        OptionsScreen      optionsScreen = new OptionsScreen(hardware);

        intro.Show();

        HordeModeScreen hordeMode;

        do
        {
            mainMenu.Show();
            if (!mainMenu.GetExit())
            {
                switch (mainMenu.GetChosenOption())
                {
                case 1:
                    playerSelect.Show();
                    game = new GameScreen(hardware);
                    game.ChosenPlayer = playerSelect.ChosenPlayer();
                    game.Show();
                    break;

                case 2:
                    if (lastGame != 0)
                    {
                        if (lastGame == 1)
                        {
                            playerSelect.Show();
                            game = new GameScreen(hardware);
                            game.ChosenPlayer = playerSelect.ChosenPlayer();
                            game.Show();
                        }
                        else
                        {
                            playerSelect.Show();
                            hordeMode = new HordeModeScreen(hardware);
                            hordeMode.ChosenPlayer = playerSelect.ChosenPlayer();
                            hordeMode.Show();
                        }
                    }
                    break;

                case 3:
                    playerSelect.Show();
                    hordeMode = new HordeModeScreen(hardware);
                    hordeMode.ChosenPlayer = playerSelect.ChosenPlayer();
                    hordeMode.Show();
                    break;

                case 4:
                    scoreBoard = new ScoreBoardScreen(hardware);
                    scoreBoard.Show();
                    break;

                case 5:
                    helpScreen.Show();
                    break;

                case 6:
                    optionsScreen.Show();
                    break;

                case 7:
                    credits.Show();
                    break;

                default:
                    break;
                }
            }
        } while (!mainMenu.GetExit());
    }