예제 #1
0
        // Token: 0x06001B6D RID: 7021 RVA: 0x000A8BD0 File Offset: 0x000A6DD0
        public override void MergeWith(Gizmo other)
        {
            return;

            base.MergeWith(other);
            Command_CompTurretVerbTarget command_VerbTarget = other as Command_CompTurretVerbTarget;

            if (command_VerbTarget == null)
            {
                Log.ErrorOnce("Tried to merge Command_VerbTarget with unexpected type", 73406263, false);
                return;
            }
            if (this.groupedVerbs == null)
            {
                this.groupedVerbs = new List <Verb>();
            }
            this.groupedVerbs.Add(command_VerbTarget.verb);
            if (command_VerbTarget.groupedVerbs != null)
            {
                this.groupedVerbs.AddRange(command_VerbTarget.groupedVerbs);
            }
        }
예제 #2
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            if (Building != null || Pawn != null)
            {
                int  num  = 600000000;
                bool flag = Find.Selector.SelectedObjects.Contains(Operator);
                if (flag && (Operator.Faction == Faction.OfPlayer || (Prefs.DevMode && DebugSettings.godMode)))
                {
                    Texture2D CommandTex;
                    if (!active && !Props.iconPathToggled.NullOrEmpty())
                    {
                        CommandTex = ContentFinder <Texture2D> .Get(Props.iconPathToggled, true);

                        //	CommandTex = ContentFinder<Texture2D>.Get("Ui/Commands/CommandButton_TurretModeOn", true);
                    }
                    else
                    {
                        CommandTex = ContentFinder <Texture2D> .Get(Props.iconPath, true);

                        //	CommandTex = ContentFinder<Texture2D>.Get("Ui/Commands/CommandButton_TurretModeOff", true);
                    }
                    CommandTex = ContentFinder <Texture2D> .Get(Props.iconPath, true);

                    yield return(new Command_ToggleCompTurret(this)
                    {
                        icon = CommandTex,
                        defaultLabel = Props.TurretDef.building.turretGunDef.LabelCap + (active ? " turret: on." : " turret: off."),
                        defaultDesc = "Switch mode.",
                        isActive = (() => active),
                        toggleAction = delegate()
                        {
                            active = !active;
                        },
                        activateSound = SoundDef.Named("Click"),
                        groupKey = num + Props.gizmoID,

                        /*
                         * disabled = GetWearer.stances.curStance.StanceBusy,
                         * disabledReason = "Busy"
                         */
                    });
                }

                if (this.CanSetForcedTarget && active)
                {
                    num += 100;
                    Command_CompTurretVerbTarget command_VerbTarget = new Command_CompTurretVerbTarget();
                    command_VerbTarget.defaultLabel = Props.TurretDef.building.turretGunDef.LabelCap + " " + "CommandSetForceAttackTarget".Translate();
                    command_VerbTarget.defaultDesc  = "CommandSetForceAttackTargetDesc".Translate();
                    command_VerbTarget.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true);

                    command_VerbTarget.verb       = this.AttackVerb;
                    command_VerbTarget.gunTurret  = this;
                    command_VerbTarget.hotKey     = Props.hotKey;
                    command_VerbTarget.drawRadius = true;
                    command_VerbTarget.groupKey   = num + Props.gizmoID;
                    if (Operator.Spawned && this.IsMortarOrProjectileFliesOverhead && Operator.Position.Roofed(Operator.Map))
                    {
                        command_VerbTarget.Disable("CannotFire".Translate() + ": " + "Roofed".Translate().CapitalizeFirst());
                    }
                    if (Operator.Spawned && Stunned)
                    {
                        command_VerbTarget.Disable("CannotFire".Translate() + ": " + "EMPDisabled".Translate().CapitalizeFirst());
                    }

                    /*
                     * command_VerbTarget.action = delegate (LocalTargetInfo target)
                     * {
                     *      this.OrderForceTarget(target);
                     * };
                     */
                    yield return(command_VerbTarget);
                }
                if (this.forcedTarget.IsValid)
                {
                    num += 100;
                    Command_Action command_Action = new Command_Action();
                    command_Action.defaultLabel = Props.TurretDef.building.turretGunDef.LabelCap + " " + "CommandStopForceAttack".Translate();
                    command_Action.defaultDesc  = "CommandStopForceAttackDesc".Translate();
                    command_Action.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Halt", true);

                    command_Action.groupKey = num + Props.gizmoID;
                    command_Action.action   = delegate()
                    {
                        this.ResetForcedTarget();
                        SoundDefOf.Tick_Low.PlayOneShotOnCamera(null);
                    };
                    if (!this.forcedTarget.IsValid)
                    {
                        command_Action.Disable("CommandStopAttackFailNotForceAttacking".Translate());
                    }
                    command_Action.hotKey = KeyBindingDefOf.Misc5;
                    yield return(command_Action);
                }
                if (this.CanToggleHoldFire)
                {
                    num += 100;
                    yield return(new Command_Toggle
                    {
                        defaultLabel = "CommandHoldFire".Translate(),
                        defaultDesc = "CommandHoldFireDesc".Translate(),
                        icon = ContentFinder <Texture2D> .Get("UI/Commands/HoldFire", true),
                        hotKey = KeyBindingDefOf.Misc6,
                        groupKey = num + Props.gizmoID,
                        toggleAction = delegate()
                        {
                            this.holdFire = !this.holdFire;
                            if (this.holdFire)
                            {
                                this.ResetForcedTarget();
                            }
                        },
                        isActive = (() => this.holdFire)
                    });
                }
                if (this.UseAmmo)
                {
                    bool drafted = this.OperatorPawn?.Drafted ?? Operator.Faction == Faction.OfPlayerSilentFail;
                    if ((drafted && !this.Props.displayGizmoWhileDrafted) || (!drafted && !this.Props.displayGizmoWhileUndrafted))
                    {
                        yield break;
                    }

                    /*
                     * ThingWithComps gear = this.parent;
                     * foreach (Verb verb in this.GunCompEq.VerbTracker.AllVerbs)
                     * {
                     *      if (verb.verbProps.hasStandardCommand)
                     *      {
                     *              yield return this.CreateVerbTargetCommand(gear, verb);
                     *      }
                     * }
                     */

                    if (Prefs.DevMode)
                    {
                        yield return(new Command_Action
                        {
                            defaultLabel = Props.TurretDef.building.turretGunDef.LabelCap + " " + "Debug: Reload to full",

                            action = delegate()
                            {
                                this.remainingCharges = this.MaxCharges;
                            }
                        });
                    }
                }
            }
        }