示例#1
0
 public virtual void ExposeData()
 {
     if (Scribe.mode == LoadSaveMode.Saving && combatLogEntry != null)
     {
         LogEntry target = combatLogEntry.Target;
         if (target == null || !Current.Game.battleLog.IsEntryActive(target))
         {
             combatLogEntry = null;
         }
     }
     Scribe_Values.Look(ref loadID, "loadID", 0);
     Scribe_Defs.Look(ref def, "def");
     Scribe_Values.Look(ref ageTicks, "ageTicks", 0);
     Scribe_Defs.Look(ref source, "source");
     Scribe_Defs.Look(ref sourceBodyPartGroup, "sourceBodyPartGroup");
     Scribe_Defs.Look(ref sourceHediffDef, "sourceHediffDef");
     Scribe_BodyParts.Look(ref part, "part");
     Scribe_Values.Look(ref severityInt, "severity", 0f);
     Scribe_Values.Look(ref recordedTale, "recordedTale", defaultValue: false);
     Scribe_Values.Look(ref causesNoPain, "causesNoPain", defaultValue: false);
     Scribe_Values.Look(ref visible, "visible", defaultValue: false);
     Scribe_References.Look(ref combatLogEntry, "combatLogEntry");
     Scribe_Values.Look(ref combatLogText, "combatLogText");
     BackCompatibility.PostExposeData(this);
 }
示例#2
0
 public virtual void ExposeData()
 {
     if (Scribe.mode == LoadSaveMode.Saving && this.combatLogEntry != null)
     {
         LogEntry target = this.combatLogEntry.Target;
         if (!Current.Game.battleLog.IsEntryActive(target))
         {
             this.combatLogEntry = null;
         }
     }
     Scribe_Values.Look <int>(ref this.loadID, "loadID", 0, false);
     Scribe_Defs.Look <HediffDef>(ref this.def, "def");
     Scribe_Values.Look <int>(ref this.ageTicks, "ageTicks", 0, false);
     Scribe_Defs.Look <ThingDef>(ref this.source, "source");
     Scribe_Defs.Look <BodyPartGroupDef>(ref this.sourceBodyPartGroup, "sourceBodyPartGroup");
     Scribe_Defs.Look <HediffDef>(ref this.sourceHediffDef, "sourceHediffDef");
     Scribe_BodyParts.Look(ref this.part, "part", null);
     Scribe_Values.Look <float>(ref this.severityInt, "severity", 0f, false);
     Scribe_Values.Look <bool>(ref this.recordedTale, "recordedTale", false, false);
     Scribe_Values.Look <bool>(ref this.causesNoPain, "causesNoPain", false, false);
     Scribe_Values.Look <bool>(ref this.visible, "visible", false, false);
     Scribe_References.Look <LogEntry>(ref this.combatLogEntry, "combatLogEntry", false);
     Scribe_Values.Look <string>(ref this.combatLogText, "combatLogText", null, false);
     if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         BackCompatibility.HediffLoadingVars(this);
     }
     if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
     {
         BackCompatibility.HediffResolvingCrossRefs(this);
     }
 }
示例#3
0
 public override void ExposeData()
 {
     base.ExposeData();
     Scribe_Defs.Look(ref transitionDef, "transitionDef");
     Scribe_References.Look(ref subjectPawn, "subjectPawn", saveDestroyedThings: true);
     Scribe_Defs.Look(ref subjectThing, "subjectThing");
     Scribe_References.Look(ref initiator, "initiator", saveDestroyedThings: true);
     Scribe_Defs.Look(ref culpritHediffDef, "culpritHediffDef");
     Scribe_BodyParts.Look(ref culpritHediffTargetPart, "culpritHediffTargetPart");
     Scribe_BodyParts.Look(ref culpritTargetPart, "culpritTargetPart");
 }
 public override void ExposeData()
 {
     base.ExposeData();
     Scribe_Defs.Look <RulePackDef>(ref this.transitionDef, "transitionDef");
     Scribe_References.Look <Pawn>(ref this.subjectPawn, "subjectPawn", true);
     Scribe_Defs.Look <ThingDef>(ref this.subjectThing, "subjectThing");
     Scribe_References.Look <Pawn>(ref this.initiator, "initiator", true);
     Scribe_Defs.Look <HediffDef>(ref this.culpritHediffDef, "culpritHediffDef");
     Scribe_BodyParts.Look(ref this.culpritHediffTargetPart, "culpritHediffTargetPart", null);
     Scribe_BodyParts.Look(ref this.culpritTargetPart, "culpritTargetPart", null);
 }
