public void ExposeData()
        {
            string text = (this.childhood == null) ? null : this.childhood.identifier;

            Scribe_Values.Look(ref text, "childhood", null, false);
            if (Scribe.mode == LoadSaveMode.LoadingVars && !text.NullOrEmpty() && !BackstoryDatabase.TryGetWithIdentifier(text, out this.childhood))
            {
                Log.Error("Couldn't load child backstory with identifier " + text + ". Giving random.");
                this.childhood = BackstoryDatabase.RandomBackstory(BackstorySlot.Childhood);
            }
            string text2 = (this.adulthood == null) ? null : this.adulthood.identifier;

            Scribe_Values.Look(ref text2, "adulthood", null, false);
            if (Scribe.mode == LoadSaveMode.LoadingVars && !text2.NullOrEmpty() && !BackstoryDatabase.TryGetWithIdentifier(text2, out this.adulthood))
            {
                Log.Error("Couldn't load adult backstory with identifier " + text2 + ". Giving random.");
                this.adulthood = BackstoryDatabase.RandomBackstory(BackstorySlot.Adulthood);
            }
            Scribe_Values.Look <BodyType>(ref this.bodyType, "bodyType", BodyType.Undefined, false);
            Scribe_Values.Look <CrownType>(ref this.crownType, "crownType", CrownType.Undefined, false);
            Scribe_Values.Look <string>(ref this.headGraphicPath, "headGraphicPath", (string)null, false);
            Scribe_Defs.Look <HairDef>(ref this.hairDef, "hairDef");
            Scribe_Values.Look <Color>(ref this.hairColor, "hairColor", default(Color), false);
            Scribe_Values.Look <float>(ref this.melanin, "melanin", 0f, false);
            Scribe_Deep.Look <TraitSet>(ref this.traits, "traits", new object[1]
            {
                this.pawn
            });
            if (Scribe.mode == LoadSaveMode.PostLoadInit && this.hairDef == null)
            {
                this.hairDef = DefDatabase <HairDef> .AllDefs.RandomElement();
            }
        }
Beispiel #2
0
        public void ExposeData()
        {
            string value = (childhood == null) ? null : childhood.identifier;

            Scribe_Values.Look(ref value, "childhood");
            if (Scribe.mode == LoadSaveMode.LoadingVars && !value.NullOrEmpty() && !BackstoryDatabase.TryGetWithIdentifier(value, out childhood))
            {
                Log.Error("Couldn't load child backstory with identifier " + value + ". Giving random.");
                childhood = BackstoryDatabase.RandomBackstory(BackstorySlot.Childhood);
            }
            string value2 = (adulthood == null) ? null : adulthood.identifier;

            Scribe_Values.Look(ref value2, "adulthood");
            if (Scribe.mode == LoadSaveMode.LoadingVars && !value2.NullOrEmpty() && !BackstoryDatabase.TryGetWithIdentifier(value2, out adulthood))
            {
                Log.Error("Couldn't load adult backstory with identifier " + value2 + ". Giving random.");
                adulthood = BackstoryDatabase.RandomBackstory(BackstorySlot.Adulthood);
            }
            Scribe_Defs.Look(ref bodyType, "bodyType");
            Scribe_Values.Look(ref crownType, "crownType", CrownType.Undefined);
            Scribe_Values.Look(ref headGraphicPath, "headGraphicPath");
            Scribe_Defs.Look(ref hairDef, "hairDef");
            Scribe_Values.Look(ref hairColor, "hairColor");
            Scribe_Values.Look(ref melanin, "melanin", 0f);
            Scribe_Deep.Look(ref traits, "traits", pawn);
            Scribe_Values.Look(ref title, "title");
            if (Scribe.mode == LoadSaveMode.PostLoadInit && hairDef == null)
            {
                hairDef = DefDatabase <HairDef> .AllDefs.RandomElement();
            }
        }