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();
            }
        }
        private static float HairChoiceLikelihoodFor(HairDef hair, Pawn pawn)
        {
            if (pawn.gender == Gender.None)
            {
                return(100f);
            }
            if (pawn.gender == Gender.Male)
            {
                switch (hair.hairGender)
                {
                case HairGender.Male:
                    return(70f);

                case HairGender.MaleUsually:
                    return(30f);

                case HairGender.Any:
                    return(60f);

                case HairGender.FemaleUsually:
                    return(5f);

                case HairGender.Female:
                    return(1f);
                }
            }
            if (pawn.gender == Gender.Female)
            {
                switch (hair.hairGender)
                {
                case HairGender.Male:
                    return(1f);

                case HairGender.MaleUsually:
                    return(5f);

                case HairGender.Any:
                    return(60f);

                case HairGender.FemaleUsually:
                    return(30f);

                case HairGender.Female:
                    return(70f);
                }
            }
            Log.Error(string.Concat(new object[]
            {
                "Unknown hair likelihood for ",
                hair,
                " with ",
                pawn
            }), false);
            return(0f);
        }
        private static float HairChoiceLikelihoodFor(HairDef hair, Pawn pawn)
        {
            if (pawn.gender == Gender.None)
            {
                return(100f);
            }
            if (pawn.gender == Gender.Male)
            {
                switch (hair.hairGender)
                {
                case HairGender.Female:
                    return(1f);

                case HairGender.FemaleUsually:
                    return(5f);

                case HairGender.MaleUsually:
                    return(30f);

                case HairGender.Male:
                    return(70f);

                case HairGender.Any:
                    return(60f);
                }
            }
            if (pawn.gender == Gender.Female)
            {
                switch (hair.hairGender)
                {
                case HairGender.Female:
                    return(70f);

                case HairGender.FemaleUsually:
                    return(30f);

                case HairGender.MaleUsually:
                    return(5f);

                case HairGender.Male:
                    return(1f);

                case HairGender.Any:
                    return(60f);
                }
            }
            Log.Error("Unknown hair likelihood for " + hair + " with " + pawn);
            return(0f);
        }
Beispiel #5
0
 internal float <> m__1(HairDef hair)
 {
     return(PawnHairChooser.HairChoiceLikelihoodFor(hair, this.pawn));
 }
Beispiel #6
0
 internal bool <> m__0(HairDef hair)
 {
     return(hair.hairTags.SharesElementWith(this.factionType.hairTags));
 }