コード例 #1
0
        private void GameOver(string result)
        {
            gameTimer_.Enabled = false;
            string status = "";
            string points = " points!";

            if (result == "Win!")
            {
                level_++;
                catRunningSpeed_++;
                if (level_ == 6)
                {
                    status = "      You're amazing!";
                }
                else if (level_ == 11)
                {
                    status = "      You're a star!";
                }
                else if (level_ == 16)
                {
                    status = "      You're a legend!!";
                }
                MessageBox.Show("You " + result + "     Current points = " + playerScore_ + status);
            }
            else
            {
                MessageBox.Show("You " + result + "     Total score:  " + playerScore_.ToString() + points);
                saveHighScore(playerScore);
                catRunningSpeed_ = 5;
                playerScore_     = 0;
                level_           = 1;
            }

            /*Refresh the picture box and reset all lists and objects to
             * their original empty or null state and load the form*/
            pictureBoxDisplay.Refresh();
            cheeseList_.Clear();
            mouseDen_ = null;
            catBowl_  = null;
            LoadForm();
        }