Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        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()*/;
        }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
0
            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);
            }
Ejemplo n.º 7
0
        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()*/;
        }
        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);
        }