Exemple #1
0
        private static void AddLegacyTraits(Dictionary <string, TraitInfo> traits, LegacyTraitColors legacyColors)
        {
            if (!traits.ContainsKey("Pilot"))
            {
                traits.Add("Pilot", new TraitInfo {
                    Name   = "Pilot",
                    Label  = "(P)",
                    Colour = legacyColors.PilotColor
                });
            }
            if (!traits.ContainsKey("Engineer"))
            {
                traits.Add("Engineer", new TraitInfo {
                    Name   = "Engineer",
                    Label  = "(E)",
                    Colour = legacyColors.EngineerColor
                });
            }
            if (!traits.ContainsKey("Scientist"))
            {
                traits.Add("Scientist", new TraitInfo {
                    Name   = "Scientist",
                    Label  = "(S)",
                    Colour = legacyColors.ScientistColor
                });
            }
            if (!traits.ContainsKey("Tourist"))
            {
                traits.Add("Tourist", new TraitInfo {
                    Name   = "Tourist",
                    Label  = "(T)",
                    Colour = legacyColors.TouristColor
                });
            }

            if (!traits.ContainsKey("Unknown"))
            {
                traits.Add("Unknown", new TraitInfo {
                    Name   = "Unknown",
                    Label  = "(?)",
                    Colour = "clear"
                });
            }
        }
Exemple #2
0
        public static Dictionary <string, TraitInfo> Load(ConfigNode node, LegacyTraitColors legacyColors)
        {
            Dictionary <string, TraitInfo> traits = new Dictionary <string, TraitInfo>();

            AddLegacyTraits(traits, legacyColors);

            // load crew traits from file
            string traitsConfigFileName = node.GetString("TRAITDEFINITIONS", "");

            if (!string.IsNullOrEmpty(traitsConfigFileName))
            {
                traits = LoadFile(traits, traitsConfigFileName);
            }

            // allow individual traits to be overwritten
            ConfigNode[] nodes = node.GetNodes("TRAIT");
            traits = LoadNodes(traits, nodes);

            return(traits);
        }