private void Finish_click(object sender, RoutedEventArgs e)
        {
            if (boatsplaced == 6)
            {
                switch (game.gameMode)
                {
                case GameMode.P_v_P:
                    if (secondplayer)
                    {
                        var place = new Ship_placement(game.players[1], false, game);
                        place.Show();
                    }
                    else
                    {
                        var fire = new Misslefiring(game);
                        fire.Show();
                    }
                    this.Close();
                    break;

                case GameMode.P_v_Ai:
                    var fire_1 = new Misslefiring(game);
                    fire_1.Show();
                    this.Close();
                    break;

                default: MessageBox.Show("Sorry something wemt wrong!"); break;
                }
            }
            else
            {
                MessageBox.Show("Please place all ships first!");
            }
        }
Пример #2
0
        private void Fertig_Click(object sender, RoutedEventArgs e)
        {
            if (gameMode == GameMode.tba)
            {
                MessageBox.Show("Please select a GameMode!");
                return;
            }

            game = new Game(gameMode, Name1.Text, Name2.Text);
            switch (game.gameMode)
            {
            case GameMode.P_v_P:
                apply_difficulty();
                var place = new Ship_placement(game.players[0], true, game);
                place.Show();
                var rules = new Rules();
                rules.Show();
                break;

            case GameMode.P_v_Ai:
                apply_difficulty();
                var place_1 = new Ship_placement(game.players[0], false, game);
                place_1.Show();
                game.players[1].placeships();
                var rules_1 = new Rules();
                rules_1.Show();
                break;

            case GameMode.Ai_v_Ai:
                apply_difficulty();
                game.players[0].placeships();
                game.players[1].placeships();
                var fire = new Misslefiring(game);
                fire.Show();
                break;

            default: MessageBox.Show("Sorry something wemt wrong!"); break;
            }
        }