void ToggleRecipes(bool setInitialState = false) { bool Hide = !setInitialState ? HideDefs : !HideDefs; // Go through each building foreach (var buildingDef in thingDefs) { // Make sure the thing has a recipe list if (buildingDef.recipes == null) { buildingDef.recipes = new List <RecipeDef>(); } // Go through each recipe foreach (var recipeDef in recipeDefs) { if (Hide) { // Hide recipe // Remove building from recipe if (recipeDef.recipeUsers != null) { recipeDef.recipeUsers.Remove(buildingDef); } // Remove recipe from building buildingDef.recipes.Remove(recipeDef); } else { // Add recipe to the building buildingDef.recipes.AddUnique(recipeDef); } } // Add this building to the list to recache ResearchSubController.RecacheBuildingRecipes(buildingDef); } }
public void ToggleHelp(bool setInitialState = false) { if ((!ConsolidateHelp) || (HelpDef == null)) { return; } bool Hide = HideUntilResearched && setInitialState; if (Hide) { // Hide it from the help system HelpDef.category = (HelpCategoryDef)null; } else { // Show it to the help system HelpDef.category = helpCategoryDef; } // Queue for recache ResearchSubController.RecacheHelpCategory(helpCategoryDef); }
void ToggleCallbacks(bool setInitialState = false) { bool Hide = !setInitialState ? HideDefs : !HideDefs; if (Hide) { // Cache the callbacks in reverse order when hiding for (int i = researchMods.Count - 1; i >= 0; i--) { var researchMod = researchMods[i]; // Add the advanced research mod to the cache ResearchSubController.ProcessResearchMod(researchMod); } } else { // Cache the callbacks in order foreach (var researchMod in researchMods) { // Add the advanced research mod to the cache ResearchSubController.ProcessResearchMod(researchMod); } } }