Exemplo n.º 1
0
        public bool Register(HiScore hi)
        {
            int index = 0;

            while (index < m_Table.Count && m_Table[index].TotalPoints >= hi.TotalPoints)
            {
                ++index;
            }
            if (index > m_MaxEntries)
            {
                return(false);
            }
            m_Table.Insert(index, hi);
            while (m_Table.Count > m_MaxEntries)
            {
                m_Table.RemoveAt(m_Table.Count - 1);
            }
            return(true);
        }
        public static HiScore FromScoring(string name, Scoring sc, string skillsDescription)
        {
            if (sc == null)
            {
                throw new ArgumentNullException("scoring");
            }

            HiScore hi = new HiScore()
            {
                AchievementPoints = sc.AchievementPoints,
                Death             = sc.DeathReason,
                DifficultyPercent = (int)(100 * sc.DifficultyRating),
                KillPoints        = sc.KillPoints,
                Name              = name,
                PlayingTime       = sc.RealLifePlayingTime,
                SkillsDescription = skillsDescription,
                SurvivalPoints    = sc.SurvivalPoints,
                TotalPoints       = sc.TotalPoints,
                TurnSurvived      = sc.TurnsSurvived
            };

            return(hi);
        }