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