Пример #1
0
 private bool AmIActiveForAnyone()
 {
     for (int i = 0; i < linkedBuildings.Count; i++)
     {
         CompAffectedByFacilities compAffectedByFacilities = linkedBuildings[i].TryGetComp <CompAffectedByFacilities>();
         if (compAffectedByFacilities.IsFacilityActive(parent))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #2
0
 public override void PostDrawExtraSelectionOverlays()
 {
     for (int i = 0; i < linkedBuildings.Count; i++)
     {
         CompAffectedByFacilities compAffectedByFacilities = linkedBuildings[i].TryGetComp <CompAffectedByFacilities>();
         if (compAffectedByFacilities.IsFacilityActive(parent))
         {
             GenDraw.DrawLineBetween(parent.TrueCenter(), linkedBuildings[i].TrueCenter());
         }
         else
         {
             GenDraw.DrawLineBetween(parent.TrueCenter(), linkedBuildings[i].TrueCenter(), CompAffectedByFacilities.InactiveFacilityLineMat);
         }
     }
 }
Пример #3
0
        private void DrawResearchBenchFacilityRequirement(ThingDef requiredFacility, CompAffectedByFacilities bestMatchingBench, ResearchProjectDef project, ref Rect rect)
        {
            Thing thing  = null;
            Thing thing2 = null;

            if (bestMatchingBench != null)
            {
                thing  = bestMatchingBench.LinkedFacilitiesListForReading.Find((Thing x) => x.def == requiredFacility);
                thing2 = bestMatchingBench.LinkedFacilitiesListForReading.Find((Thing x) => x.def == requiredFacility && bestMatchingBench.IsFacilityActive(x));
            }
            SetPrerequisiteStatusColor(thing2 != null, project);
            string text = requiredFacility.LabelCap;

            if (thing != null && thing2 == null)
            {
                text = text + " (" + "InactiveFacility".Translate() + ")";
            }
            Widgets.LabelCacheHeight(ref rect, "  " + text);
        }
Пример #4
0
        private float GetResearchBenchRequirementsScore(Building_ResearchBench bench, List <ThingDef> requiredFacilities)
        {
            float num = 0f;
            int   i;

            for (i = 0; i < requiredFacilities.Count; i++)
            {
                CompAffectedByFacilities benchComp = bench.GetComp <CompAffectedByFacilities>();
                if (benchComp != null)
                {
                    List <Thing> linkedFacilitiesListForReading = benchComp.LinkedFacilitiesListForReading;
                    if (linkedFacilitiesListForReading.Find((Thing x) => x.def == requiredFacilities[i] && benchComp.IsFacilityActive(x)) != null)
                    {
                        num += 1f;
                    }
                    else if (linkedFacilitiesListForReading.Find((Thing x) => x.def == requiredFacilities[i]) != null)
                    {
                        num += 0.6f;
                    }
                }
            }
            return(num);
        }
        private void DrawResearchBenchFacilityRequirement(ThingDef requiredFacility, CompAffectedByFacilities bestMatchingBench, ResearchProjectDef project, ref Rect rect)
        {
            Thing thing  = null;
            Thing thing2 = null;

            if (bestMatchingBench != null)
            {
                thing  = bestMatchingBench.LinkedFacilitiesListForReading.Find((Thing x) => x.def == requiredFacility);
                thing2 = bestMatchingBench.LinkedFacilitiesListForReading.Find((Thing x) => x.def == requiredFacility && bestMatchingBench.IsFacilityActive(x));
            }
            SetPrerequisiteStatusColor(thing2 != null, project);
            string text = requiredFacility.LabelCap;

            if (thing != null && thing2 == null)
            {
                text += " (" + "InactiveFacility".Translate() + ")";
            }
            rect.height = Text.CalcHeight(text, rect.width - 24f - 6f);
            Widgets.HyperlinkWithIcon(rect, new Dialog_InfoCard.Hyperlink(requiredFacility), text);
        }