示例#5
0
        private static void LookInternalMisc <T>(ref T obj, string label, LookMode lookMode)
        {
            switch (lookMode)
            {
            case LookMode.Value:
                Scribe_Values.Look(ref obj, label);
                break;

            case LookMode.Deep:
                Scribe_Deep.Look(ref obj, label);
                break;

            case LookMode.LocalTargetInfo:
            {
                LocalTargetInfo value3 = (LocalTargetInfo)(object)obj;
                Scribe_TargetInfo.Look(ref value3, label);
                obj = (T)(object)value3;
                break;
            }

            case LookMode.TargetInfo:
            {
                TargetInfo value2 = (TargetInfo)(object)obj;
                Scribe_TargetInfo.Look(ref value2, label);
                obj = (T)(object)value2;
                break;
            }

            case LookMode.GlobalTargetInfo:
            {
                GlobalTargetInfo value = (GlobalTargetInfo)(object)obj;
                Scribe_TargetInfo.Look(ref value, label);
                obj = (T)(object)value;
                break;
            }

            case LookMode.BodyPart:
            {
                BodyPartRecord part = (BodyPartRecord)(object)obj;
                Scribe_BodyParts.Look(ref part, label);
                obj = (T)(object)part;
                break;
            }

            case LookMode.Reference:
            case LookMode.Def:
                break;
            }
        }
