Пример #1
0
        private void gameOver()
        {
            EnterNameAndSurname form = new EnterNameAndSurname();

            if (gameType == GAME_TYPE.TIMER_GAME)
            {
                timer.Stop();

                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (seconds == 60)
                    {
                        leaderBoard.checkScoreFor1MinGame(new Player_Time(form.Name, form.Surname, counter));
                    }
                    else if (seconds == 30)
                    {
                        leaderBoard.checkScoreFor30SecGame(new Player_Time(form.Name, form.Surname, counter));
                    }
                }
            }
            else if (gameType == GAME_TYPE.TILES_GAME)
            {
                stopwatch.Stop();
                seconds = Convert.ToInt32(stopwatch.ElapsedMilliseconds) / 1000;

                if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    if (tiles == 100)
                    {
                        leaderBoard.checkScoreFor100TilesGame(new Player_Tiles(form.Name, form.Surname, seconds));
                    }
                    else if (tiles == 300)
                    {
                        leaderBoard.checkScoreFor300TilesGame(new Player_Tiles(form.Name, form.Surname, seconds));
                    }
                }
            }

            String       str    = "Congratulations " + form.Name + " " + form.Surname + " you have completed the game.\nYou hit " + counter + " black tiles for " + seconds + " sec.";
            DialogResult result = MessageBox.Show(str, "GAME OVER", MessageBoxButtons.OK, MessageBoxIcon.Warning);

            if (result == System.Windows.Forms.DialogResult.OK)
            {
                this.Close();
                firstForm.Show();
            }
        }