public void ExposeData() { Scribe_TargetInfo.Look(ref this.target, "target"); Scribe_References.Look <Pawn>(ref this.claimant, "claimant", false); Scribe_References.Look <Job>(ref this.job, "job", false); }
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; } }
public void ExposeData() { Scribe_References.Look <Thing>(ref this.thing, "thing", false); Scribe_Values.Look <int>(ref this.countInt, "count", 1, false); }
public override void ExposeData() { base.ExposeData(); Scribe_References.Look <Pawn>(ref this.father, "father", false); }
public override void ExposeData() { base.ExposeData(); Scribe_References.Look(ref father, "father"); }
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(string.Concat("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"); return; } 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; return; } 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) { return; } 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; } return; } } finally { Scribe.ExitNode(); } } else if (Scribe.mode == LoadSaveMode.LoadingVars) { if (lookMode == LookMode.Reference) { Scribe.loader.crossRefs.loadIDs.RegisterLoadIDListReadFromXml(null, label); } list = null; } }
public void ExposeData() { Scribe_References.Look(ref thing, "thing"); Scribe_Values.Look(ref position, "position"); Scribe_Values.Look(ref ticksLeft, "ticksLeft", 0); }
private static void LookInternalReference <T>(ref T obj, string label, LookMode lookMode) where T : ILoadReferenceable { Scribe_References.Look(ref obj, label); }
public override void CompExposeData() { base.CompExposeData(); Scribe_References.Look(ref other, "other"); }
public static void Look <T>(ref T refee, string label, bool saveDestroyedThings = false) where T : ILoadReferenceable { if (Scribe.mode == LoadSaveMode.Saving) { if (refee == null) { Scribe.saver.WriteElement(label, "null"); return; } Thing thing = refee as Thing; if (thing != null && Scribe_References.CheckSaveReferenceToDestroyedThing(thing, label, saveDestroyedThings)) { return; } if (UnityData.isDebugBuild && thing != null) { if (!thing.def.HasThingIDNumber) { Log.Error("Trying to cross-reference save Thing which lacks ID number: " + refee, false); Scribe.saver.WriteElement(label, "null"); return; } if (thing.IsSaveCompressible()) { Log.Error("Trying to save a reference to a thing that will be compressed away: " + refee, false); Scribe.saver.WriteElement(label, "null"); return; } } string uniqueLoadID = refee.GetUniqueLoadID(); Scribe.saver.WriteElement(label, uniqueLoadID); Scribe.saver.loadIDsErrorsChecker.RegisterReferenced(refee, label); } else if (Scribe.mode == LoadSaveMode.LoadingVars) { if (Scribe.loader.curParent != null && Scribe.loader.curParent.GetType().IsValueType) { Log.Warning(string.Concat(new object[] { "Trying to load reference of an object of type ", typeof(T), " with label ", label, ", but our current node is a value type. The reference won't be loaded properly. curParent=", Scribe.loader.curParent }), false); } XmlNode xmlNode = Scribe.loader.curXmlParent[label]; string targetLoadID; if (xmlNode != null) { targetLoadID = xmlNode.InnerText; } else { targetLoadID = null; } Scribe.loader.crossRefs.loadIDs.RegisterLoadIDReadFromXml(targetLoadID, typeof(T), label); } else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs) { refee = Scribe.loader.crossRefs.TakeResolvedRef <T>(label); } }
public void ExposeData() { Scribe_Values.Look <IntVec3>(ref this.sizeInt, "size", default(IntVec3), false); Scribe_References.Look <MapParent>(ref this.parent, "parent", false); }
public void ExposeData() { Scribe_References.Look(ref thing, "thing"); Scribe_Values.Look(ref count, "count", 1); }
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; } }
public void ExposeData() { Scribe_TargetInfo.Look(ref target, "target"); Scribe_References.Look(ref claimant, "claimant"); Scribe_References.Look(ref job, "job"); }
public void ExposeData() { Scribe_Values.Look(ref sizeInt, "size"); Scribe_References.Look(ref parent, "parent"); }
public static void Look(ref GlobalTargetInfo value, bool saveDestroyedThings, string label, GlobalTargetInfo defaultValue) { if (Scribe.mode == LoadSaveMode.Saving) { if (!value.Equals(defaultValue) && (value.Thing == null || !Scribe_References.CheckSaveReferenceToDestroyedThing(value.Thing, label, saveDestroyedThings)) && (value.WorldObject == null || !Scribe_References.CheckSaveReferenceToDestroyedWorldObject(value.WorldObject, label, saveDestroyedThings))) { if (!value.HasThing && !value.HasWorldObject && value.Cell.IsValid && (value.Map == null || !Find.Maps.Contains(value.Map))) { Scribe.saver.WriteElement(label, "null"); } else { Scribe.saver.WriteElement(label, value.ToString()); } } } else if (Scribe.mode == LoadSaveMode.LoadingVars) { value = ScribeExtractor.GlobalTargetInfoFromNode(Scribe.loader.curXmlParent[label], label, defaultValue); } else if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs) { value = ScribeExtractor.ResolveGlobalTargetInfo(value, label); } }