示例#6
0
 public static void Look <T>(ref List <T> list, bool saveDestroyedThings, string label, LookMode lookMode = LookMode.Undefined, params object[] ctorArgs)
 {
     if (lookMode == LookMode.Undefined)
     {
         if (ParseHelper.HandlesType(typeof(T)))
         {
             lookMode = LookMode.Value;
         }
         else if (typeof(T) == typeof(LocalTargetInfo))
         {
             lookMode = LookMode.LocalTargetInfo;
         }
         else if (typeof(T) == typeof(TargetInfo))
         {
             lookMode = LookMode.TargetInfo;
         }
         else if (typeof(T) == typeof(GlobalTargetInfo))
         {
             lookMode = LookMode.GlobalTargetInfo;
         }
         else if (typeof(Def).IsAssignableFrom(typeof(T)))
         {
             lookMode = LookMode.Def;
         }
         else if (typeof(T) == typeof(BodyPartRecord))
         {
             lookMode = LookMode.BodyPart;
         }
         else
         {
             if (!typeof(IExposable).IsAssignableFrom(typeof(T)) || typeof(ILoadReferenceable).IsAssignableFrom(typeof(T)))
             {
                 Log.Error("LookList call with a list of " + typeof(T) + " must have lookMode set explicitly.", false);
                 return;
             }
             lookMode = LookMode.Deep;
         }
     }
     if (Scribe.EnterNode(label))
     {
         try
         {
             if (Scribe.mode == LoadSaveMode.Saving)
             {
                 if (list == null)
                 {
                     Scribe.saver.WriteAttribute("IsNull", "True");
                 }
                 else
                 {
                     foreach (T current in list)
                     {
                         if (lookMode == LookMode.Value)
                         {
                             T t = current;
                             Scribe_Values.Look <T>(ref t, "li", default(T), true);
                         }
                         else if (lookMode == LookMode.LocalTargetInfo)
                         {
                             LocalTargetInfo localTargetInfo = (LocalTargetInfo)((object)current);
                             Scribe_TargetInfo.Look(ref localTargetInfo, saveDestroyedThings, "li");
                         }
                         else if (lookMode == LookMode.TargetInfo)
                         {
                             TargetInfo targetInfo = (TargetInfo)((object)current);
                             Scribe_TargetInfo.Look(ref targetInfo, saveDestroyedThings, "li");
                         }
                         else if (lookMode == LookMode.GlobalTargetInfo)
                         {
                             GlobalTargetInfo globalTargetInfo = (GlobalTargetInfo)((object)current);
                             Scribe_TargetInfo.Look(ref globalTargetInfo, saveDestroyedThings, "li");
                         }
                         else if (lookMode == LookMode.Def)
                         {
                             Def def = (Def)((object)current);
                             Scribe_Defs.Look <Def>(ref def, "li");
                         }
                         else if (lookMode == LookMode.BodyPart)
                         {
                             BodyPartRecord bodyPartRecord = (BodyPartRecord)((object)current);
                             Scribe_BodyParts.Look(ref bodyPartRecord, "li", null);
                         }
                         else if (lookMode == LookMode.Deep)
                         {
                             T t2 = current;
                             Scribe_Deep.Look <T>(ref t2, saveDestroyedThings, "li", ctorArgs);
                         }
                         else if (lookMode == LookMode.Reference)
                         {
                             ILoadReferenceable loadReferenceable = (ILoadReferenceable)((object)current);
                             Scribe_References.Look <ILoadReferenceable>(ref loadReferenceable, "li", saveDestroyedThings);
                         }
                     }
                 }
             }
             else if (Scribe.mode == LoadSaveMode.LoadingVars)
             {
                 XmlNode      curXmlParent = Scribe.loader.curXmlParent;
                 XmlAttribute xmlAttribute = curXmlParent.Attributes["IsNull"];
                 if (xmlAttribute != null && xmlAttribute.Value.ToLower() == "true")
                 {
                     list = null;
                 }
                 else if (lookMode == LookMode.Value)
                 {
                     list = new List <T>(curXmlParent.ChildNodes.Count);
                     foreach (XmlNode subNode in curXmlParent.ChildNodes)
                     {
                         T item = ScribeExtractor.ValueFromNode <T>(subNode, default(T));
                         list.Add(item);
                     }
                 }
                 else if (lookMode == LookMode.Deep)
                 {
                     list = new List <T>(curXmlParent.ChildNodes.Count);
                     foreach (XmlNode subNode2 in curXmlParent.ChildNodes)
                     {
                         T item2 = ScribeExtractor.SaveableFromNode <T>(subNode2, ctorArgs);
                         list.Add(item2);
                     }
                 }
                 else if (lookMode == LookMode.Def)
                 {
                     list = new List <T>(curXmlParent.ChildNodes.Count);
                     foreach (XmlNode subNode3 in curXmlParent.ChildNodes)
                     {
                         T item3 = ScribeExtractor.DefFromNodeUnsafe <T>(subNode3);
                         list.Add(item3);
                     }
                 }
                 else if (lookMode == LookMode.BodyPart)
                 {
                     list = new List <T>(curXmlParent.ChildNodes.Count);
                     int num = 0;
                     foreach (XmlNode node in curXmlParent.ChildNodes)
                     {
                         T item4 = (T)((object)ScribeExtractor.BodyPartFromNode(node, num.ToString(), null));
                         list.Add(item4);
                         num++;
                     }
                 }
                 else if (lookMode == LookMode.LocalTargetInfo)
                 {
                     list = new List <T>(curXmlParent.ChildNodes.Count);
                     int num2 = 0;
                     foreach (XmlNode node2 in curXmlParent.ChildNodes)
                     {
                         LocalTargetInfo localTargetInfo2 = ScribeExtractor.LocalTargetInfoFromNode(node2, num2.ToString(), LocalTargetInfo.Invalid);
                         T item5 = (T)((object)localTargetInfo2);
                         list.Add(item5);
                         num2++;
                     }
                 }
                 else if (lookMode == LookMode.TargetInfo)
                 {
                     list = new List <T>(curXmlParent.ChildNodes.Count);
                     int num3 = 0;
                     foreach (XmlNode node3 in curXmlParent.ChildNodes)
                     {
                         TargetInfo targetInfo2 = ScribeExtractor.TargetInfoFromNode(node3, num3.ToString(), TargetInfo.Invalid);
                         T          item6       = (T)((object)targetInfo2);
                         list.Add(item6);
                         num3++;
                     }
                 }
                 else if (lookMode == LookMode.GlobalTargetInfo)
                 {
                     list = new List <T>(curXmlParent.ChildNodes.Count);
                     int num4 = 0;
                     foreach (XmlNode node4 in curXmlParent.ChildNodes)
                     {
                         GlobalTargetInfo globalTargetInfo2 = ScribeExtractor.GlobalTargetInfoFromNode(node4, num4.ToString(), GlobalTargetInfo.Invalid);
                         T item7 = (T)((object)globalTargetInfo2);
                         list.Add(item7);
                         num4++;
                     }
                 }
                 else if (lookMode == LookMode.Reference)
                 {
                     List <string> list2 = new List <string>(curXmlParent.ChildNodes.Count);
                     foreach (XmlNode xmlNode in curXmlParent.ChildNodes)
                     {
                         list2.Add(xmlNode.InnerText);
                     }
                     Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(list2, string.Empty);
                 }
             }
             else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
             {
                 if (lookMode == LookMode.Reference)
                 {
                     list = Scribe.loader.crossRefs.TakeResolvedRefList <T>(string.Empty);
                 }
                 else if (lookMode == LookMode.LocalTargetInfo)
                 {
                     if (list != null)
                     {
                         for (int i = 0; i < list.Count; i++)
                         {
                             list[i] = (T)((object)ScribeExtractor.ResolveLocalTargetInfo((LocalTargetInfo)((object)list[i]), i.ToString()));
                         }
                     }
                 }
                 else if (lookMode == LookMode.TargetInfo)
                 {
                     if (list != null)
                     {
                         for (int j = 0; j < list.Count; j++)
                         {
                             list[j] = (T)((object)ScribeExtractor.ResolveTargetInfo((TargetInfo)((object)list[j]), j.ToString()));
                         }
                     }
                 }
                 else if (lookMode == LookMode.GlobalTargetInfo && list != null)
                 {
                     for (int k = 0; k < list.Count; k++)
                     {
                         list[k] = (T)((object)ScribeExtractor.ResolveGlobalTargetInfo((GlobalTargetInfo)((object)list[k]), k.ToString()));
                     }
                 }
             }
         }
         finally
         {
             Scribe.ExitNode();
         }
     }
     else if (Scribe.mode == LoadSaveMode.LoadingVars)
     {
         if (lookMode == LookMode.Reference)
         {
             Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(null, label);
         }
         list = null;
     }
 }
