예제 #1
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo c in base.GetGizmos())
            {
                yield return(c);
            }
            CompChangeableProjectile changeableProjectile = this.gun.TryGetComp <CompChangeableProjectile>();

            if (changeableProjectile != null)
            {
                Command_Action extract = new Command_Action();
                extract.defaultLabel = "CommandExtractShell".Translate();
                extract.defaultDesc  = "CommandExtractShellDesc".Translate();
                extract.icon         = ContentFinder <Texture2D> .Get("Things/Item/Resource/Shell/Shell_HighExplosive", true);

                extract.alsoClickIfOtherInGroupClicked = false;
                extract.action = delegate
                {
                    GenPlace.TryPlaceThing(changeableProjectile.RemoveShell(), this.$this.Position, this.$this.Map, ThingPlaceMode.Near, null);
                };
                if (changeableProjectile.Projectile == null)
                {
                    extract.Disable("CommandExtractShellFailNoShell".Translate());
                }
                yield return(extract);
            }
            if (this.CanSetForcedTarget)
            {
                yield return(new Command_VerbTarget
                {
                    defaultLabel = "CommandSetForceAttackTarget".Translate(),
                    defaultDesc = "CommandSetForceAttackTargetDesc".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true),
                    verb = this.GunCompEq.PrimaryVerb,
                    hotKey = KeyBindingDefOf.Misc4
                });
            }
            if (this.forcedTarget.IsValid)
            {
                Command_Action stop = new Command_Action();
                stop.defaultLabel = "CommandStopForceAttack".Translate();
                stop.defaultDesc  = "CommandStopForceAttackDesc".Translate();
                stop.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Halt", true);

                stop.action = delegate
                {
                    this.$this.ResetForcedTarget();
                    SoundDefOf.TickLow.PlayOneShotOnCamera(null);
                };
                if (!this.forcedTarget.IsValid)
                {
                    stop.Disable("CommandStopAttackFailNotForceAttacking".Translate());
                }
                stop.hotKey = KeyBindingDefOf.Misc5;
                yield return(stop);
            }
            if (this.CanToggleHoldFire)
            {
                yield return(new Command_Toggle
                {
                    defaultLabel = "CommandHoldFire".Translate(),
                    defaultDesc = "CommandHoldFireDesc".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Commands/HoldFire", true),
                    hotKey = KeyBindingDefOf.Misc6,
                    toggleAction = delegate
                    {
                        this.$this.holdFire = !this.$this.holdFire;
                        if (this.$this.holdFire)
                        {
                            this.$this.ResetForcedTarget();
                        }
                    },
                    isActive = (() => this.$this.holdFire)
                });
            }
        }
예제 #2
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            _003CGetGizmos_003Ec__Iterator0 _003CGetGizmos_003Ec__Iterator = (_003CGetGizmos_003Ec__Iterator0) /*Error near IL_0044: stateMachine*/;

            using (IEnumerator <Gizmo> enumerator = this._003CGetGizmos_003E__BaseCallProxy0().GetEnumerator())
            {
                if (enumerator.MoveNext())
                {
                    Gizmo c = enumerator.Current;
                    yield return(c);

                    /*Error: Unable to find new state assignment for yield return*/;
                }
            }
            CompChangeableProjectile changeableProjectile = this.gun.TryGetComp <CompChangeableProjectile>();

            if (changeableProjectile != null)
            {
                Command_Action extract = new Command_Action
                {
                    defaultLabel = "CommandExtractShell".Translate(),
                    defaultDesc  = "CommandExtractShellDesc".Translate(),
                    icon         = ContentFinder <Texture2D> .Get("Things/Item/Resource/Shell/Shell_HighExplosive", true),
                    alsoClickIfOtherInGroupClicked = false,
                    action = delegate
                    {
                        GenPlace.TryPlaceThing(changeableProjectile.RemoveShell(), _003CGetGizmos_003Ec__Iterator._0024this.Position, _003CGetGizmos_003Ec__Iterator._0024this.Map, ThingPlaceMode.Near, null);
                    }
                };
                if (changeableProjectile.Projectile == null)
                {
                    extract.Disable("CommandExtractShellFailNoShell".Translate());
                }
                yield return((Gizmo)extract);

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (this.CanSetForcedTarget)
            {
                yield return((Gizmo) new Command_VerbTarget
                {
                    defaultLabel = "CommandSetForceAttackTarget".Translate(),
                    defaultDesc = "CommandSetForceAttackTargetDesc".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true),
                    verb = this.GunCompEq.PrimaryVerb,
                    hotKey = KeyBindingDefOf.Misc4
                });

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (base.forcedTarget.IsValid)
            {
                Command_Action stop = new Command_Action
                {
                    defaultLabel = "CommandStopForceAttack".Translate(),
                    defaultDesc  = "CommandStopForceAttackDesc".Translate(),
                    icon         = ContentFinder <Texture2D> .Get("UI/Commands/Halt", true),
                    action       = delegate
                    {
                        _003CGetGizmos_003Ec__Iterator._0024this.ResetForcedTarget();
                        SoundDefOf.TickLow.PlayOneShotOnCamera(null);
                    }
                };
                if (!base.forcedTarget.IsValid)
                {
                    stop.Disable("CommandStopAttackFailNotForceAttacking".Translate());
                }
                stop.hotKey = KeyBindingDefOf.Misc5;
                yield return((Gizmo)stop);

                /*Error: Unable to find new state assignment for yield return*/;
            }
            if (!this.CanToggleHoldFire)
            {
                yield break;
            }
            yield return((Gizmo) new Command_Toggle
            {
                defaultLabel = "CommandHoldFire".Translate(),
                defaultDesc = "CommandHoldFireDesc".Translate(),
                icon = ContentFinder <Texture2D> .Get("UI/Commands/HoldFire", true),
                hotKey = KeyBindingDefOf.Misc6,
                toggleAction = delegate
                {
                    _003CGetGizmos_003Ec__Iterator._0024this.holdFire = !_003CGetGizmos_003Ec__Iterator._0024this.holdFire;
                    if (_003CGetGizmos_003Ec__Iterator._0024this.holdFire)
                    {
                        _003CGetGizmos_003Ec__Iterator._0024this.ResetForcedTarget();
                    }
                },
                isActive = (() => _003CGetGizmos_003Ec__Iterator._0024this.holdFire)
            });

            /*Error: Unable to find new state assignment for yield return*/;
IL_0407:
            /*Error near IL_0408: Unexpected return in MoveNext()*/;
        }
