Esempio n. 1
0
File: Snake.cs Progetto: eogas/snake
        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();
        }
Esempio n. 2
0
File: Snake.cs Progetto: eogas/snake
 public void Add(HighScore score)
 {
     if (Scores.Count >= numScores)
     {
         Scores.Sort();
         Scores.RemoveAt(0);
     }
     Scores.Add(score);
     Scores.Sort();
     Scores.Reverse();
 }