예제 #1
0
파일: Common.cs 프로젝트: RawCode/Rimgazer
        public void CreatePawnPreview(Colonist colonist, float left, float top, string Body, string Head, Clothing l1, Clothing l2, string Hair, Color Skin, Color color1, Color color2, Color HairColor)
        {
            Rect position = new Rect(left, top, 128f, 128f);
            string text = "Things/Pawn/Humanoid/Bodies/Naked_" + Body + "_Front";
            Texture2D image = ContentFinder<Texture2D>.Get(text, true);
            GUI.color = Skin;
            GUI.Label(position, image);

            Texture2D image2 = voidTexture;
            if (l1 != null)
            {
                image2 = ContentFinder<Texture2D>.Get(l1.GraphicPath + "_" + Body + "_front", true);
                GUI.color = color1;
                GUI.Label(position, image2);
            }

            Texture2D image3 = voidTexture;
            if (l2 != null)
            {
                image3 = ContentFinder<Texture2D>.Get(l2.GraphicPath + "_" + Body + "_front", true);
                GUI.color = color2;
                GUI.Label(position, image3);
            }

            Rect position2 = new Rect(left, top - 30f, 128f, 128f);
            string arg_12B_0 = colonist.HeadGraphicPath;
            Texture2D image5 = ContentFinder<Texture2D>.Get(Head + "_front", true);
            GUI.color = Skin;
            GUI.Label(position2, image5);
            position2 = new Rect(left, top - 30f, 128f, 128f);
            string arg_179_0 = colonist.HairDef.GraphicPath;
            Texture2D image6 = ContentFinder<Texture2D>.Get(Hair + "_front", true);
            GUI.color = HairColor;
            GUI.Label(position2, image6);
        }
예제 #2
0
 private void ShirtUp(Rect position)
 {
     shirtindex = shirtindex + 1;
     if (shirtindex > ShirtList.Count - 1)
     {
         shirtindex = 0;
     }
     GUI.Label(position, Language.FindText(LoadLanguage.language, ShirtList[shirtindex].Label));
     selectedshirt = ShirtList[shirtindex].Label;
     foreach (Clothing clothing in ClothingList)
     {
         if (clothing.Label == selectedshirt)
         {
             thisShirt = clothing;
             break;
         }
     }
 }
예제 #3
0
        private void CreateClothingList()
        {
            ClothingList.Clear();
            ShirtList.Clear();
            CoatList.Clear();

            int onskinIndex = 0;
            int shellIndex = 0;

            foreach (ThingDef current in DefDatabase<ThingDef>.AllDefs)
            {
                if (current.apparel != null)
                {
                    Apparel apparel = (Apparel)ThingMaker.MakeThing(current);
                    Clothing thisclothing = new Clothing();
                    bool ShirtOkay = true;
                    bool CoatOkay = true;

                    foreach (string exemption in Genstep_ColonistCreationMod.ExemptShirts)
                    {
                        if (apparel.Label == exemption)
                        {
                            ShirtOkay = false;
                        }
                    }
                    foreach (string exemption in Genstep_ColonistCreationMod.ExemptCoats)
                    {
                        if (apparel.Label == exemption)
                        {
                            CoatOkay = false;
                        }
                    }

                    if (apparel.def.apparel.Layer.ToString() == "OnSkin")
                    {
                        if (ShirtOkay == true)
                        {
                            thisclothing.Index = onskinIndex;
                            thisclothing.Layer = apparel.def.apparel.Layer.ToString();
                            thisclothing.Label = apparel.Label;
                            thisclothing.GraphicPath = apparel.def.apparel.graphicPath;
                            thisclothing.Color = Color.grey;
                            ShirtList.Add(thisclothing);
                            ClothingList.Add(thisclothing);
                            onskinIndex = onskinIndex + 1;
                        }
                    }
                    else if (apparel.def.apparel.Layer.ToString() == "Shell")
                    {
                        if (CoatOkay == true)
                        {
                            thisclothing.Index = shellIndex;
                            thisclothing.Layer = apparel.def.apparel.Layer.ToString();
                            thisclothing.Label = apparel.Label;
                            thisclothing.GraphicPath = apparel.def.apparel.graphicPath;
                            thisclothing.Color = Color.grey;
                            CoatList.Add(thisclothing);
                            ClothingList.Add(thisclothing);
                            shellIndex = shellIndex + 1;
                        }
                    }
                }
            }
        }
