public static IEnumerable <string> LaunchFailReasons(Building rootBuilding) { List <Building> shipParts = ShipUtility.ShipBuildingsAttachedTo(rootBuilding).ToList <Building>(); using (Dictionary <ThingDef, int> .Enumerator enumerator = ShipUtility.RequiredParts().GetEnumerator()) { while (enumerator.MoveNext()) { KeyValuePair <ThingDef, int> partDef = enumerator.Current; int shipPartCount = shipParts.Count((Building pa) => pa.def == partDef.Key); if (shipPartCount < partDef.Value) { yield return(string.Format("{0}: {1}x {2} ({3} {4})", new object[] { "ShipReportMissingPart".Translate(), partDef.Value - shipPartCount, partDef.Key.label, "ShipReportMissingPartRequires".Translate(), partDef.Value })); } } } bool fullPodFound = false; foreach (Building building in shipParts) { if (building.def == ThingDefOf.Ship_CryptosleepCasket) { Building_CryptosleepCasket building_CryptosleepCasket = building as Building_CryptosleepCasket; if (building_CryptosleepCasket != null && building_CryptosleepCasket.HasAnyContents) { fullPodFound = true; break; } } } foreach (Building part in shipParts) { CompHibernatable hibernatable = part.TryGetComp <CompHibernatable>(); if (hibernatable != null && hibernatable.State == HibernatableStateDefOf.Hibernating) { yield return(string.Format("{0}: {1}", "ShipReportHibernating".Translate(), part.LabelCap)); } else if (hibernatable != null && !hibernatable.Running) { yield return(string.Format("{0}: {1}", "ShipReportNotReady".Translate(), part.LabelCap)); } } if (!fullPodFound) { yield return("ShipReportNoFullPods".Translate()); } yield break; }
public static IEnumerable <string> LaunchFailReasons(Building rootBuilding) { List <Building> shipParts = ShipUtility.ShipBuildingsAttachedTo(rootBuilding).ToList(); foreach (KeyValuePair <ThingDef, int> item in ShipUtility.RequiredParts()) { int shipPartCount = shipParts.Count((Building pa) => pa.def == item.Key); if (shipPartCount < item.Value) { yield return(string.Format("{0}: {1}x {2} ({3} {4})", "ShipReportMissingPart".Translate(), item.Value - shipPartCount, item.Key.label, "ShipReportMissingPartRequires".Translate(), item.Value)); /*Error: Unable to find new state assignment for yield return*/; } } bool fullPodFound = false; foreach (Building item2 in shipParts) { if (item2.def == ThingDefOf.Ship_CryptosleepCasket) { Building_CryptosleepCasket building_CryptosleepCasket = item2 as Building_CryptosleepCasket; if (building_CryptosleepCasket != null && building_CryptosleepCasket.HasAnyContents) { fullPodFound = true; break; } } } foreach (Building item3 in shipParts) { CompHibernatable hibernatable = item3.TryGetComp <CompHibernatable>(); if (hibernatable != null && hibernatable.State == HibernatableStateDefOf.Hibernating) { yield return(string.Format("{0}: {1}", "ShipReportHibernating".Translate(), item3.Label)); /*Error: Unable to find new state assignment for yield return*/; } if (hibernatable != null && !hibernatable.Running) { yield return(string.Format("{0}: {1}", "ShipReportNotReady".Translate(), item3.Label)); /*Error: Unable to find new state assignment for yield return*/; } } if (fullPodFound) { yield break; } yield return("ShipReportNoFullPods".Translate()); /*Error: Unable to find new state assignment for yield return*/; IL_036f: /*Error near IL_0370: Unexpected return in MoveNext()*/; }