Ejemplo n.º 1
0
        public Scoreboard()
        {
            // Load() from file, else provide default scoreboard
            if (Load() == false)
            {
                ScoreboardEntry entry = new ScoreboardEntry
                {
                    name  = "AAA",
                    score = 20,
                    turns = 0
                };
                scoreboard.Add(entry);

                entry = new ScoreboardEntry
                {
                    name  = "BBB",
                    score = 10,
                    turns = 0
                };
                scoreboard.Add(entry);

                entry = new ScoreboardEntry
                {
                    name  = "CCC",
                    score = 5,
                    turns = 0
                };
                scoreboard.Add(entry);
            }
        }
Ejemplo n.º 2
0
        public void Add(Player player)
        {
            ScoreboardEntry entry = new ScoreboardEntry();

            Console.Write("Name: ");
            entry.name  = Console.ReadLine();
            entry.score = player.score;

            for (int i = 0; i < scoreboard.Count; i++)
            {
                if (scoreboard[i].score < entry.score)
                {
                    scoreboard.Insert(i, entry);
                    break;
                }
            }
            scoreboard.RemoveAt(3);
            Save();
        }