示例#7
0
        public static void Look <T>(ref List <T> list, bool saveDestroyedThings, string label, LookMode lookMode = LookMode.Undefined, params object[] ctorArgs)
        {
            if (lookMode == LookMode.Undefined && !Scribe_Universal.TryResolveLookMode(typeof(T), out lookMode))
            {
                Log.Error("LookList call with a list of " + typeof(T) + " must have lookMode set explicitly.");
            }
            else if (Scribe.EnterNode(label))
            {
                try
                {
                    if (Scribe.mode == LoadSaveMode.Saving)
                    {
                        if (list == null)
                        {
                            Scribe.saver.WriteAttribute("IsNull", "True");
                        }
                        else
                        {
                            foreach (T item8 in list)
                            {
                                switch (lookMode)
                                {
                                case LookMode.Value:
                                {
                                    T value5 = item8;
                                    Scribe_Values.Look(ref value5, "li", default(T), forceSave: true);
                                    break;
                                }

                                case LookMode.LocalTargetInfo:
                                {
                                    LocalTargetInfo value4 = (LocalTargetInfo)(object)item8;
                                    Scribe_TargetInfo.Look(ref value4, saveDestroyedThings, "li");
                                    break;
                                }

                                case LookMode.TargetInfo:
                                {
                                    TargetInfo value3 = (TargetInfo)(object)item8;
                                    Scribe_TargetInfo.Look(ref value3, saveDestroyedThings, "li");
                                    break;
                                }

                                case LookMode.GlobalTargetInfo:
                                {
                                    GlobalTargetInfo value2 = (GlobalTargetInfo)(object)item8;
                                    Scribe_TargetInfo.Look(ref value2, saveDestroyedThings, "li");
                                    break;
                                }

                                case LookMode.Def:
                                {
                                    Def value = (Def)(object)item8;
                                    Scribe_Defs.Look(ref value, "li");
                                    break;
                                }

                                case LookMode.BodyPart:
                                {
                                    BodyPartRecord part = (BodyPartRecord)(object)item8;
                                    Scribe_BodyParts.Look(ref part, "li");
                                    break;
                                }

                                case LookMode.Deep:
                                {
                                    T target = item8;
                                    Scribe_Deep.Look(ref target, saveDestroyedThings, "li", ctorArgs);
                                    break;
                                }

                                case LookMode.Reference:
                                {
                                    ILoadReferenceable refee = (ILoadReferenceable)(object)item8;
                                    Scribe_References.Look(ref refee, "li", saveDestroyedThings);
                                    break;
                                }
                                }
                            }
                        }
                    }
                    else if (Scribe.mode == LoadSaveMode.LoadingVars)
                    {
                        XmlNode      curXmlParent = Scribe.loader.curXmlParent;
                        XmlAttribute xmlAttribute = curXmlParent.Attributes["IsNull"];
                        if (xmlAttribute != null && xmlAttribute.Value.ToLower() == "true")
                        {
                            if (lookMode == LookMode.Reference)
                            {
                                Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(null, null);
                            }
                            list = null;
                        }
                        else
                        {
                            switch (lookMode)
                            {
                            case LookMode.Value:
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                foreach (XmlNode childNode in curXmlParent.ChildNodes)
                                {
                                    T item = ScribeExtractor.ValueFromNode(childNode, default(T));
                                    list.Add(item);
                                }
                                break;

                            case LookMode.Deep:
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                foreach (XmlNode childNode2 in curXmlParent.ChildNodes)
                                {
                                    T item7 = ScribeExtractor.SaveableFromNode <T>(childNode2, ctorArgs);
                                    list.Add(item7);
                                }
                                break;

                            case LookMode.Def:
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                foreach (XmlNode childNode3 in curXmlParent.ChildNodes)
                                {
                                    T item6 = ScribeExtractor.DefFromNodeUnsafe <T>(childNode3);
                                    list.Add(item6);
                                }
                                break;

                            case LookMode.BodyPart:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                int num4 = 0;
                                foreach (XmlNode childNode4 in curXmlParent.ChildNodes)
                                {
                                    T item5 = (T)(object)ScribeExtractor.BodyPartFromNode(childNode4, num4.ToString(), null);
                                    list.Add(item5);
                                    num4++;
                                }
                                break;
                            }

                            case LookMode.LocalTargetInfo:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                int num3 = 0;
                                foreach (XmlNode childNode5 in curXmlParent.ChildNodes)
                                {
                                    T item4 = (T)(object)ScribeExtractor.LocalTargetInfoFromNode(childNode5, num3.ToString(), LocalTargetInfo.Invalid);
                                    list.Add(item4);
                                    num3++;
                                }
                                break;
                            }

                            case LookMode.TargetInfo:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                int num2 = 0;
                                foreach (XmlNode childNode6 in curXmlParent.ChildNodes)
                                {
                                    T item3 = (T)(object)ScribeExtractor.TargetInfoFromNode(childNode6, num2.ToString(), TargetInfo.Invalid);
                                    list.Add(item3);
                                    num2++;
                                }
                                break;
                            }

                            case LookMode.GlobalTargetInfo:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                int num = 0;
                                foreach (XmlNode childNode7 in curXmlParent.ChildNodes)
                                {
                                    T item2 = (T)(object)ScribeExtractor.GlobalTargetInfoFromNode(childNode7, num.ToString(), GlobalTargetInfo.Invalid);
                                    list.Add(item2);
                                    num++;
                                }
                                break;
                            }

                            case LookMode.Reference:
                            {
                                List <string> list2 = new List <string>(curXmlParent.ChildNodes.Count);
                                foreach (XmlNode childNode8 in curXmlParent.ChildNodes)
                                {
                                    list2.Add(childNode8.InnerText);
                                }
                                Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(list2, "");
                                break;
                            }
                            }
                        }
                    }
                    else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
                    {
                        switch (lookMode)
                        {
                        case LookMode.Reference:
                            list = Scribe.loader.crossRefs.TakeResolvedRefList <T>("");
                            break;

                        case LookMode.LocalTargetInfo:
                            if (list != null)
                            {
                                for (int j = 0; j < list.Count; j++)
                                {
                                    list[j] = (T)(object)ScribeExtractor.ResolveLocalTargetInfo((LocalTargetInfo)(object)list[j], j.ToString());
                                }
                            }
                            break;

                        case LookMode.TargetInfo:
                            if (list != null)
                            {
                                for (int k = 0; k < list.Count; k++)
                                {
                                    list[k] = (T)(object)ScribeExtractor.ResolveTargetInfo((TargetInfo)(object)list[k], k.ToString());
                                }
                            }
                            break;

                        case LookMode.GlobalTargetInfo:
                            if (list != null)
                            {
                                for (int i = 0; i < list.Count; i++)
                                {
                                    list[i] = (T)(object)ScribeExtractor.ResolveGlobalTargetInfo((GlobalTargetInfo)(object)list[i], i.ToString());
                                }
                            }
                            break;
                        }
                    }
                }
                finally
                {
                    Scribe.ExitNode();
                }
            }
            else if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                if (lookMode == LookMode.Reference)
                {
                    Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(null, label);
                }
                list = null;
            }
        }
