예제 #1
0
        /// <summary>
        /// creates a list and compaires the scores from one to ten and places the top ten list into the score list.
        /// </summary>
        private void SortList()
        {
            List <HighScoreInfo> sorted = new List <HighScoreInfo>();

            while (scores.Count > 0 && sorted.Count < 10)
            {
                int           highest = GetHighest();
                HighScoreInfo count   = scores[highest];
                sorted.Add(count);
                scores.RemoveAt(highest);
            }
            scores = sorted;
        }
예제 #2
0
        /// <summary>
        /// Inserts a new score into the list of high scores. starts the highscore with team members at highest scores. calls the methode SortList.
        /// </summary>
        /// <param name="Names"></param>
        /// <param name="CaveName"></param>
        /// <param name="Points"></param>
        /// <param name="Arrows"></param>
        /// <param name="Coins"></param>
        public void NewHighscore(string Names, string CaveName, int Points, int Arrows, int Coins)
        {
            HighScoreInfo AddedScore = new HighScoreInfo(Names, CaveName, Points, Arrows, Coins);

            scores.Add(AddedScore);
            if (scores.Count < 1)
            {
                scores.Add(new HighScoreInfo("Chris", "Whiterun", 7, 1, 3));
                scores.Add(new HighScoreInfo("Rowen", "DeapSpaceNine", 5, 1, 3));
                scores.Add(new HighScoreInfo("Shehab", "Tatooine", 9, 1, 3));
                scores.Add(new HighScoreInfo("Ryan", "RivetCity", 4, 1, 3));
                scores.Add(new HighScoreInfo("Cameron", "MiddleEarth", 3, 1, 3));
                scores.Add(new HighScoreInfo("Alexander", "DarkCastle", 2, 1, 3));
            }
            SortList();
        }
예제 #3
0
 /// <summary>
 /// takes information that someone else give to this class and reads it into the class
 /// </summary>
 private void IncomingInfo()
 {
     if (File.Exists(filename))
     {
         scores.Clear();
         StreamReader sr = new StreamReader(filename);
         while (!sr.EndOfStream)
         {
             string        Line = sr.ReadLine();
             HighScoreInfo hs   = HighScoreInfo.Parse(Line);
             this.scores.Add(hs);
         }
         sr.Close();
         SortList();
     }
 }