static HelpDef HelpForResearch( ResearchProjectDef researchProjectDef, HelpCategoryDef category ) { var helpDef = new HelpDef(); helpDef.defName = researchProjectDef.defName + "_ResearchProjectDef_Help"; helpDef.keyDef = researchProjectDef.defName; helpDef.label = researchProjectDef.label; helpDef.category = category; var s = new StringBuilder(); s.AppendLine( researchProjectDef.description ); s.AppendLine(); #region Base Stats s.AppendLine( "AutoHelpTotalCost".Translate( researchProjectDef.totalCost.ToString() ) ); s.AppendLine(); #endregion #region Research, Buildings, Recipes and SowTags // Add research required var researchDefs = researchProjectDef.GetResearchRequirements(); BuildDefDescription( s, "AutoHelpListResearchRequired".Translate(), researchDefs.ConvertAll<Def>( def =>(Def)def ) ); // Add buildings it unlocks var thingDefs = researchProjectDef.GetThingsUnlocked(); BuildDefDescription( s, "AutoHelpListThingsUnlocked".Translate(), thingDefs.ConvertAll<Def>( def =>(Def)def ) ); // Add recipes it unlocks var recipeDefs = researchProjectDef.GetRecipesUnlocked( ref thingDefs ); BuildDefWithDefDescription( s, "AutoHelpListRecipesUnlocked".Translate(), "AutoHelpListRecipesOnThingsUnlocked".Translate(), recipeDefs.ConvertAll<Def>( def =>(Def)def ), thingDefs.ConvertAll<Def>( def =>(Def)def ) ); // Look in advanced research to add plants and sow tags it unlocks var sowTags = researchProjectDef.GetSowTagsUnlocked( ref thingDefs ); BuildDefWithStringDescription( s, "AutoHelpListPlantsUnlocked".Translate(), "AutoHelpListPlantsIn".Translate(), thingDefs.ConvertAll<Def>( def =>(Def)def ), sowTags ); #endregion #region Lockouts // Get advanced research which locks researchDefs = researchProjectDef.GetResearchedLockedBy(); BuildDefDescription( s, "AutoHelpListResearchLockout".Translate(), researchDefs.ConvertAll<Def>( def =>(Def)def ) ); #endregion helpDef.description = s.ToString(); return helpDef; }
static HelpDef HelpForResearch( ResearchProjectDef researchProjectDef, HelpCategoryDef category ) { var helpDef = new HelpDef(); helpDef.defName = researchProjectDef.defName + "_ResearchProjectDef_Help"; helpDef.keyDef = researchProjectDef; helpDef.label = researchProjectDef.label; helpDef.category = category; helpDef.description = researchProjectDef.description; #region Base Stats HelpDetailSection totalCost = new HelpDetailSection(null, new [] { "AutoHelpTotalCost".Translate(researchProjectDef.totalCost.ToString()) }); helpDef.HelpDetailSections.Add( totalCost ); #endregion #region Research, Buildings, Recipes and SowTags // Add research required var researchDefs = researchProjectDef.GetResearchRequirements(); if( !researchDefs.NullOrEmpty() ) { HelpDetailSection researchRequirements = new HelpDetailSection( "AutoHelpListResearchRequired".Translate(), researchDefs.ConvertAll<Def>(def => (Def)def)); helpDef.HelpDetailSections.Add( researchRequirements ); } // Add research unlocked //CCL_Log.Message(researchProjectDef.label, "getting unlocked research"); researchDefs = researchProjectDef.GetResearchUnlocked(); if( !researchDefs.NullOrEmpty() ) { HelpDetailSection reseachUnlocked = new HelpDetailSection( "AutoHelpListResearchLeadsTo".Translate(), researchDefs.ConvertAll<Def>(def => (Def)def)); helpDef.HelpDetailSections.Add( reseachUnlocked ); } // Add buildings it unlocks var thingDefs = researchProjectDef.GetThingsUnlocked(); if( !thingDefs.NullOrEmpty() ) { HelpDetailSection thingsUnlocked = new HelpDetailSection( "AutoHelpListThingsUnlocked".Translate(), thingDefs.ConvertAll<Def>(def => (Def)def)); helpDef.HelpDetailSections.Add( thingsUnlocked ); } // Add recipes it unlocks var recipeDefs = researchProjectDef.GetRecipesUnlocked( ref thingDefs ); if( (!recipeDefs.NullOrEmpty()) && (!thingDefs.NullOrEmpty()) ) { HelpDetailSection recipesUnlocked = new HelpDetailSection( "AutoHelpListRecipesUnlocked".Translate(), recipeDefs.ConvertAll<Def>(def => (Def)def)); helpDef.HelpDetailSections.Add( recipesUnlocked ); HelpDetailSection recipesOnThingsUnlocked = new HelpDetailSection( "AutoHelpListRecipesOnThingsUnlocked".Translate(), thingDefs.ConvertAll<Def>(def => (Def)def)); helpDef.HelpDetailSections.Add( recipesOnThingsUnlocked ); } // Look in advanced research to add plants and sow tags it unlocks var sowTags = researchProjectDef.GetSowTagsUnlocked( ref thingDefs ); if( (!sowTags.NullOrEmpty()) && (!thingDefs.NullOrEmpty()) ) { HelpDetailSection plantsUnlocked = new HelpDetailSection( "AutoHelpListPlantsUnlocked".Translate(), thingDefs.ConvertAll<Def>( def =>(Def)def )); helpDef.HelpDetailSections.Add( plantsUnlocked ); HelpDetailSection plantsIn = new HelpDetailSection( "AutoHelpListPlantsIn".Translate(), sowTags.ToArray()); helpDef.HelpDetailSections.Add( plantsIn ); } #endregion #region Lockouts // Get advanced research which locks researchDefs = researchProjectDef.GetResearchedLockedBy(); if( !researchDefs.NullOrEmpty() ) { HelpDetailSection researchLockout = new HelpDetailSection( "AutoHelpListResearchLockout".Translate(), researchDefs.ConvertAll<Def>( def =>(Def)def ) ); helpDef.HelpDetailSections.Add( researchLockout ); } #endregion return helpDef; }