Exemplo n.º 1
0
        public void NewGame(string difficulty, New_Game new_game)
        {
            switch (difficulty)
            {
            case "Beginner":
                number_squares_horizontal = beginner_num_squares_horizontal;
                number_squares_vertical   = beginner_num_squares_vertical;
                num_mines = beginner_num_mines;
                break;

            case "Intermediate":
                number_squares_horizontal = intermediate_num_squares_horizontal;
                number_squares_vertical   = intermediate_num_squares_vertical;
                num_mines = intermediate_num_mines;
                break;

            case "Expert":
                number_squares_horizontal = expert_num_squares_horizontal;
                number_squares_vertical   = expert_num_squares_vertical;
                num_mines = expert_num_mines;
                break;

            case "Custom":
                number_squares_horizontal = (int)new_game.board_width_selection.Value;
                number_squares_vertical   = (int)new_game.board_height_selection.Value;
                num_mines = (int)new_game.num_mines_selection.Value;
                break;
            }

            PopulateSquares(number_squares_horizontal, number_squares_vertical);
            DrawGrid(number_squares_horizontal, number_squares_vertical);

            num_mines_left   = num_mines;
            num_squares_left = number_squares_horizontal * number_squares_vertical;
            Update_Status_Bar();

            time_elapsed     = 0;
            timer_label.Text = "Time elapsed: " + time_elapsed + " seconds";
            timer1.Start();
        }
Exemplo n.º 2
0
 private void Start()
 {
     using (New_Game new_game = new New_Game())
     {
         new_game.ShowDialog();
         if (new_game.beginner_button.Checked)
         {
             NewGame("Beginner", new_game);
         }
         if (new_game.intermediate_button.Checked)
         {
             NewGame("Intermediate", new_game);
         }
         if (new_game.expert_button.Checked)
         {
             NewGame("Expert", new_game);
         }
         if (new_game.custom_button.Checked)
         {
             NewGame("Custom", new_game);
         }
     }
 }