コード例 #1
0
        public void AddToTopScoreList(Person person)
        {
            topScoreList.Add(person);
            PersonScoreComparer comparer = new PersonScoreComparer();

            topScoreList.Sort(comparer);
            while (topScoreList.Count > 5)
            {
                topScoreList.RemoveAt(5);
            }
        }
コード例 #2
0
        /// <summary>
        /// Add the new person to the TopScore list
        /// </summary>
        /// <param name="person">New player</param>
        public void AddToTopScoreList(Person person)
        {
            this.topScoreList.Add(person);
            PersonScoreComparer comparer = new PersonScoreComparer();

            this.topScoreList.Sort(comparer);
            while (this.topScoreList.Count > MAX_TOP_SCORE_COUNT)
            {
                this.topScoreList.RemoveAt(MAX_TOP_SCORE_COUNT);
            }
        }
コード例 #3
0
 public bool IsTopScore(Person person)
 {
     if (topScoreList.Count >= MAX_TOP_SCORE_COUNT)
     {
         PersonScoreComparer comparer = new PersonScoreComparer();
         topScoreList.Sort(comparer);
         if (topScoreList[MAX_TOP_SCORE_COUNT - 1] > person)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     return(true);
 }