protected OptionsHeadType InitializeHumanHeadTypes()
        {
            MethodInfo headGraphicsMethod = typeof(GraphicDatabaseHeadRecords).GetMethod("BuildDatabaseIfNecessary", BindingFlags.Static | BindingFlags.NonPublic);

            headGraphicsMethod.Invoke(null, null);
            string[] headsFolderPaths = new string[] {
                "Things/Pawn/Humanlike/Heads/Male",
                "Things/Pawn/Humanlike/Heads/Female"
            };
            OptionsHeadType result = new OptionsHeadType();

            for (int i = 0; i < headsFolderPaths.Length; i++)
            {
                string text = headsFolderPaths[i];
                IEnumerable <string> graphicsInFolder = GraphicDatabaseUtility.GraphicNamesInFolder(text);
                foreach (string current in GraphicDatabaseUtility.GraphicNamesInFolder(text))
                {
                    string         fullPath = text + "/" + current;
                    CustomHeadType headType = CreateHeadTypeFromGenderedGraphicPath(fullPath);
                    result.AddHeadType(headType);
                    pathDictionary.Add(fullPath, headType);
                }
            }
            return(result);
        }
        protected OptionsHeadType InitializeAlienHeadTypes(ThingDef raceDef)
        {
            //Logger.Debug("InitializeAlienHeadTypes(" + raceDef.defName + ")");
            AlienRace       alienRace = AlienRaceProvider.GetAlienRace(raceDef);
            OptionsHeadType result    = new OptionsHeadType();

            if (alienRace == null)
            {
                Logger.Warning("Could not initialize head types for alien race, " + raceDef + ", because the race's thing definition was missing");
                return(result);
            }
            //Logger.Debug("alienRace.GraphicsPathForHeads = " + alienRace.GraphicsPathForHeads);
            if (alienRace.GraphicsPathForHeads == null)
            {
                Logger.Warning("Could not initialize head types for alien race, " + raceDef + ", because no path for head graphics was found.");
                return(result);
            }
            foreach (var crownType in alienRace.CrownTypes)
            {
                //Logger.Debug(" - " + crownType);
                if (alienRace.GenderSpecificHeads)
                {
                    CustomHeadType maleHead   = CreateGenderedAlienHeadTypeFromCrownType(alienRace.GraphicsPathForHeads, crownType, Gender.Male);
                    CustomHeadType femaleHead = CreateGenderedAlienHeadTypeFromCrownType(alienRace.GraphicsPathForHeads, crownType, Gender.Female);
                    if (maleHead != null)
                    {
                        //Logger.Debug("   - MALE: " + maleHead.GraphicPath);
                        result.AddHeadType(maleHead);
                    }
                    if (femaleHead != null)
                    {
                        //Logger.Debug("   - FEMALE: " + femaleHead.GraphicPath);
                        result.AddHeadType(femaleHead);
                    }
                }
                else
                {
                    CustomHeadType head = CreateMultiGenderAlienHeadTypeFromCrownType(alienRace.GraphicsPathForHeads, crownType);
                    if (head != null)
                    {
                        //Logger.Debug("   - MULTIGENDER: " + head.GraphicPath);
                        result.AddHeadType(head);
                    }
                }
            }
            return(result);
        }
Пример #3
0
        protected OptionsHeadType InitializeAlienHeadTypes(ThingDef raceDef)
        {
            AlienRace       alienRace = AlienRaceProvider.GetAlienRace(raceDef);
            OptionsHeadType result    = new OptionsHeadType();

            if (alienRace == null)
            {
                Log.Warning("Prepare Carefully could not initialize head types for alien race, " + raceDef);
                return(result);
            }
            if (alienRace.GraphicsPathForHeads == null)
            {
                Log.Warning("Prepare Carefully could not initialize head types for alien race, " + raceDef + ", because no path for head graphics was found.");
                return(result);
            }
            foreach (var crownType in alienRace.CrownTypes)
            {
                if (alienRace.GenderSpecificHeads)
                {
                    CustomHeadType maleHead   = CreateGenderedAlienHeadTypeFromCrownType(alienRace.GraphicsPathForHeads, crownType, Gender.Male);
                    CustomHeadType femaleHead = CreateGenderedAlienHeadTypeFromCrownType(alienRace.GraphicsPathForHeads, crownType, Gender.Female);
                    if (maleHead != null)
                    {
                        result.AddHeadType(maleHead);
                    }
                    if (femaleHead != null)
                    {
                        result.AddHeadType(femaleHead);
                    }
                }
                else
                {
                    CustomHeadType head = CreateMultiGenderAlienHeadTypeFromCrownType(alienRace.GraphicsPathForHeads, crownType);
                    if (head != null)
                    {
                        result.AddHeadType(head);
                    }
                }
            }
            return(result);
        }
Пример #4
0
        protected OptionsHeadType InitializeHumanHeadTypes()
        {
            Reflection.GraphicDatabaseHeadRecords.BuildDatabaseIfNecessary();
            string[] headsFolderPaths = new string[] {
                "Things/Pawn/Humanlike/Heads/Male",
                "Things/Pawn/Humanlike/Heads/Female"
            };
            OptionsHeadType result = new OptionsHeadType();

            for (int i = 0; i < headsFolderPaths.Length; i++)
            {
                string text = headsFolderPaths[i];
                IEnumerable <string> graphicsInFolder = GraphicDatabaseUtility.GraphicNamesInFolder(text);
                foreach (string current in GraphicDatabaseUtility.GraphicNamesInFolder(text))
                {
                    string         fullPath = text + "/" + current;
                    CustomHeadType headType = CreateHumanHeadTypeFromGenderedGraphicPath(fullPath);
                    result.AddHeadType(headType);
                    pathDictionary.Add(fullPath, headType);
                }
            }
            return(result);
        }