private void DoHighScore() { if (!highScores.isHighScore(score)) return; dlgHiScore.ShowDialog(); if (dlgHiScore.DialogResult == System.Windows.Forms.DialogResult.Cancel) return; HighScore hs = new HighScore(dlgHiScore.PlayerName, score); highScores.Add(hs); XmlWriter writer = XmlWriter.Create(System.Environment.CurrentDirectory + "\\HighScores.xml"); xmler.Serialize(writer, highScores); writer.Close(); }
public void Add(HighScore score) { if (Scores.Count >= numScores) { Scores.Sort(); Scores.RemoveAt(0); } Scores.Add(score); Scores.Sort(); Scores.Reverse(); }