Esempio n. 1
0
        protected override void DoDump()
        {
            NewCells("Type", "Guid", "name", "Name", "DispayName1", "DisplayName2", "Description", "Category", "Tags");
            foreach (var e in Data.OfType <BaseDef>())
            {
                if (e == null)
                {
                    continue;
                }
                var type = e.GetType();
                NewRow(type.Name, e.Guid, e.name);

                ViewElementDef v = null;
                if (type.GetField("ViewElementDef") is FieldInfo f)
                {
                    v = f.GetValue(e) as ViewElementDef;
                }
                else if (type.GetProperty("ViewElementDef") is PropertyInfo p)
                {
                    v = p.GetValue(e) as ViewElementDef;
                }
                if (v != null)
                {
                    NewCells(v.Name, v.DisplayName1?.Localize(), v.DisplayName2?.Localize(), v.Description?.Localize(), v.Category?.Localize());
                }

                var tags = (type.GetField("Tags")?.GetValue(e) as IEnumerable)?.OfType <BaseDef>();
                if (tags != null)
                {
                    NewCell(String.Join(", ", tags.Select(tag => tag.name)));
                }
            }
        }
Esempio n. 2
0
        protected KeyValuePair <string, string> Stringify(ViewElementDef view)
        {
            string title = view.DisplayName1.Localize(), desc = view.Description.Localize(), key = view.DisplayName1.LocalizationKey;

            if (desc.Contains("{") && desc.Contains("}") && FindInterpol(view) is IInterpolatableObject ipol)
            {
                desc = view.GetInterpolatedDescription(ipol);
            }
            if (view is MutationViewElementDef mut)  // Mutations
            {
                title = view.DisplayName2.Localize();
                desc  = mut.MutationDescription.Localize();
            }
            else if (key.IndexOf("_PERSONALTRACK_", StringComparison.Ordinal) >= 0 || key.IndexOf("KEY_CLASS_", StringComparison.Ordinal) == 0)        // Class & Skills
            {
                title = ZyMod.TitleCase(title);
            }
            else if (RegexBodyParts.IsMatch(key))    // Armours
            {
                title = view.DisplayName2.Localize();
            }
            return(new KeyValuePair <string, string>(title, desc));
        }
Esempio n. 3
0
 protected override IInterpolatableObject FindInterpol(ViewElementDef view) =>
 Items.First(e => e.ViewElementDef == view)?.Abilities?.OfType <TacticalAbilityDef>().First();
Esempio n. 4
0
 protected virtual IInterpolatableObject FindInterpol(ViewElementDef view) => null;