예제 #4
0
        private void SetClothingDefaults()
        {
            color1 = new Color();
            color2 = new Color();
            thisShirt = new Clothing();
            thisCoat = new Clothing();

            for (int i = 0; i < ShirtList.Count; i++)
            {
                if (colonist.Clothing[0].Label == ShirtList[i].Label)
                {
                    selectedshirt = ShirtList[i].Label;
                    shirtindex = i;
                }
            }

            for (int i = 0; i < CoatList.Count; i++)
            {
                if (colonist.Clothing[1].Label == CoatList[i].Label)
                {
                    selectedcoat = CoatList[i].Label;
                    coatindex = i;
                }
            }

            foreach (Clothing clothing in ClothingList)
            {
                if (selectedshirt == clothing.Label)
                {
                    thisShirt = clothing;
                }
                if (selectedcoat == clothing.Label)
                {
                    thisCoat = clothing;
                }
            }

            foreach (Clothing clothing in colonist.Clothing)
            {
                if (selectedshirt == clothing.Label)
                {
                    color1 = clothing.Color;
                }
                if (selectedcoat == clothing.Label)
                {
                    color2 = clothing.Color;
                }
            }
        }
예제 #5
0
 private void CoatUp(Rect position)
 {
     coatindex = coatindex + 1;
     if (coatindex > CoatList.Count - 1)
     {
         coatindex = 0;
     }
     GUI.Label(position, Language.FindText(LoadLanguage.language, CoatList[coatindex].Label));
     selectedcoat = CoatList[coatindex].Label;
     foreach (Clothing clothing in ClothingList)
     {
         if (clothing.Label == selectedcoat)
         {
             thisCoat = clothing;
             break;
         }
     }
 }
