public override void ExposeData() { base.ExposeData(); Scribe_Collections.Look(ref Configvalues, "TA_Expose_Numbers", LookMode.Value, LookMode.Value); int isPplDictSaved = 1; //LogOutput.WriteLogMessage(Errorlevel.Information, "val:" + isPplDictSaved.ToString()); Scribe_Values.Look(ref isPplDictSaved, "TA_Expose_People_isSaved", -1, true); //LogOutput.WriteLogMessage(Errorlevel.Information, "val:" + isPplDictSaved.ToString()); if (ColonyPeople != null) { ColonyPeople.RemoveAll(x => x.Key == null); } if (isPplDictSaved == 1) { Scribe_Collections.Look(ref ColonyPeople, "TA_Expose_People", LookMode.Reference, LookMode.Reference); //LogOutput.WriteLogMessage(Errorlevel.Information, "Read TA_ExposePeople"); } TechAdvancing_Config_Tab.ExposeData(TA_Expose_Mode.Load); if (ColonyPeople == null) { ColonyPeople = new Dictionary <Pawn, Faction>(); } LogOutput.WriteLogMessage(Errorlevel.Information, "Loading finished."); }
internal static void LoadCfgValues() { if (TechAdvancing_Config_Tab.worldCompSaveHandler.world != Find.World) { LogOutput.WriteLogMessage(Errorlevel.Warning, "wcsh not referencing the current world!!!"); } TechAdvancing_Config_Tab.ExposeData(TA_Expose_Mode.Load); }
public override void ExposeData() { LogOutput.WriteLogMessage(Errorlevel.Debug, $"Loading begun. Factiondef techlevel: {Find.FactionManager.OfPlayer.def.techLevel}"); if (Scribe.mode == LoadSaveMode.LoadingVars) { if (TA_ResearchManager.originalTechlevelCache.ContainsKey(Find.FactionManager.OfPlayer.Name)) { var correctTl = TA_ResearchManager.originalTechlevelCache[Find.FactionManager.OfPlayer.Name]; LogOutput.WriteLogMessage(Errorlevel.Information, $"The playerfaction is the same as one which was previously loaded. " + $"Resetting the techlevel to what it was before we changed it. Current faction techlevel: {Find.FactionManager.OfPlayer.def.techLevel} New (correct) techlevel: {correctTl}"); Find.FactionManager.OfPlayer.def.techLevel = correctTl; } else { LogOutput.WriteLogMessage(Errorlevel.Debug, $"Scribe mode is LoadingVars. The playerfaction is new, adding it to cache, with techlevel {Find.FactionManager.OfPlayer.def.techLevel}."); TA_ResearchManager.originalTechlevelCache.Add(Find.FactionManager.OfPlayer.Name, Find.FactionManager.OfPlayer.def.techLevel); } } TechAdvancing_Config_Tab.worldCompSaveHandler = this; base.ExposeData(); Scribe_Collections.Look(ref this.ConfigValues, "TA_Expose_Numbers", LookMode.Value, LookMode.Value); int isPplDictSaved = 1; //LogOutput.WriteLogMessage(Errorlevel.Information, "val:" + isPplDictSaved.ToString()); Scribe_Values.Look(ref isPplDictSaved, "TA_Expose_People_isSaved", -1, true); //LogOutput.WriteLogMessage(Errorlevel.Information, "val:" + isPplDictSaved.ToString()); if (this.ColonyPeople != null) { this.ColonyPeople.RemoveAll(x => x.Key == null); } if (isPplDictSaved == 1) { Scribe_Collections.Look(ref this.ColonyPeople, "TA_Expose_People", LookMode.Reference, LookMode.Reference); //LogOutput.WriteLogMessage(Errorlevel.Information, "Read TA_ExposePeople"); } TechAdvancing_Config_Tab.ExposeData(TA_Expose_Mode.Load); if (this.ColonyPeople == null) { this.ColonyPeople = new Dictionary <Pawn, Faction>(); } LogOutput.WriteLogMessage(Errorlevel.Information, "Loading finished."); TA_ResearchManager.FlushCfg(); }