示例#1
0
        public string GetName(RaceGenderClass raceGenderClass, int skillId)
        {
            var skill = Get(raceGenderClass, skillId);

            if (skill != null)
            {
                return(skill.Name);
            }
            else
            {
                return(skillId.ToString());
            }
        }
示例#2
0
        public Skill Get(RaceGenderClass raceGenderClass, int skillId)
        {
            var comparer = new ProjectingEqualityComparer <Skill, int>(x => x.Id);

            foreach (var rgc2 in raceGenderClass.Fallbacks())
            {
                if (!_data.ContainsKey(rgc2))
                {
                    continue;
                }

                var searchSkill = new Skill(skillId, raceGenderClass);

                var index = _data[rgc2].BinarySearch(searchSkill, comparer);
                if (index < 0)
                {
                    index = ~index - 1;
                }

                var item = _data[rgc2][index];
                return(item);
            }
            return(null);
        }
示例#3
0
 internal Skill(int id, RaceGenderClass raceGenderClass, string name)
     : this(id, raceGenderClass)
 {
     Name = name;
 }
示例#4
0
 internal Skill(int id, RaceGenderClass raceGenderClass)
 {
     Id = id;
     RaceGenderClass = raceGenderClass;
 }