public override void ExposeData() { base.ExposeData(); if (ToSave == null) { ToSave = new ToSave(); } if (Scribe.mode == LoadSaveMode.Saving) { ToSave.Clear(); if (Current.Game != null) { foreach (var p in PawnsFinder.AllMaps) { if (p.IsColonist && !p.Dead && p.def.race.Humanlike) { PortraitsCache.SetDirty(p); GlobalTextureAtlasManager.TryMarkPawnFrameSetDirty(p); } } } foreach (KeyValuePair <ThingDef, HatHideEnum> kv in HatsThatHide) { switch (kv.Value) { case HatHideEnum.HidesAllHair: ToSave.hatsThatHideHair.Add(kv.Key.defName); break; case HatHideEnum.HidesHairShowBeard: ToSave.hatsToHideShowBeards.Add(kv.Key.defName); break; case HatHideEnum.HideHat: ToSave.hatsToHide.Add(kv.Key.defName); break; case HatHideEnum.OnlyDraftSH: ToSave.hatsToHideUnlessDraftedSH.Add(kv.Key.defName); break; case HatHideEnum.OnlyDraftHH: ToSave.hatsToHideUnlessDraftedHH.Add(kv.Key.defName); break; case HatHideEnum.OnlyDraftHHSB: ToSave.hatsToHideUnlessDraftedHHSB.Add(kv.Key.defName); break; default: // ShowHair, do nothing break; } } ToSave.hairToHide = new List <string>(); foreach (KeyValuePair <HairDef, bool> kv in HairToHide) { if (kv.Value) { ToSave.hairToHide.Add(kv.Key.defName); } } } Scribe_Collections.Look(ref ToSave.hatsThatHideHair, "HatsThatHide", LookMode.Value); Scribe_Collections.Look(ref ToSave.hatsToHideShowBeards, "HatsToHideShowBeards", LookMode.Value); Scribe_Collections.Look(ref ToSave.hatsToHideUnlessDraftedSH, "HatsToHideUnlessDraftedSH", LookMode.Value); Scribe_Collections.Look(ref ToSave.hatsToHideUnlessDraftedHH, "HatsToHideUnlessDraftedHH", LookMode.Value); Scribe_Collections.Look(ref ToSave.hatsToHideUnlessDraftedHHSB, "hatsToHideUnlessDraftedHHSB", LookMode.Value); Scribe_Collections.Look(ref ToSave.hatsToHide, "HatsToHide", LookMode.Value); Scribe_Collections.Look(ref ToSave.hairToHide, "HairToHide", LookMode.Value); Scribe_Values.Look <bool>(ref HideAllHats, "HideAllHats", false, false); Scribe_Values.Look <bool>(ref OnlyApplyToColonists, "OnlyApplyToColonists", false, false); Scribe_Values.Look <bool>(ref ShowHatsOnlyWhenDrafted, "ShowHatsOnlyWhenDrafted", false, false); Scribe_Values.Look <bool>(ref ShowHatsWhenDraftedIndoors, "ShowHatsWhenDraftedIndoors", false, false); Scribe_Values.Look <Indoors>(ref Indoors, "Indoors", Indoors.ShowHats, false); if (Scribe.mode != LoadSaveMode.Saving) { bool b = false; Scribe_Values.Look <bool>(ref b, "HideHatsIndoors", false, false); if (b) { Indoors = Indoors.HideHats; } } Scribe_Values.Look <bool>(ref UpdatePortrait, "UpdatePortrait", false, false); Scribe_Values.Look <bool>(ref UseDontShaveHead, "UseDontShaveHead", true, false); if (Scribe.mode == LoadSaveMode.Saving) { ToSave?.Clear(); ToSave = null; } OptionsOpen = false; }
private void Awake() { indoors = GetComponentInParent <Indoors>(); }