コード例 #1
0
 private static Type GetBestFallbackType <T>(XmlNode node)
 {
     if (typeof(Thing).IsAssignableFrom(typeof(T)))
     {
         ThingDef thingDef = ScribeExtractor.TryFindDef <ThingDef>(node, "def");
         if (thingDef != null)
         {
             return(thingDef.thingClass);
         }
     }
     else if (typeof(Hediff).IsAssignableFrom(typeof(T)))
     {
         HediffDef hediffDef = ScribeExtractor.TryFindDef <HediffDef>(node, "def");
         if (hediffDef != null)
         {
             return(hediffDef.hediffClass);
         }
     }
     else if (typeof(Thought).IsAssignableFrom(typeof(T)))
     {
         ThoughtDef thoughtDef = ScribeExtractor.TryFindDef <ThoughtDef>(node, "def");
         if (thoughtDef != null)
         {
             return(thoughtDef.thoughtClass);
         }
     }
     return(typeof(T));
 }