Esempio n. 1
0
        public Dwarf(dfproto.BasicUnitInfo unit)
        {
            m_unit = unit;
            m_labors = new HashSet<DwarfLabor>(unit.LaborsList.Select(id => GameData.GetLabor(id)));
            m_skills = unit.SkillsList.ToDictionary(s => GameData.GetSkill(s.Id));
            m_profession = new Lazy<DwarfProfession>(() => GameData.GetProfession(m_unit.Profession));

            m_unskilled_count = m_labors.Count(l => !l.HasSkill);

            // look for the migrant counter to identify new migrants
            var migrant_counter_trait = unit.MiscTraitsList.FirstOrDefault(t => t.Id == MISC_TRAIT_MIGRANT_COUNTER);
            if (migrant_counter_trait != null)
                m_migrant_counter = migrant_counter_trait.Value;

            m_labors_view = m_labors.Where(l => l.HasSkill).Select(l => new DwarfListItem(
                l.Skill.Profession.Image,
                this,
                l)).ToList();
            m_labors_potential_view = m_skills.Where(p => p.Key.HasLabor && !m_labors.Contains(p.Key.Labor)).Select(p => new DwarfListItem(
                p.Key.Profession.Image,
                this,
                p.Key.Labor)).ToList();
        }
 public static string FormatName(dfproto.NameInfo name)
 {
     return string.Format("{0} {1}", name.FirstName, name.LastName);
 }
Esempio n. 3
0
        public void decode(dfproto.CoreTextNotification data)
        {
            int cnt = data.fragments.Count;

            if (cnt > 0)
            {
                target.begin_batch();

                for (int i = 0; i < cnt; i++)
                {
                    var frag = data.fragments[i];

                    //color_value color = frag.has_color() ? color_value(frag.color()) : COLOR_RESET;
                    target.add_text(color_value.COLOR_RESET, frag.text);
                    //target.printerr(data.fragments[i].text);
                }

                target.end_batch();
            }
        }