예제 #3
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo c in base.GetGizmos())
            {
                yield return(c);
            }
            if (this.CanExtractShell)
            {
                CompChangeableProjectile changeableProjectile = this.gun.TryGetComp <CompChangeableProjectile>();
                yield return(new Command_Action
                {
                    defaultLabel = "CommandExtractShell".Translate(),
                    defaultDesc = "CommandExtractShellDesc".Translate(),
                    icon = changeableProjectile.LoadedShell.uiIcon,
                    iconAngle = changeableProjectile.LoadedShell.uiIconAngle,
                    iconOffset = changeableProjectile.LoadedShell.uiIconOffset,
                    iconDrawScale = GenUI.IconDrawScale(changeableProjectile.LoadedShell),
                    alsoClickIfOtherInGroupClicked = false,
                    action = delegate
                    {
                        GenPlace.TryPlaceThing(changeableProjectile.RemoveShell(), this.$this.Position, this.$this.Map, ThingPlaceMode.Near, null, null);
                    }
                });
            }
            if (this.CanSetForcedTarget)
            {
                Command_VerbTarget attack = new Command_VerbTarget();
                attack.defaultLabel = "CommandSetForceAttackTarget".Translate();
                attack.defaultDesc  = "CommandSetForceAttackTargetDesc".Translate();
                attack.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true);

                attack.verb   = this.AttackVerb;
                attack.hotKey = KeyBindingDefOf.Misc4;
                if (base.Spawned && this.IsMortarOrProjectileFliesOverhead && base.Position.Roofed(base.Map))
                {
                    attack.Disable("CannotFire".Translate() + ": " + "Roofed".Translate().CapitalizeFirst());
                }
                yield return(attack);
            }
            if (this.forcedTarget.IsValid)
            {
                Command_Action stop = new Command_Action();
                stop.defaultLabel = "CommandStopForceAttack".Translate();
                stop.defaultDesc  = "CommandStopForceAttackDesc".Translate();
                stop.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Halt", true);

                stop.action = delegate
                {
                    this.$this.ResetForcedTarget();
                    SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                };
                if (!this.forcedTarget.IsValid)
                {
                    stop.Disable("CommandStopAttackFailNotForceAttacking".Translate());
                }
                stop.hotKey = KeyBindingDefOf.Misc5;
                yield return(stop);
            }
            if (this.CanToggleHoldFire)
            {
                yield return(new Command_Toggle
                {
                    defaultLabel = "CommandHoldFire".Translate(),
                    defaultDesc = "CommandHoldFireDesc".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Commands/HoldFire", true),
                    hotKey = KeyBindingDefOf.Misc6,
                    toggleAction = delegate
                    {
                        this.$this.holdFire = !this.$this.holdFire;
                        if (this.$this.holdFire)
                        {
                            this.$this.ResetForcedTarget();
                        }
                    },
                    isActive = (() => this.$this.holdFire)
                });
            }
        }