// TODO: Need to cover vanilla serialisation for `CustomBehaviorVariableScope` type before this will work // TODO: Patch a call into this for the unit to load the data from the save file, or output as a companion save file public void Dehydrate(SerializableReferenceContainer references) { Dictionary <string, BehaviorVariableValue> dictionary = new Dictionary <string, BehaviorVariableValue>(this.behaviorVariables.Count); Dictionary <int, CustomBehaviorVariableScope> dictionary2 = new Dictionary <int, CustomBehaviorVariableScope>(this.ScopesByMood.Count); foreach (KeyValuePair <string, BehaviorVariableValue> keyValuePair in this.behaviorVariables) { string key = (string)keyValuePair.Key; BehaviorVariableValue value = keyValuePair.Value; dictionary.Add(key, value); } foreach (KeyValuePair <AIMood, CustomBehaviorVariableScope> keyValuePair2 in this.ScopesByMood) { int key2 = (int)keyValuePair2.Key; CustomBehaviorVariableScope value2 = keyValuePair2.Value; dictionary2.Add(key2, value2); } references.AddItemDictionary <string, BehaviorVariableValue>(this, "serializableCustomBehaviorVariables", dictionary); references.AddItemDictionary <int, CustomBehaviorVariableScope>(this, "serializableCustomScopesByMood", dictionary2); }
// TODO: Need to cover vanilla deserialisation for `CustomBehaviorVariableScope` type before this will work // TODO: Patch a call into this for the unit to save the data into the save file, or output as a companion save file public void Hydrate(SerializableReferenceContainer references) { Dictionary <string, BehaviorVariableValue> itemDictionary = references.GetItemDictionary <string, BehaviorVariableValue>(this, "serializableCustomBehaviorVariables"); Dictionary <int, CustomBehaviorVariableScope> itemDictionary2 = references.GetItemDictionary <int, CustomBehaviorVariableScope>(this, "serializableCustomScopesByMood"); this.behaviorVariables = new Dictionary <string, BehaviorVariableValue>(itemDictionary.Count); foreach (KeyValuePair <string, BehaviorVariableValue> keyValuePair in itemDictionary) { string key = (string)keyValuePair.Key; BehaviorVariableValue value = keyValuePair.Value; this.behaviorVariables.Add(key, value); } this.ScopesByMood = new Dictionary <AIMood, CustomBehaviorVariableScope>(itemDictionary2.Count); foreach (KeyValuePair <int, CustomBehaviorVariableScope> keyValuePair2 in itemDictionary2) { AIMood key2 = (AIMood)keyValuePair2.Key; CustomBehaviorVariableScope value2 = keyValuePair2.Value; this.ScopesByMood.Add(key2, value2); } }