Beispiel #1
0
        private void gameResult()
        {
            int lowest     = score.LowestScore;
            int left       = pgbLife.Value;
            int totalScore = 0;

            if (left > 0)
            {
                totalScore = 10 * left / (hangmanWord.WrongCount + 1);
                switch (level)
                {
                case "Easy":
                    totalScore *= 1;
                    break;

                case "Normal":
                    totalScore *= 2;
                    break;

                case "Hard":
                    totalScore *= 3;
                    break;
                }
            }
            if (totalScore > lowest)
            {
                currentScore = totalScore.ToString();
                PlayerName pl = new PlayerName();
                if ((pl.ShowDialog()) == DialogResult.Yes)
                {
                    score.update(pl.playerName, totalScore);
                    rtb.Text = score.ListofPlayers();
                    tabControl.SelectedTab = tabScore;
                    btnPlay.Enabled        = true;
                }
            }
            else
            {
                startNewGame("Your score is too lower!!");
            }
        }
Beispiel #2
0
        private void gameResult()
        {
            int lowest = score.LowestScore;
            int left = pgbLife.Value;
            int totalScore = 0;
            if (left > 0) {
                totalScore = 10 * left/(hangmanWord.WrongCount+1);
                switch (level) {
                    case "Easy":
                        totalScore *= 1;
                        break;
                    case "Normal":
                        totalScore *= 2;
                        break;

                    case "Hard":
                        totalScore *= 3;
                        break;

                }
            }
            if (totalScore > lowest)
            {
                currentScore = totalScore.ToString();
                PlayerName pl = new PlayerName();
                if ((pl.ShowDialog()) == DialogResult.Yes)
                {
                    score.update(pl.playerName, totalScore);
                    rtb.Text = score.ListofPlayers();
                    tabControl.SelectedTab = tabScore;
                    btnPlay.Enabled = true;
                }

            }
            else {
                startNewGame("Your score is too lower!!");
            }
        }