Beispiel #1
0
        private static void CountdownEnded()
        {
            List <Building> list          = ShipUtility.ShipBuildingsAttachedTo(ShipCountdown.shipRoot).ToList <Building>();
            StringBuilder   stringBuilder = new StringBuilder();

            foreach (Building current in list)
            {
                Building_CryptosleepCasket building_CryptosleepCasket = current as Building_CryptosleepCasket;
                if (building_CryptosleepCasket != null && building_CryptosleepCasket.HasAnyContents)
                {
                    stringBuilder.AppendLine("   " + building_CryptosleepCasket.ContainedThing.LabelCap);
                    Find.StoryWatcher.statsRecord.colonistsLaunched++;
                    TaleRecorder.RecordTale(TaleDefOf.LaunchedShip, new object[]
                    {
                        building_CryptosleepCasket.ContainedThing
                    });
                }
                current.Destroy(DestroyMode.Vanish);
            }
            string victoryText = "GameOverShipLaunched".Translate(new object[]
            {
                stringBuilder.ToString(),
                GameVictoryUtility.PawnsLeftBehind()
            });

            GameVictoryUtility.ShowCredits(victoryText);
        }
Beispiel #2
0
 private static void CountdownEnded()
 {
     if (shipRoot != null)
     {
         List <Building> list          = ShipUtility.ShipBuildingsAttachedTo(shipRoot).ToList();
         StringBuilder   stringBuilder = new StringBuilder();
         foreach (Building item in list)
         {
             Building_CryptosleepCasket building_CryptosleepCasket = item as Building_CryptosleepCasket;
             if (building_CryptosleepCasket != null && building_CryptosleepCasket.HasAnyContents)
             {
                 stringBuilder.AppendLine("   " + building_CryptosleepCasket.ContainedThing.LabelCap);
                 Find.StoryWatcher.statsRecord.colonistsLaunched++;
                 TaleRecorder.RecordTale(TaleDefOf.LaunchedShip, building_CryptosleepCasket.ContainedThing);
             }
         }
         GameVictoryUtility.ShowCredits(GameVictoryUtility.MakeEndCredits("GameOverShipLaunchedIntro".Translate(), "GameOverShipLaunchedEnding".Translate(), stringBuilder.ToString()));
         foreach (Building item2 in list)
         {
             item2.Destroy();
         }
     }
     else if (!customLaunchString.NullOrEmpty())
     {
         GameVictoryUtility.ShowCredits(customLaunchString);
     }
     else
     {
         GameVictoryUtility.ShowCredits(GameVictoryUtility.MakeEndCredits("GameOverShipLaunchedIntro".Translate(), "GameOverShipLaunchedEnding".Translate(), null));
     }
 }
Beispiel #3
0
        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()*/;
        }
Beispiel #5
0
        public static void StartupHibernatingParts(Building rootBuilding)
        {
            List <Building> list = ShipUtility.ShipBuildingsAttachedTo(rootBuilding).ToList <Building>();

            foreach (Building current in list)
            {
                CompHibernatable compHibernatable = current.TryGetComp <CompHibernatable>();
                if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Hibernating)
                {
                    compHibernatable.Startup();
                }
            }
        }
Beispiel #6
0
        public static bool HasHibernatingParts(Building rootBuilding)
        {
            List <Building> list = ShipUtility.ShipBuildingsAttachedTo(rootBuilding).ToList <Building>();

            foreach (Building current in list)
            {
                CompHibernatable compHibernatable = current.TryGetComp <CompHibernatable>();
                if (compHibernatable != null && compHibernatable.State == HibernatableStateDefOf.Hibernating)
                {
                    return(true);
                }
            }
            return(false);
        }