示例#8
0
        public static void Look <T>(ref List <T> list, bool saveDestroyedThings, string label, LookMode lookMode = LookMode.Undefined, params object[] ctorArgs)
        {
            if (lookMode == LookMode.Undefined)
            {
                if (ParseHelper.HandlesType(typeof(T)))
                {
                    lookMode = LookMode.Value;
                }
                else if (typeof(T) == typeof(LocalTargetInfo))
                {
                    lookMode = LookMode.LocalTargetInfo;
                }
                else if (typeof(T) == typeof(TargetInfo))
                {
                    lookMode = LookMode.TargetInfo;
                }
                else if (typeof(T) == typeof(GlobalTargetInfo))
                {
                    lookMode = LookMode.GlobalTargetInfo;
                }
                else if (typeof(Def).IsAssignableFrom(typeof(T)))
                {
                    lookMode = LookMode.Def;
                }
                else if (typeof(T) == typeof(BodyPartRecord))
                {
                    lookMode = LookMode.BodyPart;
                }
                else
                {
                    if (!typeof(IExposable).IsAssignableFrom(typeof(T)) || typeof(ILoadReferenceable).IsAssignableFrom(typeof(T)))
                    {
                        Log.Error("LookList call with a list of " + typeof(T) + " must have lookMode set explicitly.");
                        return;
                    }
                    lookMode = LookMode.Deep;
                }
            }
            if (Scribe.EnterNode(label))
            {
                try
                {
                    if (Scribe.mode == LoadSaveMode.Saving)
                    {
                        if (list == null)
                        {
                            Scribe.saver.WriteAttribute("IsNull", "True");
                        }
                        else
                        {
                            foreach (T item8 in list)
                            {
                                switch (lookMode)
                                {
                                case LookMode.Value:
                                {
                                    T value5 = item8;
                                    Scribe_Values.Look(ref value5, "li", default(T), forceSave: true);
                                    break;
                                }

                                case LookMode.LocalTargetInfo:
                                {
                                    LocalTargetInfo value4 = (LocalTargetInfo)(object)item8;
                                    Scribe_TargetInfo.Look(ref value4, saveDestroyedThings, "li");
                                    break;
                                }

                                case LookMode.TargetInfo:
                                {
                                    TargetInfo value3 = (TargetInfo)(object)item8;
                                    Scribe_TargetInfo.Look(ref value3, saveDestroyedThings, "li");
                                    break;
                                }

                                case LookMode.GlobalTargetInfo:
                                {
                                    GlobalTargetInfo value2 = (GlobalTargetInfo)(object)item8;
                                    Scribe_TargetInfo.Look(ref value2, saveDestroyedThings, "li");
                                    break;
                                }

                                case LookMode.Def:
                                {
                                    Def value = (Def)(object)item8;
                                    Scribe_Defs.Look(ref value, "li");
                                    break;
                                }

                                case LookMode.BodyPart:
                                {
                                    BodyPartRecord part = (BodyPartRecord)(object)item8;
                                    Scribe_BodyParts.Look(ref part, "li");
                                    break;
                                }

                                case LookMode.Deep:
                                {
                                    T target = item8;
                                    Scribe_Deep.Look(ref target, saveDestroyedThings, "li", ctorArgs);
                                    break;
                                }

                                case LookMode.Reference:
                                {
                                    ILoadReferenceable refee = (ILoadReferenceable)(object)item8;
                                    Scribe_References.Look(ref refee, "li", saveDestroyedThings);
                                    break;
                                }
                                }
                            }
                        }
                    }
                    else if (Scribe.mode == LoadSaveMode.LoadingVars)
                    {
                        XmlNode      curXmlParent = Scribe.loader.curXmlParent;
                        XmlAttribute xmlAttribute = curXmlParent.Attributes["IsNull"];
                        if (xmlAttribute == null || !(xmlAttribute.Value.ToLower() == "true"))
                        {
                            switch (lookMode)
                            {
                            case LookMode.Value:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                IEnumerator enumerator3 = curXmlParent.ChildNodes.GetEnumerator();
                                try
                                {
                                    while (enumerator3.MoveNext())
                                    {
                                        XmlNode subNode = (XmlNode)enumerator3.Current;
                                        T       item    = ScribeExtractor.ValueFromNode(subNode, default(T));
                                        list.Add(item);
                                    }
                                }
                                finally
                                {
                                    IDisposable disposable2;
                                    if ((disposable2 = (enumerator3 as IDisposable)) != null)
                                    {
                                        disposable2.Dispose();
                                    }
                                }
                                break;
                            }

                            case LookMode.Deep:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                IEnumerator enumerator9 = curXmlParent.ChildNodes.GetEnumerator();
                                try
                                {
                                    while (enumerator9.MoveNext())
                                    {
                                        XmlNode subNode3 = (XmlNode)enumerator9.Current;
                                        T       item7    = ScribeExtractor.SaveableFromNode <T>(subNode3, ctorArgs);
                                        list.Add(item7);
                                    }
                                }
                                finally
                                {
                                    IDisposable disposable8;
                                    if ((disposable8 = (enumerator9 as IDisposable)) != null)
                                    {
                                        disposable8.Dispose();
                                    }
                                }
                                break;
                            }

                            case LookMode.Def:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                IEnumerator enumerator8 = curXmlParent.ChildNodes.GetEnumerator();
                                try
                                {
                                    while (enumerator8.MoveNext())
                                    {
                                        XmlNode subNode2 = (XmlNode)enumerator8.Current;
                                        T       item6    = ScribeExtractor.DefFromNodeUnsafe <T>(subNode2);
                                        list.Add(item6);
                                    }
                                }
                                finally
                                {
                                    IDisposable disposable7;
                                    if ((disposable7 = (enumerator8 as IDisposable)) != null)
                                    {
                                        disposable7.Dispose();
                                    }
                                }
                                break;
                            }

                            case LookMode.BodyPart:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                int         num4        = 0;
                                IEnumerator enumerator7 = curXmlParent.ChildNodes.GetEnumerator();
                                try
                                {
                                    while (enumerator7.MoveNext())
                                    {
                                        XmlNode node4 = (XmlNode)enumerator7.Current;
                                        T       item5 = (T)(object)ScribeExtractor.BodyPartFromNode(node4, num4.ToString(), null);
                                        list.Add(item5);
                                        num4++;
                                    }
                                }
                                finally
                                {
                                    IDisposable disposable6;
                                    if ((disposable6 = (enumerator7 as IDisposable)) != null)
                                    {
                                        disposable6.Dispose();
                                    }
                                }
                                break;
                            }

                            case LookMode.LocalTargetInfo:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                int         num3        = 0;
                                IEnumerator enumerator6 = curXmlParent.ChildNodes.GetEnumerator();
                                try
                                {
                                    while (enumerator6.MoveNext())
                                    {
                                        XmlNode         node3           = (XmlNode)enumerator6.Current;
                                        LocalTargetInfo localTargetInfo = ScribeExtractor.LocalTargetInfoFromNode(node3, num3.ToString(), LocalTargetInfo.Invalid);
                                        T item4 = (T)(object)localTargetInfo;
                                        list.Add(item4);
                                        num3++;
                                    }
                                }
                                finally
                                {
                                    IDisposable disposable5;
                                    if ((disposable5 = (enumerator6 as IDisposable)) != null)
                                    {
                                        disposable5.Dispose();
                                    }
                                }
                                break;
                            }

                            case LookMode.TargetInfo:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                int         num2        = 0;
                                IEnumerator enumerator5 = curXmlParent.ChildNodes.GetEnumerator();
                                try
                                {
                                    while (enumerator5.MoveNext())
                                    {
                                        XmlNode    node2      = (XmlNode)enumerator5.Current;
                                        TargetInfo targetInfo = ScribeExtractor.TargetInfoFromNode(node2, num2.ToString(), TargetInfo.Invalid);
                                        T          item3      = (T)(object)targetInfo;
                                        list.Add(item3);
                                        num2++;
                                    }
                                }
                                finally
                                {
                                    IDisposable disposable4;
                                    if ((disposable4 = (enumerator5 as IDisposable)) != null)
                                    {
                                        disposable4.Dispose();
                                    }
                                }
                                break;
                            }

                            case LookMode.GlobalTargetInfo:
                            {
                                list = new List <T>(curXmlParent.ChildNodes.Count);
                                int         num         = 0;
                                IEnumerator enumerator4 = curXmlParent.ChildNodes.GetEnumerator();
                                try
                                {
                                    while (enumerator4.MoveNext())
                                    {
                                        XmlNode          node             = (XmlNode)enumerator4.Current;
                                        GlobalTargetInfo globalTargetInfo = ScribeExtractor.GlobalTargetInfoFromNode(node, num.ToString(), GlobalTargetInfo.Invalid);
                                        T item2 = (T)(object)globalTargetInfo;
                                        list.Add(item2);
                                        num++;
                                    }
                                }
                                finally
                                {
                                    IDisposable disposable3;
                                    if ((disposable3 = (enumerator4 as IDisposable)) != null)
                                    {
                                        disposable3.Dispose();
                                    }
                                }
                                break;
                            }

                            case LookMode.Reference:
                            {
                                List <string> list2       = new List <string>(curXmlParent.ChildNodes.Count);
                                IEnumerator   enumerator2 = curXmlParent.ChildNodes.GetEnumerator();
                                try
                                {
                                    while (enumerator2.MoveNext())
                                    {
                                        XmlNode xmlNode = (XmlNode)enumerator2.Current;
                                        list2.Add(xmlNode.InnerText);
                                    }
                                }
                                finally
                                {
                                    IDisposable disposable;
                                    if ((disposable = (enumerator2 as IDisposable)) != null)
                                    {
                                        disposable.Dispose();
                                    }
                                }
                                Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(list2, string.Empty);
                                break;
                            }
                            }
                        }
                        else
                        {
                            list = null;
                        }
                    }
                    else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs)
                    {
                        switch (lookMode)
                        {
                        case LookMode.Reference:
                            list = Scribe.loader.crossRefs.TakeResolvedRefList <T>(string.Empty);
                            break;

                        case LookMode.LocalTargetInfo:
                            if (list != null)
                            {
                                for (int j = 0; j < list.Count; j++)
                                {
                                    list[j] = (T)(object)ScribeExtractor.ResolveLocalTargetInfo((LocalTargetInfo)(object)list[j], j.ToString());
                                }
                            }
                            break;

                        case LookMode.TargetInfo:
                            if (list != null)
                            {
                                for (int k = 0; k < list.Count; k++)
                                {
                                    list[k] = (T)(object)ScribeExtractor.ResolveTargetInfo((TargetInfo)(object)list[k], k.ToString());
                                }
                            }
                            break;

                        case LookMode.GlobalTargetInfo:
                            if (list != null)
                            {
                                for (int i = 0; i < list.Count; i++)
                                {
                                    list[i] = (T)(object)ScribeExtractor.ResolveGlobalTargetInfo((GlobalTargetInfo)(object)list[i], i.ToString());
                                }
                            }
                            break;
                        }
                    }
                }
                finally
                {
                    Scribe.ExitNode();
                }
            }
            else if (Scribe.mode == LoadSaveMode.LoadingVars)
            {
                if (lookMode == LookMode.Reference)
                {
                    Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(null, label);
                }
                list = null;
            }
        }