예제 #6
0
        public static void PawnsToColonists()
        {
            for (int p = 0; p < ColonistNum.Amount; p++)
            {
                if (ModdedMapInitParams.colonists[p] != null)
                {
                    Colonist colonist = new Colonist();
                    colonist.Age = ModdedMapInitParams.colonists[p].age;
                    colonist.Gender = (int)ModdedMapInitParams.colonists[p].gender;
                    colonist.FirstName = ModdedMapInitParams.colonists[p].Name.first;
                    colonist.NickName = ModdedMapInitParams.colonists[p].Name.nick;
                    colonist.LastName = ModdedMapInitParams.colonists[p].Name.last;

                    colonist.SkinColor = ModdedMapInitParams.colonists[p].story.skinColor;
                    colonist.CrownType = ModdedMapInitParams.colonists[p].story.crownType;
                    colonist.HeadGraphicPath = ModdedMapInitParams.colonists[p].story.headGraphicPath;
                    colonist.HairColor = ModdedMapInitParams.colonists[p].story.hairColor;

                    ColHairDef hair = new ColHairDef();
                    hair.DefName = ModdedMapInitParams.colonists[p].story.hairDef.defName;
                    hair.GraphicPath = ModdedMapInitParams.colonists[p].story.hairDef.graphicPath;
                    colonist.HairDef = hair;

                    List<StoryTrait> traits = new List<StoryTrait>();
                    StoryTrait trait = new StoryTrait();
                    trait.TraitName = ModdedMapInitParams.colonists[p].story.traits.allTraits[0].def.label;
                    traits.Add(trait);
                    trait = new StoryTrait();
                    trait.TraitName = ModdedMapInitParams.colonists[p].story.traits.allTraits[1].def.label;
                    traits.Add(trait);
                    colonist.Traits = traits;

                    List<Clothing> Outfit = new List<Clothing>();
                    ShirtList.Clear();
                    CoatList.Clear();
                    GenClothingList();

                    Clothing clothing = new Clothing();
                    clothing = ShirtList.RandomListElement<Clothing>();
                    Outfit.Add(clothing);

                    clothing = new Clothing();
                    clothing = CoatList.RandomListElement<Clothing>();
                    Outfit.Add(clothing);

                    colonist.Clothing = Outfit;

                    List<Colonist_Skill> skills = new List<Colonist_Skill>();

                    for (int a = 0; a < ModdedMapInitParams.colonists[p].skills.skills.Count; a++)
                    {
                        Colonist_Skill skill = new Colonist_Skill();
                        skill.SkillName = ModdedMapInitParams.colonists[p].skills.skills[a].def.skillLabel;
                        skill.SkillValue = ModdedMapInitParams.colonists[p].skills.skills[a].level;
                        skill.SkillPassion = (int)ModdedMapInitParams.colonists[p].skills.skills[a].passion;
                        skills.Add(skill);
                    }
                    colonist.Skills = skills;

                    List<Colonist_Backstory> Backstories = new List<Colonist_Backstory>();
                    Colonist_Backstory backstory = new Colonist_Backstory();
                    backstory.StoryName = ModdedMapInitParams.colonists[p].story.childhood.title;
                    backstory.BaseDescription = ModdedMapInitParams.colonists[p].story.childhood.baseDesc;
                    backstory.StoryAge = 0;
                    List<StorySkillGain> skillGains = new List<StorySkillGain>();
                    for (int i = 0; i < ModdedMapInitParams.colonists[p].story.childhood.skillGainsResolved.Count - 1; i++)
                    {
                        StorySkillGain skillGain = new StorySkillGain();
                        skillGain.SkillName = ModdedMapInitParams.colonists[p].story.childhood.skillGainsResolved.ElementAt(i).Key.skillLabel;
                        skillGain.SkillValue = ModdedMapInitParams.colonists[p].story.childhood.skillGainsResolved.ElementAt(i).Value;
                        skillGains.Add(skillGain);
                    }
                    backstory.SkillGains = skillGains;
                    List<string> Restrictions = new List<string>();
                    foreach (WorkTypeDef work in ModdedMapInitParams.colonists[p].story.childhood.DisabledWorkTypes)
                    {
                        Restrictions.Add(work.defName);
                    }
                    backstory.WorkRestrictions = Restrictions;
                    backstory.BodyTypeGlobal = ModdedMapInitParams.colonists[p].story.childhood.bodyTypeGlobal;
                    backstory.BodyTypeMale = ModdedMapInitParams.colonists[p].story.childhood.bodyTypeMale;
                    backstory.BodyTypeFemale = ModdedMapInitParams.colonists[p].story.childhood.bodyTypeFemale;
                    Backstories.Add(backstory);

                    backstory = new Colonist_Backstory();
                    backstory.StoryName = ModdedMapInitParams.colonists[p].story.adulthood.title;
                    backstory.BaseDescription = ModdedMapInitParams.colonists[p].story.adulthood.baseDesc;
                    backstory.StoryAge = 1;
                    skillGains = new List<StorySkillGain>();
                    for (int i = 0; i < ModdedMapInitParams.colonists[p].story.adulthood.skillGainsResolved.Count - 1; i++)
                    {
                        StorySkillGain skillGain = new StorySkillGain();
                        skillGain.SkillName = ModdedMapInitParams.colonists[p].story.adulthood.skillGainsResolved.ElementAt(i).Key.skillLabel;
                        skillGain.SkillValue = ModdedMapInitParams.colonists[p].story.adulthood.skillGainsResolved.ElementAt(i).Value;
                        skillGains.Add(skillGain);
                    }
                    backstory.SkillGains = skillGains;
                    Restrictions = new List<string>();
                    foreach (WorkTypeDef work in ModdedMapInitParams.colonists[p].story.adulthood.DisabledWorkTypes)
                    {
                        Restrictions.Add(work.defName);
                    }
                    backstory.WorkRestrictions = Restrictions;
                    backstory.BodyTypeGlobal = ModdedMapInitParams.colonists[p].story.adulthood.bodyTypeGlobal;
                    backstory.BodyTypeMale = ModdedMapInitParams.colonists[p].story.adulthood.bodyTypeMale;
                    backstory.BodyTypeFemale = ModdedMapInitParams.colonists[p].story.adulthood.bodyTypeFemale;

                    if (backstory.BodyTypeGlobal.ToString() != "Undefined")
                    {
                        colonist.BodyType = backstory.BodyTypeGlobal;
                    }
                    else
                    {
                        if (colonist.Gender == 1 && backstory.BodyTypeMale.ToString() != "Undefined")
                        {
                            colonist.BodyType = backstory.BodyTypeMale;
                        }
                        else if (colonist.Gender == 1 && backstory.BodyTypeMale.ToString() == "Undefined")
                        {
                            colonist.BodyType = BodyType.Male;
                        }

                        if (colonist.Gender == 2 && backstory.BodyTypeFemale.ToString() != "Undefined")
                        {
                            colonist.BodyType = backstory.BodyTypeFemale;
                        }
                        else if (colonist.Gender == 2 && backstory.BodyTypeFemale.ToString() == "Undefined")
                        {
                            colonist.BodyType = BodyType.Male;
                        }
                    }
                    Backstories.Add(backstory);
                    colonist.Backstory = Backstories;

                    GenWeaponList();
                    colonist.Weapon = WeaponList.RandomListElement<string>();

                    colonist.SkillPool = 0;

                    Population.Add(colonist);
                }
            }
        }
