public static void Postfix(ResearchProjectDef __instance, ref bool __result)
 {
     if (!__result)
     {
         List <Map> maps = Find.Maps;
         for (int i = 0; i < maps.Count; i++)
         {
             List <Building> allBuildingsColonist = maps[i].listerBuildings.allBuildingsColonist;
             for (int j = 0; j < allBuildingsColonist.Count; j++)
             {
                 Building_WorkTable researchStation = allBuildingsColonist[j] as Building_WorkTable;
                 if (researchStation != null && __instance.Alt_CanBeResearchedAt(researchStation))
                 {
                     __result = true;
                 }
             }
         }
     }
 }
コード例 #2
0
        public static void BuildingPresent_Postfix(ResearchProjectDef research, ref bool __result)
        {
            if (__result == true)
            {
                return;
            }

            bool flag = false;

            if (research.requiredResearchBuilding != null)
            {
                flag = Find.Maps.SelectMany((Map map) => map.listerBuildings.allBuildingsColonist).OfType <Building_WorkTable>().Any((Building_WorkTable b) => research.Alt_CanBeResearchedAt(b));
            }
            if (flag)
            {
                flag = research.Ancestors().All(new Func <ResearchProjectDef, bool>(BuildingPresent));
            }

            if (flag)
            {
                _buildingPresentCache.Remove(research);
                _buildingPresentCache.Add(research, flag);
            }

            __result = flag;
        }