Beispiel #1
0
        public bool Register(HiScore hi)
        {
            int i = 0;

            while (i < m_Table.Count && m_Table[i].TotalPoints >= hi.TotalPoints)
            {
                ++i;
            }

            if (i > m_MaxEntries)
            {
                return(false);
            }

            m_Table.Insert(i, hi);
            while (m_Table.Count > m_MaxEntries)
            {
                m_Table.RemoveAt(m_Table.Count - 1);
            }
            return(true);
        }
Beispiel #2
0
        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);
        }