예제 #7
0
        public static void RandomColonists()
        {
            Population.Clear();
            ShirtList.Clear();
            CoatList.Clear();
            ClothingList.Clear();
            allBackstories.Clear();

            NameBank nameBank = NameShuffleDatabase.BankOf((NameCategory)1);

            GenClothingList();
            GenHairList();

            //Load in Backstories from BackstoryDatabase
            for (int a = 0; a < BackstoryDatabase.allBackstories.Count - 1; a++)
            {
                allBackstories.Add(BackstoryDatabase.allBackstories.ElementAt(a).Value);
            }
            List<Backstory> SortedBackstories = allBackstories.OrderBy(o => o.title).ToList();
            allBackstories = SortedBackstories;

            //Generate new random colonists
            for (int i = 0; i < ColonistNum.Amount; i++)
            {
                Colonist colonist = new Colonist();

                //Gen random colonist basic info
                int gender = UnityEngine.Random.Range(1, 100);
                if (gender > 50)
                {
                    gender = 1;
                    int body = UnityEngine.Random.Range(1, 4);
                    if (body == 1)
                    {
                        colonist.BodyType = BodyType.Male;
                    }
                    else if (body == 2)
                    {
                        colonist.BodyType = BodyType.Thin;
                    }
                    else if (body == 3)
                    {
                        colonist.BodyType = BodyType.Hulk;
                    }
                    else if (body == 4)
                    {
                        colonist.BodyType = BodyType.Fat;
                    }
                }
                else
                {
                    gender = 2;
                    int body = UnityEngine.Random.Range(1, 4);
                    if (body == 1)
                    {
                        colonist.BodyType = BodyType.Female;
                    }
                    else if (body == 2)
                    {
                        colonist.BodyType = BodyType.Thin;
                    }
                    else if (body == 3)
                    {
                        colonist.BodyType = BodyType.Hulk;
                    }
                    else if (body == 4)
                    {
                        colonist.BodyType = BodyType.Fat;
                    }
                }
                colonist.Gender = gender;
                colonist.FirstName = nameBank.GetName((Gender)colonist.Gender, (NameSlot)0);
                colonist.NickName = nameBank.GetName((Gender)colonist.Gender, (NameSlot)2);
                colonist.LastName = nameBank.GetName((Gender)0, (NameSlot)1);
                colonist.Age = UnityEngine.Random.Range(16, 70);

                //Gen colonist starting skills
                List<Colonist_Skill> skills = new List<Colonist_Skill>();

                if (ColonistDifficulty.Difficulty == "Easy")
                {
                    colonist.SkillPool = 40;
                }
                else if (ColonistDifficulty.Difficulty == "Normal")
                {
                    colonist.SkillPool = 20;
                }
                else
                {
                    colonist.SkillPool = 0;
                }

                for (int a = 0; a < 11; a++)
                {
                    Colonist_Skill skill = new Colonist_Skill();
                    if (a == 0)
                    {
                        skill.SkillName = "Construction".Translate();
                        skill.SkillPassion = 1;
                    }
                    else if (a == 1)
                    {
                        skill.SkillName = "Growing".Translate();
                        skill.SkillPassion = 2;
                    }
                    else if (a == 2)
                    {
                        skill.SkillName = "Research".Translate();
                        skill.SkillPassion = 3;
                    }
                    else if (a == 3)
                    {
                        skill.SkillName = "Mining".Translate();
                    }
                    else if (a == 4)
                    {
                        skill.SkillName = "Shooting".Translate();
                    }
                    else if (a == 5)
                    {
                        skill.SkillName = "Melee".Translate();
                    }
                    else if (a == 6)
                    {
                        skill.SkillName = "Social".Translate();
                    }
                    else if (a == 7)
                    {
                        skill.SkillName = "Cooking".Translate();
                    }
                    else if (a == 8)
                    {
                        skill.SkillName = "Medicine".Translate();
                    }
                    else if (a == 9)
                    {
                        skill.SkillName = "Artistic".Translate();
                    }
                    else if (a == 10)
                    {
                        skill.SkillName = "Crafting".Translate();
                    }
                    skill.SkillValue = 0;

                    skills.Add(skill);
                }
                colonist.Skills = skills;

                //Load Backstories
                childstories.Clear();
                adultstories.Clear();
                ChildStoryIndex = 0;
                AdultStoryIndex = 0;

                List<Colonist_Backstory> ColonistStory = new List<Colonist_Backstory>();

                for (int a = 0; a < allBackstories.Count - 1; a++)
                {
                    bool ChildStoryFound = false;
                    bool AdultStoryFound = false;

                    Colonist_Backstory story = new Colonist_Backstory();

                    if (allBackstories[a].slot == BackstorySlot.Childhood)
                    {
                        story.StoryName = allBackstories[a].title;
                        story.StoryAge = 0;
                        story.BaseDescription = allBackstories[a].baseDesc;
                        story.BodyTypeFemale = allBackstories[a].bodyTypeFemale;
                        story.BodyTypeMale = allBackstories[a].bodyTypeMale;
                        story.BodyTypeGlobal = allBackstories[a].bodyTypeGlobal;
                        story.StoryIndex = ChildStoryIndex;

                        List<StorySkillGain> skillGains = new List<StorySkillGain>();
                        for (int b = 0; b < allBackstories[a].skillGainsResolved.Count - 1; b++)
                        {
                            StorySkillGain skillGain = new StorySkillGain();
                            skillGain.SkillName = allBackstories[a].skillGainsResolved.ElementAt(b).Key.skillLabel;
                            skillGain.SkillValue = allBackstories[a].skillGainsResolved.ElementAt(b).Value;
                            skillGains.Add(skillGain);
                        }
                        story.SkillGains = skillGains;

                        List<string> workRestrictions = new List<string>();
                        foreach (WorkTypeDef work in allBackstories[a].DisabledWorkTypes)
                        {
                            workRestrictions.Add(work.defName);
                        }
                        story.WorkRestrictions = workRestrictions;
                        for (int b = 0; b < childstories.Count - 1; b++)
                        {
                            if (childstories[b].StoryName == story.StoryName)
                            {
                                ChildStoryFound = true;
                            }
                        }

                        if (ChildStoryFound == false)
                        {
                            childstories.Add(story);
                            ChildStoryIndex = ChildStoryIndex + 1;
                        }
                    }

                    if (colonist.Gender == 1)
                    {
                        if (allBackstories[a].slot == BackstorySlot.Adulthood)
                        {
                            if (allBackstories[a].bodyTypeMale == colonist.BodyType || allBackstories[a].bodyTypeGlobal == colonist.BodyType)
                            {
                                story.StoryName = allBackstories[a].title;
                                story.StoryAge = 1;
                                story.BaseDescription = allBackstories[a].baseDesc;
                                story.BodyTypeFemale = allBackstories[a].bodyTypeFemale;
                                story.BodyTypeMale = allBackstories[a].bodyTypeMale;
                                story.BodyTypeGlobal = allBackstories[a].bodyTypeGlobal;
                                story.StoryIndex = AdultStoryIndex;

                                List<StorySkillGain> skillGains = new List<StorySkillGain>();
                                for (int b = 0; b < allBackstories[a].skillGainsResolved.Count - 1; b++)
                                {
                                    StorySkillGain skillGain = new StorySkillGain();
                                    skillGain.SkillName = allBackstories[a].skillGainsResolved.ElementAt(b).Key.skillLabel;
                                    skillGain.SkillValue = allBackstories[a].skillGainsResolved.ElementAt(b).Value;
                                    skillGains.Add(skillGain);
                                }
                                story.SkillGains = skillGains;

                                List<string> workRestrictions = new List<string>();
                                foreach (WorkTypeDef work in allBackstories[a].DisabledWorkTypes)
                                {
                                    workRestrictions.Add(work.defName);
                                }
                                story.WorkRestrictions = workRestrictions;

                                for (int b = 0; b < ColonistManager.AdultStories.Count - 1; b++)
                                {
                                    if (ColonistManager.AdultStories[b].StoryName == story.StoryName)
                                    {
                                        AdultStoryFound = true;
                                    }
                                }

                                if (AdultStoryFound == false)
                                {
                                    ColonistManager.AdultStories.Add(story);
                                    AdultStoryIndex = AdultStoryIndex + 1;
                                }
                            }
                        }
                    }
                    else if (colonist.Gender == 2)
                    {
                        if (allBackstories[a].slot == BackstorySlot.Adulthood)
                        {
                            if (allBackstories[a].bodyTypeFemale == colonist.BodyType || allBackstories[a].bodyTypeGlobal == colonist.BodyType)
                            {
                                story.StoryName = allBackstories[a].title;
                                story.StoryAge = 1;
                                story.BaseDescription = allBackstories[a].baseDesc;
                                story.BodyTypeFemale = allBackstories[a].bodyTypeFemale;
                                story.BodyTypeMale = allBackstories[a].bodyTypeMale;
                                story.BodyTypeGlobal = allBackstories[a].bodyTypeGlobal;
                                story.StoryIndex = AdultStoryIndex;

                                List<StorySkillGain> skillGains = new List<StorySkillGain>();
                                for (int b = 0; b < allBackstories[a].skillGainsResolved.Count - 1; b++)
                                {
                                    StorySkillGain skillGain = new StorySkillGain();
                                    skillGain.SkillName = allBackstories[a].skillGainsResolved.ElementAt(b).Key.skillLabel;
                                    skillGain.SkillValue = allBackstories[a].skillGainsResolved.ElementAt(b).Value;
                                    skillGains.Add(skillGain);
                                }
                                story.SkillGains = skillGains;

                                List<string> workRestrictions = new List<string>();
                                foreach (WorkTypeDef work in allBackstories[a].DisabledWorkTypes)
                                {
                                    workRestrictions.Add(work.defName);
                                }
                                story.WorkRestrictions = workRestrictions;

                                for (int b = 0; b < ColonistManager.AdultStories.Count - 1; b++)
                                {
                                    if (ColonistManager.AdultStories[b].StoryName == story.StoryName)
                                    {
                                        AdultStoryFound = true;
                                    }
                                }

                                if (AdultStoryFound == false)
                                {
                                    ColonistManager.AdultStories.Add(story);
                                    AdultStoryIndex = AdultStoryIndex + 1;
                                }
                            }
                        }
                    }
                }

                //Gen random childhood backstory
                ColonistStory.Add(childstories[UnityEngine.Random.Range(0, childstories.Count - 1)]);

                //Gen random adulthood backstory
                ColonistStory.Add(adultstories[UnityEngine.Random.Range(0, adultstories.Count - 1)]);

                colonist.Backstory = ColonistStory;

                //Gen random traits
                int rand_trait = 0;

                List<StoryTrait> StoryTraits = new List<StoryTrait>();
                foreach (TraitDef trait in DefDatabase<TraitDef>.AllDefsListForReading)
                {
                    StoryTrait storyTrait = new StoryTrait();
                    storyTrait.TraitName = trait.label;
                    storyTrait.Effect = trait.effect;
                    StoryTraits.Add(storyTrait);
                }

                StoryTrait storytrait = new StoryTrait();
                storytrait = new StoryTrait();
                rand_trait = UnityEngine.Random.Range(0, StoryTraits.Count - 1);
                storytrait.TraitName = StoryTraits[rand_trait].TraitName;
                storytrait.Effect = StoryTraits[rand_trait].Effect;
                storytrait.TraitDescription = StoryTraits[rand_trait].TraitDescription;
                StoryTraits.Add(storytrait);

                StoryTrait storytrait2 = new StoryTrait();
                int rand_trait2 = 0;
                rand_trait2 = UnityEngine.Random.Range(0, StoryTraits.Count - 1);
                storytrait2.TraitName = StoryTraits[rand_trait2].TraitName;
                storytrait2.Effect = StoryTraits[rand_trait].Effect;
                storytrait2.TraitDescription = StoryTraits[rand_trait2].TraitDescription;
                StoryTraits.Add(storytrait2);

                colonist.Traits = StoryTraits;

                //Gen Apparel
                List<Clothing> Outfit = new List<Clothing>();

                Clothing clothing = new Clothing();
                clothing = ShirtList.RandomListElement<Clothing>();
                Outfit.Add(clothing);

                clothing = new Clothing();
                clothing = CoatList.RandomListElement<Clothing>();
                Outfit.Add(clothing);

                colonist.Clothing = Outfit;

                //Gen Body
                colonist.SkinColor = RandomSkinColor();
                colonist.CrownType = ((UnityEngine.Random.value >= 0.5f) ? CrownType.Narrow : CrownType.Average);
                colonist.HeadGraphicPath = GraphicDatabase_Head.GetHeadRandom((Gender)colonist.Gender, colonist.SkinColor, colonist.CrownType).graphicPath;

                //Gen Hair
                colonist.HairColor = RandomHairColor(colonist.SkinColor);

                ColHairDef hairDef = new ColHairDef();
                if (colonist.Gender == 1)
                {
                    hairDef = MaleHairList.RandomListElement<ColHairDef>();
                }
                else if (colonist.Gender == 2)
                {
                    hairDef = FemaleHairList.RandomListElement<ColHairDef>();
                }

                colonist.HairDef = hairDef;

                //Set BodyType
                if (colonist.Backstory[1].BodyTypeGlobal.ToString() != "Undefined")
                {
                    colonist.BodyType = colonist.Backstory[1].BodyTypeGlobal;
                }
                else
                {
                    if (colonist.Gender == 1 && colonist.Backstory[1].BodyTypeMale.ToString() != "Undefined")
                    {
                        colonist.BodyType = colonist.Backstory[1].BodyTypeMale;
                    }
                    else if (colonist.Gender == 1 && colonist.Backstory[1].BodyTypeMale.ToString() == "Undefined")
                    {
                        colonist.BodyType = BodyType.Male;
                    }

                    if (colonist.Gender == 2 && colonist.Backstory[1].BodyTypeFemale.ToString() != "Undefined")
                    {
                        colonist.BodyType = colonist.Backstory[1].BodyTypeFemale;
                    }
                    else if (colonist.Gender == 2 && colonist.Backstory[1].BodyTypeFemale.ToString() == "Undefined")
                    {
                        colonist.BodyType = BodyType.Male;
                    }
                }

                //Gen Weapon
                GenWeaponList();
                colonist.Weapon = WeaponList.RandomListElement<string>();

                //Add colonist to total population
                Population.Add(colonist);
            }
        }
