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)); } }
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); }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo c in this.< GetGizmos > __BaseCallProxy0()) { yield return(c); } foreach (Gizmo c2 in ShipUtility.ShipStartupGizmos(this)) { yield return(c2); } Command_Action launch = new Command_Action(); launch.action = new Action(this.TryLaunch); launch.defaultLabel = "CommandShipLaunch".Translate(); launch.defaultDesc = "CommandShipLaunchDesc".Translate(); if (!this.CanLaunchNow) { launch.Disable(ShipUtility.LaunchFailReasons(this).First <string>()); } if (ShipCountdown.CountingDown) { launch.Disable(null); } launch.hotKey = KeyBindingDefOf.Misc1; launch.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip", true); yield return(launch); yield break; }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo gizmo in base.GetGizmos()) { yield return(gizmo); } foreach (Gizmo item in ShipUtility.ShipStartupGizmos(this)) { yield return(item); } Command_Action command_Action = new Command_Action(); command_Action.action = TryLaunch; command_Action.defaultLabel = "CommandShipLaunch".Translate(); command_Action.defaultDesc = "CommandShipLaunchDesc".Translate(); if (!CanLaunchNow) { command_Action.Disable(ShipUtility.LaunchFailReasons(this).First()); } if (ShipCountdown.CountingDown) { command_Action.Disable(); } command_Action.hotKey = KeyBindingDefOf.Misc1; command_Action.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip"); yield return(command_Action); }
public override IEnumerable <Gizmo> GetGizmos() { using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator()) { if (enumerator.MoveNext()) { Gizmo c2 = enumerator.Current; yield return(c2); /*Error: Unable to find new state assignment for yield return*/; } } using (IEnumerator <Gizmo> enumerator2 = ShipUtility.ShipStartupGizmos(this).GetEnumerator()) { if (enumerator2.MoveNext()) { Gizmo c = enumerator2.Current; yield return(c); /*Error: Unable to find new state assignment for yield return*/; } } yield break; IL_014a: /*Error near IL_014b: Unexpected return in MoveNext()*/; }
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 override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo c in base.GetGizmos()) { yield return(c); } foreach (Gizmo c2 in ShipUtility.ShipStartupGizmos(this)) { yield return(c2); } }
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()*/; }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo gizmo in base.GetGizmos()) { yield return(gizmo); } foreach (Gizmo item in ShipUtility.ShipStartupGizmos(this)) { yield return(item); } }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo c in this.< GetGizmos > __BaseCallProxy0()) { yield return(c); } foreach (Gizmo c2 in ShipUtility.ShipStartupGizmos(this)) { yield return(c2); } yield break; }
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(); } } }
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); }
public override IEnumerable <Gizmo> GetGizmos() { foreach (Gizmo c in base.GetGizmos()) { yield return(c); } if (ShipUtility.HasHibernatingParts(this)) { yield return(new Command_Action { action = delegate { DiaNode diaNode = new DiaNode("HibernateWarning".Translate()); DiaOption diaOption = new DiaOption("Confirm".Translate()); diaOption.action = delegate { ShipUtility.StartupHibernatingParts(this.$this); }; diaOption.resolveTree = true; diaNode.options.Add(diaOption); DiaOption diaOption2 = new DiaOption("GoBack".Translate()); diaOption2.resolveTree = true; diaNode.options.Add(diaOption2); Find.WindowStack.Add(new Dialog_NodeTree(diaNode, true, false, null)); }, defaultLabel = "CommandShipStartup".Translate(), defaultDesc = "CommandShipStartupDesc".Translate(), hotKey = KeyBindingDefOf.Misc1, icon = ContentFinder <Texture2D> .Get("UI/Commands/DesirePower", true) }); } Command_Action launch = new Command_Action(); launch.action = new Action(this.TryLaunch); launch.defaultLabel = "CommandShipLaunch".Translate(); launch.defaultDesc = "CommandShipLaunchDesc".Translate(); if (!this.CanLaunchNow) { launch.Disable(ShipUtility.LaunchFailReasons(this).First <string>()); } if (ShipCountdown.CountingDown) { launch.Disable(null); } launch.hotKey = KeyBindingDefOf.Misc1; launch.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip", true); yield return(launch); }
public override IEnumerable <Gizmo> GetGizmos() { using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator()) { if (enumerator.MoveNext()) { Gizmo c2 = enumerator.Current; yield return(c2); /*Error: Unable to find new state assignment for yield return*/; } } using (IEnumerator <Gizmo> enumerator2 = ShipUtility.ShipStartupGizmos(this).GetEnumerator()) { if (enumerator2.MoveNext()) { Gizmo c = enumerator2.Current; yield return(c); /*Error: Unable to find new state assignment for yield return*/; } } Command_Action launch = new Command_Action { action = TryLaunch, defaultLabel = "CommandShipLaunch".Translate(), defaultDesc = "CommandShipLaunchDesc".Translate() }; if (!CanLaunchNow) { launch.Disable(ShipUtility.LaunchFailReasons(this).First()); } if (ShipCountdown.CountingDown) { launch.Disable(); } launch.hotKey = KeyBindingDefOf.Misc1; launch.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip"); yield return((Gizmo)launch); /*Error: Unable to find new state assignment for yield return*/; IL_0226: /*Error near IL_0227: Unexpected return in MoveNext()*/; }
public void ShowReport() { StringBuilder stringBuilder = new StringBuilder(); if (!ShipUtility.LaunchFailReasons((Building)this.parent).Any <string>()) { stringBuilder.AppendLine("ShipReportCanLaunch".Translate()); } else { stringBuilder.AppendLine("ShipReportCannotLaunch".Translate()); foreach (string current in ShipUtility.LaunchFailReasons((Building)this.parent)) { stringBuilder.AppendLine(); stringBuilder.AppendLine(current); } } Dialog_MessageBox window = new Dialog_MessageBox(stringBuilder.ToString(), null, null, null, null, null, false); Find.WindowStack.Add(window); }
public static IEnumerable <Gizmo> ShipStartupGizmos(Building building) { if (ShipUtility.HasHibernatingParts(building)) { yield return(new Command_Action { action = delegate() { string text = "HibernateWarning"; if (building.Map.info.parent.GetComponent <EscapeShipComp>() == null) { text += "Standalone"; } if (!Find.Storyteller.difficulty.allowBigThreats) { text += "Pacifist"; } DiaNode diaNode = new DiaNode(text.Translate()); DiaOption diaOption = new DiaOption("Confirm".Translate()); diaOption.action = delegate() { ShipUtility.StartupHibernatingParts(building); }; diaOption.resolveTree = true; diaNode.options.Add(diaOption); DiaOption diaOption2 = new DiaOption("GoBack".Translate()); diaOption2.resolveTree = true; diaNode.options.Add(diaOption2); Find.WindowStack.Add(new Dialog_NodeTree(diaNode, true, false, null)); }, defaultLabel = "CommandShipStartup".Translate(), defaultDesc = "CommandShipStartupDesc".Translate(), hotKey = KeyBindingDefOf.Misc1, icon = ContentFinder <Texture2D> .Get("UI/Commands/DesirePower", true) }); } yield break; }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; bool flag = false; switch (num) { case 0u: enumerator = base.< GetGizmos > __BaseCallProxy0().GetEnumerator(); num = 4294967293u; break; case 1u: break; case 2u: goto IL_D2; default: return(false); } try { switch (num) { } if (enumerator.MoveNext()) { c = enumerator.Current; this.$current = c; if (!this.$disposing) { this.$PC = 1; } flag = true; return(true); } } finally { if (!flag) { if (enumerator != null) { enumerator.Dispose(); } } } enumerator2 = ShipUtility.ShipStartupGizmos(this).GetEnumerator(); num = 4294967293u; try { IL_D2: switch (num) { } if (enumerator2.MoveNext()) { c2 = enumerator2.Current; this.$current = c2; if (!this.$disposing) { this.$PC = 2; } flag = true; return(true); } } finally { if (!flag) { if (enumerator2 != null) { enumerator2.Dispose(); } } } this.$PC = -1; return(false); }
public bool MoveNext() { uint num = (uint)this.$PC; this.$PC = -1; bool flag = false; switch (num) { case 0u: enumerator = base.< GetGizmos > __BaseCallProxy0().GetEnumerator(); num = 4294967293u; break; case 1u: break; case 2u: goto IL_D6; case 3u: this.$PC = -1; return(false); default: return(false); } try { switch (num) { } if (enumerator.MoveNext()) { c = enumerator.Current; this.$current = c; if (!this.$disposing) { this.$PC = 1; } flag = true; return(true); } } finally { if (!flag) { if (enumerator != null) { enumerator.Dispose(); } } } enumerator2 = ShipUtility.ShipStartupGizmos(this).GetEnumerator(); num = 4294967293u; try { IL_D6: switch (num) { } if (enumerator2.MoveNext()) { c2 = enumerator2.Current; this.$current = c2; if (!this.$disposing) { this.$PC = 2; } flag = true; return(true); } } finally { if (!flag) { if (enumerator2 != null) { enumerator2.Dispose(); } } } launch = new Command_Action(); launch.action = new Action(base.TryLaunch); launch.defaultLabel = "CommandShipLaunch".Translate(); launch.defaultDesc = "CommandShipLaunchDesc".Translate(); if (!base.CanLaunchNow) { launch.Disable(ShipUtility.LaunchFailReasons(this).First <string>()); } if (ShipCountdown.CountingDown) { launch.Disable(null); } launch.hotKey = KeyBindingDefOf.Misc1; launch.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip", true); this.$current = launch; if (!this.$disposing) { this.$PC = 3; } return(true); }
public override IEnumerable <Gizmo> CompGetGizmosExtra() { Command_Action launch = new Command_Action { action = TryLaunch, defaultLabel = "CommandShipLaunch".Translate(), defaultDesc = "CommandShipLaunchDesc".Translate() }; if (!CanLaunchNow) { launch.Disable(ShipUtility.LaunchFailReasons(parentBuilding).First()); } if (ShipCountdown.CountingDown) { launch.Disable(); } launch.hotKey = KeyBindingDefOf.Misc1; launch.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip"); Command_Action orbit = new Command_Action { action = TryOrbit, defaultLabel = "ShipInsideOrbit".Translate(), defaultDesc = "ShipInsideOrbitDesc".Translate() }; if (!CanOrbitNow) { orbit.Disable(ShipUtility.LaunchFailReasons(parentBuilding).First()); } if (ShipCountdown.CountingDown) { orbit.Disable(); } orbit.hotKey = KeyBindingDefOf.Misc1; orbit.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip"); Command_Action land = new Command_Action { action = TryLand, defaultLabel = "ShipInsideLand".Translate(), defaultDesc = "ShipInsideLandDesc".Translate() }; if (!CanOrbitNow) { land.Disable(ShipUtility.LaunchFailReasons(parentBuilding).First()); } if (ShipCountdown.CountingDown) { land.Disable(); } land.hotKey = KeyBindingDefOf.Misc1; land.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip"); ShipDefinition def = parent.Map.GetSpaceAtmosphereMapComponent().DefinitionAt(parent.Position); Command_Action shortJump = new Command_Action { action = TryShortJump, defaultLabel = "ShipInsideShortJump".Translate(), defaultDesc = "ShipInsideShortJumpDesc".Translate() }; if (ShipCountdown.CountingDown) { shortJump.Disable(); } shortJump.hotKey = KeyBindingDefOf.Misc1; shortJump.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip"); Command_Action renameShip = new Command_Action { action = delegate { Find.WindowStack.Add(new Dialog_NameShip(def)); }, defaultLabel = "ShipInsideRename".Translate(), defaultDesc = "ShipInsideRenameDesc".Translate() }; if (ShipCountdown.CountingDown) { renameShip.Disable(); } renameShip.hotKey = KeyBindingDefOf.Misc1; renameShip.icon = ContentFinder <Texture2D> .Get("UI/Commands/RenameZone"); // Soon... so soon... List <Gizmo> gizmos = base.CompGetGizmosExtra().ToList(); gizmos.Add(launch); if (parent.Map.terrainGrid.TerrainAt(IntVec3.Zero).defName == "HardVacuum") { if (def != null) { gizmos.Add(land); } if (def.ReadyForShortRangeJump) { gizmos.Add(shortJump); } } else { if (def != null) { gizmos.Add(orbit); } } if (def != null) { gizmos.Add(renameShip); } return(gizmos); }
public override IEnumerable <Gizmo> GetGizmos() { using (IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator()) { if (enumerator.MoveNext()) { Gizmo c = enumerator.Current; yield return(c); /*Error: Unable to find new state assignment for yield return*/; } } if (ShipUtility.HasHibernatingParts(this)) { yield return((Gizmo) new Command_Action { action = delegate { DiaNode diaNode = new DiaNode("HibernateWarning".Translate()); DiaOption diaOption = new DiaOption("Confirm".Translate()); diaOption.action = delegate { ShipUtility.StartupHibernatingParts(((_003CGetGizmos_003Ec__Iterator0) /*Error near IL_00d9: stateMachine*/)._0024this); }; diaOption.resolveTree = true; diaNode.options.Add(diaOption); DiaOption diaOption2 = new DiaOption("GoBack".Translate()); diaOption2.resolveTree = true; diaNode.options.Add(diaOption2); Find.WindowStack.Add(new Dialog_NodeTree(diaNode, true, false, null)); }, defaultLabel = "CommandShipStartup".Translate(), defaultDesc = "CommandShipStartupDesc".Translate(), hotKey = KeyBindingDefOf.Misc1, icon = ContentFinder <Texture2D> .Get("UI/Commands/DesirePower", true) }); /*Error: Unable to find new state assignment for yield return*/; } Command_Action launch = new Command_Action { action = this.TryLaunch, defaultLabel = "CommandShipLaunch".Translate(), defaultDesc = "CommandShipLaunchDesc".Translate() }; if (!this.CanLaunchNow) { launch.Disable(ShipUtility.LaunchFailReasons(this).First()); } if (ShipCountdown.CountingDown) { launch.Disable(null); } launch.hotKey = KeyBindingDefOf.Misc1; launch.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip", true); yield return((Gizmo)launch); /*Error: Unable to find new state assignment for yield return*/; IL_023b: /*Error near IL_023c: Unexpected return in MoveNext()*/; }