public void GameWin() { timer1.Stop(); stopwatch.Stop(); for (int i = 0; i < blocksList.Count; i++) { buttonList[i].Enabled = false; buttonList[i].BackgroundImage = Properties.Resources.smile; } pauseButton.BackgroundImage = Properties.Resources.sunnies; endLabel.Visible = true; endLabel.Text = "you won!"; gameOver = true; if (score < highScore.checkList[9].time)//if player got a high score they can enter their name { form = this.FindForm(); form.Controls.Remove(this); HighScore hs = new HighScore(score, diff); form.Controls.Add(hs); } }
public void loadDB(int diff) { if (diff == 1)//loads the highscores text files { scoresList = File.ReadAllLines("Resources/highScores.txt").ToList(); } if (diff == 2) { scoresList = File.ReadAllLines("Resources/highScoresMed.txt").ToList(); } if (diff == 2) { scoresList = File.ReadAllLines("Resources/highScoresHrd.txt").ToList(); } //firstLabel.Text = scoresList[0]; for (int i = 0; i < scoresList.Count; i += 3) { int place = Convert.ToInt32(scoresList[i]); string name = Convert.ToString(scoresList[i + 1]); int time = Convert.ToInt32(scoresList[i + 2]); HighScore h = new HighScore(place, name, time); highScoreList.Add(h); } }