Exemple #1
0
        /// <summary>
        /// Parse a set of color sources, using fields on this module (if available) or globally
        /// configured values (if not).
        /// </summary>
        /// <returns></returns>
        private Dictionary <string, IColorSource> ParseColorSources()
        {
            Dictionary <string, IColorSource> sources = new Dictionary <string, IColorSource>();

            if (!string.IsNullOrEmpty(pilotColor))
            {
                sources.Add(Kerbals.PilotClass, ColorSources.Find(this, pilotColor));
            }
            if (!string.IsNullOrEmpty(engineerColor))
            {
                sources.Add(Kerbals.EngineerClass, ColorSources.Find(this, engineerColor));
            }
            if (!string.IsNullOrEmpty(scientistColor))
            {
                sources.Add(Kerbals.ScientistClass, ColorSources.Find(this, scientistColor));
            }
            if (!string.IsNullOrEmpty(touristColor))
            {
                sources.Add(Kerbals.TouristClass, ColorSources.Find(this, touristColor));
            }
            if (!string.IsNullOrEmpty(otherColor))
            {
                sources.Add(KERBAL_CLASS_UNKNOWN, ColorSources.Find(this, otherColor));
            }
            foreach (KeyValuePair <string, string> pair in _kerbalClassColorDefaults)
            {
                if (sources.ContainsKey(pair.Key))
                {
                    continue;
                }
                sources.Add(pair.Key, ColorSources.Find(this, pair.Value));
            }
            return(sources);
        }
 /// <summary>
 /// Find the specified color source.
 /// </summary>
 /// <param name="sourceID"></param>
 /// <returns></returns>
 protected IColorSource FindColorSource(string sourceID)
 {
     return(ColorSources.Find(this, sourceID));
 }