예제 #8
0
        private static void VisitShell(XmlTextReader reader, int i)
        {
            Clothing clothing = new Clothing();

            while (reader.MoveToNextAttribute())
            {
                switch (reader.Name)
                {
                    case "Layer":
                        clothing.Layer = reader.Value;
                        break;

                    case "Label":
                        clothing.Label = reader.Value;
                        break;

                    case "GraphicPath":
                        clothing.GraphicPath = reader.Value;
                        break;

                    case "Color":
                        clothing.Color = GetColor(reader.Value);
                        break;
                }
            }
            ColonistManager.Population[i].Clothing[1] = clothing;
        }
예제 #9
0
        protected override void FillWindow(Rect inRect)
        {
            GenFont.SetFontMedium();
            GUI.contentColor = Color.white;
            Rect     position = new Rect(0f, 2f, 520f, 20f);
            GUIStyle gUIStyle = new GUIStyle();

            gUIStyle.alignment          = TextAnchor.MiddleCenter;
            gUIStyle.onNormal.textColor = Color.yellow;
            gUIStyle.normal.textColor   = Color.yellow;
            GUI.Label(position, Language.FindText(LoadLanguage.language, "Change Skin"), gUIStyle);

            //Body
            GenFont.SetFontTiny();
            position = new Rect(0f, 50f, 200f, 20f);
            GUI.Label(position, Language.FindText(LoadLanguage.language, "Body Shape"));

            Rect position2 = new Rect(30f, 70f, 100f, 24f);

            position = new Rect(0f, 70f, 24f, 24f);
            if (Widgets.TextButton(position, "<"))
            {
                BodyDown(position2);
            }
            GUI.Label(position2, Language.FindText(LoadLanguage.language, BodyList[bodyindex].ToString()));
            position = new Rect(140f, 70f, 24f, 24f);
            if (Widgets.TextButton(position, ">"))
            {
                BodyUp(position2);
            }

            //Skin
            GenFont.SetFontTiny();
            position = new Rect(0f, 190f, 200f, 20f);
            GUI.Label(position, Language.FindText(LoadLanguage.language, "Skin Color"));

            position2 = new Rect(30f, 210f, 100f, 24f);
            position  = new Rect(0f, 210f, 24f, 24f);
            if (Widgets.TextButton(position, "<"))
            {
                SkinDown(position2);
            }
            GUI.Label(position2, Language.FindText(LoadLanguage.language, SkinList[skinindex].ToString()));
            position = new Rect(140f, 210f, 24f, 24f);
            if (Widgets.TextButton(position, ">"))
            {
                SkinUp(position2);
            }

            Clothing l      = null;
            Clothing l2     = null;
            Color    color  = Color.gray;
            Color    color2 = Color.gray;

            foreach (Clothing clothing in colonist.Clothing)
            {
                if (clothing.Layer.ToString() == "OnSkin")
                {
                    l     = clothing;
                    color = clothing.Color;
                }
                else
                {
                    if (clothing.Layer.ToString() == "Shell")
                    {
                        l2     = clothing;
                        color2 = clothing.Color;
                    }
                }
            }

            position = new Rect(320f, 50f, 240f, 280f);
            GUI.Box(position, "");
            common.CreatePawnPreview(colonist, 390f, 120f, selectedBody, colonist.HeadGraphicPath, l, l2, colonist.HairDef.GraphicPath, skinColor, color, color2, colonist.HairColor);

            GenFont.SetFontMedium();
            GUI.color = Color.white;
            if (Widgets.TextButton(new Rect(inRect.width / 2f + 20f, inRect.height - 35f, inRect.width / 2f - 20f, 35f), "Confirm".Translate()))
            {
                colonist.SkinColor = skinColor;
                base.Close();
            }
            if (Widgets.TextButton(new Rect(0f, inRect.height - 35f, inRect.width / 2f - 20f, 35f), "Back".Translate()))
            {
                base.Close();
            }
        }