Exemple #1
0
 public void InsertIfHighScore(HighScoreDataItem score)
 {
     scoresChanged = true;
     if (highScores != null)
     {
         highScores.Add(score);
         highScores.Sort();
         while (highScores.Count >= scoreCount && scoreCount > 0)
         {
             highScores.RemoveAt(highScores.Count - 1);
         }
         Redraw();
     }
 }
Exemple #2
0
        public int CompareTo(object o)
        {
            int result = -1;

            if (o is HighScoreDataItem)
            {
                HighScoreDataItem hs = ((HighScoreDataItem)o);
                result = (hs.score < this.score) ? -1 : (hs.score > this.score) ? 1 : 0;

                if (result == 0)
                {
                    result = (hs.level < this.level) ? -1 : (hs.level > this.level) ? 1 : 0;
                }
            }
            return(result);
        }