public override IEnumerable <Gizmo> GetGizmos()
        {
            IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator();

            while (enumerator.MoveNext())
            {
                Gizmo current = enumerator.Current;
                yield return(current);
            }

            Command_Toggle toggleDef = new Command_Toggle();

            toggleDef.hotKey = KeyBindingDefOf.Command_TogglePower;
            toggleDef.icon   = ContentFinder <Texture2D> .Get("UI/Icons/Commands/Mute", true);

            toggleDef.defaultLabel = "Mute".Translate();
            toggleDef.defaultDesc  = "MuteDesc".Translate();
            toggleDef.isActive     = (() => this.isMuted);
            toggleDef.toggleAction = delegate
            {
                ToggleAction();
            };

            yield return(toggleDef);
        }
Example #2
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            if (!Prefs.DevMode)
            {
                yield break;
            }
            if (OnCooldown)
            {
                Command_Action command_Action = new Command_Action();
                command_Action.defaultLabel = "Dev: Reset cooldown";
                command_Action.action       = delegate
                {
                    lastInterceptTicks = Find.TickManager.TicksGame - Props.cooldownTicks;
                };
                yield return(command_Action);
            }
            Command_Toggle command_Toggle = new Command_Toggle();

            command_Toggle.defaultLabel = "Dev: Intercept non-hostile";
            command_Toggle.isActive     = () => debugInterceptNonHostileProjectiles;
            command_Toggle.toggleAction = delegate
            {
                debugInterceptNonHostileProjectiles = !debugInterceptNonHostileProjectiles;
            };
            yield return(command_Toggle);
        }
Example #3
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            Command_Toggle com = new Command_Toggle();

            com.hotKey       = KeyBindingDefOf.Misc5;
            com.defaultLabel = "Reconfigure";
            com.icon         = TexCommand.ToggleVent;
            com.isActive     = new Func <bool>(delegate { return(NeedToReconfigure); });
            com.toggleAction = delegate
            {
                NeedToReconfigure = !NeedToReconfigure;

                Designation des = parent.Map.designationManager.DesignationOn(parent, DesignationDefOf_Reconfigure.Reconfigure);
                if (NeedToReconfigure && des == null)
                {
                    parent.Map.designationManager.AddDesignation(new Designation(parent, DesignationDefOf_Reconfigure.Reconfigure));
                }
                else if (!NeedToReconfigure && des != null)
                {
                    des.Delete();
                }
            };
            if (NeedToReconfigure)
            {
                com.defaultDesc = "This building will be reconfigured by a researcher.";
            }
            else
            {
                com.defaultDesc = "This building will maintain its current function.";
            }
            yield return(com);
        }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            var armGizmo = new Command_Toggle {
                toggleAction = ArmGizmoAction,
                isActive     = () => desiredArmState,
                icon         = Resources.Textures.rxUIArm,
                defaultLabel = ArmButtonLabel,
                defaultDesc  = ArmButtonDesc,
                hotKey       = Resources.KeyBinging.rxArm
            };

            yield return(armGizmo);

            if (channelsComp != null)
            {
                channelsComp.Configure(true, false, false, RemoteTechUtility.GetChannelsUnlockLevel());
                var gz = channelsComp.GetChannelGizmo();
                if (gz != null)
                {
                    yield return(gz);
                }
            }

            if (replaceComp != null)
            {
                yield return(replaceComp.MakeGizmo());
            }

            if (DebugSettings.godMode)
            {
                yield return(new Command_Action {
                    action = () => {
                        if (isArmed)
                        {
                            Disarm();
                        }
                        else
                        {
                            Arm();
                        }
                    },
                    icon = Resources.Textures.rxUIArm,
                    defaultLabel = "DEV: Toggle armed"
                });

                yield return(new Command_Action {
                    action = () => {
                        Arm();
                        LightFuse();
                    },
                    icon = Resources.Textures.rxUIDetonate,
                    defaultLabel = "DEV: Detonate now"
                });
            }

            foreach (var g in base.GetGizmos())
            {
                yield return(g);
            }
        }
Example #5
0
            private static void VerbGiverExtended(ref IEnumerable <Gizmo> __result, Pawn_DraftController __instance)
            {
                List <Gizmo> gizmos           = new List <Gizmo>(__result); // normal gizmos
                List <Gizmo> toggleGizmos     = new List <Gizmo>();
                List <Gizmo> rangedVerbGizmos = new List <Gizmo>();

                // iterates over verbgivercomps
                foreach (HediffComp_VerbGiverExtended verbGiverExtended in __instance.pawn.health.hediffSet.GetAllComps().Where(c => c is HediffComp_VerbGiverExtended))
                {
                    // create a gizmo
                    Command_Toggle command_HediffToggle = new Command_Toggle
                    {
                        isActive     = () => verbGiverExtended.canAutoAttack,
                        toggleAction = () => verbGiverExtended.canAutoAttack = !verbGiverExtended.canAutoAttack,
                        defaultLabel = verbGiverExtended.Props.toggleLabel,
                        defaultDesc  = verbGiverExtended.Props.toggleDescription.CapitalizeFirst(),
                        icon         = PCF_VanillaExtender.GetIcon(verbGiverExtended.Pawn.GetUniqueLoadID() + "_" + verbGiverExtended.parent.GetUniqueLoadID(), verbGiverExtended.Props.toggleIconPath),
                        iconAngle    = verbGiverExtended.Props.toggleIconAngle,
                        iconOffset   = verbGiverExtended.Props.toggleIconOffset
                    };
                    if (__instance.pawn.Faction != Faction.OfPlayer)   // disable show on enemies
                    {
                        command_HediffToggle.Disable("CannotOrderNonControlled".Translate());
                    }
                    if (__instance.pawn.Downed)   // disable on downed
                    {
                        command_HediffToggle.Disable("IsIncapped".Translate(__instance.pawn.LabelShort, __instance.pawn));
                    }
                    toggleGizmos.Add(command_HediffToggle);   // add to list of toggles

                    // command to use verb
                    Command_HediffVerbRanged command_HediffVerbRanged = new Command_HediffVerbRanged
                    {
                        rangedComp   = verbGiverExtended,
                        defaultLabel = verbGiverExtended.rangedVerbLabel,
                        defaultDesc  = verbGiverExtended.rangedVerbDescription.CapitalizeFirst(),
                        icon         = PCF_VanillaExtender.GetIcon(verbGiverExtended.Pawn.GetUniqueLoadID() + "_" + verbGiverExtended.rangedVerb.loadID, verbGiverExtended.rangedVerbIconPath),
                        iconAngle    = verbGiverExtended.rangedVerbIconAngle,
                        iconOffset   = verbGiverExtended.rangedVerbIconOffset
                    };
                    if (__instance.pawn.Faction != Faction.OfPlayer)
                    {
                        command_HediffVerbRanged.Disable("CannotOrderNonControlled".Translate());
                    }
                    else if (__instance.pawn.IsColonist)
                    {
                        if (__instance.pawn.story.DisabledWorkTagsBackstoryAndTraits.HasFlag(WorkTags.Violent))
                        {
                            command_HediffVerbRanged.Disable("IsIncapableOfViolence".Translate(__instance.pawn.LabelShort, __instance.pawn));
                        }
                        else if (!__instance.pawn.drafter.Drafted)
                        {
                            command_HediffVerbRanged.Disable("IsNotDrafted".Translate(__instance.pawn.LabelShort, __instance.pawn));
                        }
                    }
                    rangedVerbGizmos.Add(command_HediffVerbRanged);
                }

                __result = gizmos.Concat(toggleGizmos).Concat(rangedVerbGizmos);
            }
Example #6
0
        public override IEnumerable <Gizmo> CompGetWornGizmosExtra()
        {
            foreach (Gizmo item in base.CompGetWornGizmosExtra())
            {
                yield return(item);
            }

            if (Pawn != null)
            {
                Command_Toggle command_Toggle = new Command_Toggle
                {
                    defaultLabel = "Hamefura_ToggleableHeadgearCommand_Label".Translate(Props.attachedHeadgearDef.label),
                    defaultDesc  = "Hamefura_ToggleableHeadgearCommand_Desc".Translate(Props.attachedHeadgearDef.label),
                    icon         = ContentFinder <Texture2D> .Get(Props.toggleUiIconPath),
                    isActive     = () => isHatOn,
                    toggleAction = delegate
                    {
                        isHatOn = !isHatOn;
                        Pawn.Drawer.renderer.graphics.ResolveApparelGraphics();
                    },
                    turnOffSound = null,
                    turnOnSound  = null
                };
                yield return(command_Toggle);
            }
        }
Example #7
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            foreach (Gizmo item in base.CompGetGizmosExtra())
            {
                yield return(item);
            }

            if (parent.Faction == Faction.OfPlayer)
            {
                var command_Toggle = new Command_Toggle
                {
                    hotKey       = KeyBindingDefOf.Command_TogglePower,
                    icon         = ContentFinder <Texture2D> .Get("UI/Commands/ToggleDining"),
                    defaultLabel = "CommandToggleDining".Translate(),
                    defaultDesc  = "CommandToggleDiningDesc".Translate(),
                    isActive     = () => allowDining,
                    toggleAction = ToggleDining
                };
                yield return(command_Toggle);
            }

            if (allowDining)
            {
                var command_SetDeco = new Command_Action
                {
                    hotKey       = KeyBindingDefOf.Misc2,
                    icon         = ContentFinder <Texture2D> .Get($"Things/DiningSpot/Center{DecoVariation}"),
                    defaultLabel = "CommandSetDeco".Translate(),
                    defaultDesc  = "CommandSetDecoDesc".Translate(),
                    action       = ChangeDeco
                };
                yield return(command_SetDeco);
            }
        }
Example #8
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            Command detonate;

            if (CanDetonateImmediately())
            {
                detonate = new Command_Action {
                    action       = DoDetonation,
                    defaultLabel = "Detonator_detonateNow_label".Translate(),
                };
            }
            else
            {
                detonate = new Command_Toggle {
                    toggleAction = DetonateToggleAction,
                    isActive     = () => wantDetonation,
                    defaultLabel = "DetonatorManual_detonate_label".Translate(),
                };
            }
            detonate.icon        = Resources.Textures.rxUIDetonateManual;
            detonate.defaultDesc = "DetonatorManual_detonate_desc".Translate();
            detonate.hotKey      = Resources.KeyBinging.rxRemoteTableDetonate;
            yield return(detonate);

            foreach (var g in base.GetGizmos())
            {
                yield return(g);
            }
        }
Example #9
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            Command_Toggle com = new Command_Toggle
            {
                hotKey       = KeyBindingDefOf.Command_TogglePower,
                defaultLabel = "CommandGatherSpotToggleLabel".Translate(),
                icon         = TexCommand.GatherSpotActive,
                isActive     = this.get_Active,
                toggleAction = delegate
                {
                    ((_003CCompGetGizmosExtra_003Ec__Iterator0) /*Error near IL_0083: stateMachine*/)._0024this.Active = !((_003CCompGetGizmosExtra_003Ec__Iterator0) /*Error near IL_0083: stateMachine*/)._0024this.Active;
                }
            };

            if (Active)
            {
                com.defaultDesc = "CommandGatherSpotToggleDescActive".Translate();
            }
            else
            {
                com.defaultDesc = "CommandGatherSpotToggleDescInactive".Translate();
            }
            yield return((Gizmo)com);

            /*Error: Unable to find new state assignment for yield return*/;
        }
Example #10
0
        private static Gizmo CreateGizmo_SearchAndDestroy_Ranged(Pawn_DraftController __instance)
        {
            string   disabledReason = "";
            bool     disabled       = false;
            PawnDuty duty           = __instance.pawn.mindState.duty;

            ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(__instance.pawn);

            if (__instance.pawn.Downed)
            {
                disabled       = true;
                disabledReason = "SD_Reason_Downed".Translate();
            }
            Gizmo gizmo = new Command_Toggle
            {
                defaultLabel   = "SD_Gizmo_Ranged_Label".Translate(),
                defaultDesc    = "SD_Gizmo_Ranged_Description".Translate(),
                hotKey         = KeyBindingDefOf.Command_ItemForbid,
                disabled       = disabled,
                order          = 10.6f,
                disabledReason = disabledReason,
                icon           = ContentFinder <Texture2D> .Get(("UI/" + "SearchAndDestroy_Gizmo_Ranged"), true),
                isActive       = () => pawnData.SD_enabled,
                toggleAction   = () =>
                {
                    pawnData.SD_enabled = !pawnData.SD_enabled;
                    __instance.pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, true);
                }
            };

            return(gizmo);
        }
Example #11
0
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     if (EmergencyPowerResearchCompleted)
     {
         Command_Toggle command = new Command_Toggle
         {
             isActive     = () => emergencyPowerEnabled,
             toggleAction = () =>
             {
                 emergencyPowerEnabled = !emergencyPowerEnabled;
             },
             icon         = Resources.emergencyPowerButtonTexture,
             defaultLabel = "CompRTPowerSwitch_EmergencyPowerToggle".Translate()
         };
         if (emergencyPowerEnabled)
         {
             command.defaultDesc = "CompRTPowerSwitch_EmergencyPowerOn".Translate();
         }
         else
         {
             command.defaultDesc = "CompRTPowerSwitch_EmergencyPowerOff".Translate();
         }
         yield return(command);
     }
 }
Example #12
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (var gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            var command_Toggle = new Command_Toggle
            {
                defaultLabel = "ZzZomboRW_AnimalCage_OutsidersToggleLabel".Translate(),
                defaultDesc  = "ZzZomboRW_AnimalCage_OutsidersToggleDesc".Translate(),
                icon         = ContentFinder <Texture2D> .Get("UI/Commands/ForPrisoners", true),
                isActive     = () => this.forPrisoners,
                toggleAction = delegate()
                {
                    var value = !this.forPrisoners;
                    (value ? SoundDefOf.Checkbox_TurnedOn : SoundDefOf.Checkbox_TurnedOff).PlayOneShotOnCamera(null);
                    this.SetForPrisoners(value);
                },
                hotKey       = KeyBindingDefOf.Misc3,
                turnOffSound = null,
                turnOnSound  = null
            };

            yield return(command_Toggle);

            yield break;
        }
Example #13
0
 public override IEnumerable <Gizmo> CompGetGizmosExtra()
 {
     if (Props.targetFuelLevelConfigurable)
     {
         Command_SetTargetFuelLevelMulti command_SetTargetFuelLevel = new Command_SetTargetFuelLevelMulti();
         command_SetTargetFuelLevel.refuelable   = this;
         command_SetTargetFuelLevel.defaultLabel = "3 CommandSetTargetFuelLevel".Translate();
         command_SetTargetFuelLevel.defaultDesc  = "3 CommandSetTargetFuelLevelDesc".Translate();
         command_SetTargetFuelLevel.icon         = SetTargetFuelLevelCommand;
         yield return(command_SetTargetFuelLevel);
     }
     if (Props.showFuelGizmo && Find.Selector.SingleSelectedThing == parent)
     {
         Gizmo_RefuelableFuelStatusMulti gizmo_RefuelableFuelStatus = new Gizmo_RefuelableFuelStatusMulti();
         gizmo_RefuelableFuelStatus.refuelable = this;
         yield return(gizmo_RefuelableFuelStatus);
     }
     if (Props.showAllowAutoRefuelToggle)
     {
         Command_Toggle command_Toggle = new Command_Toggle();
         command_Toggle.defaultLabel = "3 CommandToggleAllowAutoRefuel".Translate();
         command_Toggle.defaultDesc  = "3 CommandToggleAllowAutoRefuelDesc".Translate();
         command_Toggle.hotKey       = KeyBindingDefOf.Command_ItemForbid;
         command_Toggle.icon         = (allowAutoRefuel ? TexCommand.ForbidOff : TexCommand.ForbidOn);
         command_Toggle.isActive     = (() => allowAutoRefuel);
         command_Toggle.toggleAction = delegate
         {
             allowAutoRefuel = !allowAutoRefuel;
         };
         yield return(command_Toggle);
     }
 }
Example #14
0
    public override IEnumerable <Command> CompCommands()
    {
        Command_Toggle com = new Command_Toggle();

        com.hotKey       = KeyCode.F;
        com.icon         = ButtonIconForbidden;
        com.isActive     = () => !forbidden;
        com.toggleAction = () =>
        {
            forbidden = !forbidden;

            KnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Forbidding, KnowledgeAmount.SpecificInteraction);
        };

        if (forbidden)
        {
            com.defaultDesc = "CommandForbiddenDesc".Translate();
        }
        else
        {
            com.defaultDesc = "CommandNotForbiddenDesc".Translate();
        }
        com.groupKey          = 125691;
        com.tutorHighlightTag = "ToggleForbidden";

        yield return(com);
    }
Example #15
0
        private static Gizmo CreateGizmo_SearchAndDestroy(Pawn __instance, ExtendedPawnData pawnData)
        {
            string disabledReason = "";
            bool   disabled       = false;

            if (__instance.Downed)
            {
                disabled       = true;
                disabledReason = "WTH_Reason_MechanoidDowned".Translate();
            }
            else if (__instance.ShouldRecharge())
            {
                disabled       = true;
                disabledReason = "WTH_Reason_PowerLow".Translate();
            }
            else if (__instance.ShouldBeMaintained())
            {
                disabled       = true;
                disabledReason = "WTH_Reason_MaintenanceLow".Translate();
            }
            Gizmo gizmo = new Command_Toggle
            {
                defaultLabel   = "WTH_Gizmo_SearchAndDestroy_Label".Translate(),
                defaultDesc    = "WTH_Gizmo_SearchAndDestroy_Description".Translate(),
                disabled       = disabled,
                disabledReason = disabledReason,
                icon           = ContentFinder <Texture2D> .Get(("UI/" + "Enable_SD"), true),
                isActive       = () => pawnData.isActive,
                toggleAction   = () =>
                {
                    pawnData.isActive = !pawnData.isActive;
                    if (pawnData.isActive)
                    {
                        if (__instance.GetLord() == null || __instance.GetLord().LordJob == null)
                        {
                            LordMaker.MakeNewLord(Faction.OfPlayer, new LordJob_SearchAndDestroy(), __instance.Map, new List <Pawn> {
                                __instance
                            });
                        }
                        __instance.jobs.EndCurrentJob(JobCondition.InterruptForced);
                        if (__instance.relations == null) //Added here to fix existing saves.
                        {
                            __instance.relations = new Pawn_RelationsTracker(__instance);
                        }
                    }
                    else
                    {
                        __instance.jobs.EndCurrentJob(JobCondition.InterruptForced);
                        Building_BaseMechanoidPlatform closestAvailablePlatform = Utilities.GetAvailableMechanoidPlatform(__instance, __instance);
                        if (closestAvailablePlatform != null)
                        {
                            Job job = new Job(WTH_DefOf.WTH_Mechanoid_Rest, closestAvailablePlatform);
                            __instance.jobs.TryTakeOrderedJob(job);
                        }
                    }
                }
            };

            return(gizmo);
        }
Example #16
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo g in base.GetGizmos())
            {
                yield return(g);
            }
            Gizmo regenerateGizmo = new Command_Toggle
            {
                defaultLabel = "WTH_Gizmo_Regenerate_Label".Translate(),
                defaultDesc  = "WTH_Gizmo_Regenerate_Description".Translate(new object[] { MINFUELREGENERATE }),
                icon         = ContentFinder <Texture2D> .Get(("Things/Mote_HealingCrossGreen"), true),
                isActive     = () => regenerateActive,
                toggleAction = () =>
                {
                    regenerateActive = !regenerateActive;
                }
            };

            yield return(regenerateGizmo);

            Gizmo repairGizmo = new Command_Toggle
            {
                defaultLabel = "WTH_Gizmo_Repair_Label".Translate(),
                defaultDesc  = "WTH_Gizmo_Repair_Description".Translate(),
                icon         = ContentFinder <Texture2D> .Get(("Things/Mote_HealingCrossBlue"), true),
                isActive     = () => repairActive,
                toggleAction = () =>
                {
                    repairActive = !repairActive;
                }
            };

            yield return(repairGizmo);
        }
Example #17
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IEnumerator <Gizmo> enumerator = base.GetGizmos().GetEnumerator();

            while (enumerator.MoveNext())
            {
                Gizmo current = enumerator.Current;
                yield return(current);
            }

            if (isRadio && powerTrader != null)
            {
                Command_Toggle toggleDef = new Command_Toggle();
                toggleDef.hotKey = KeyBindingDefOf.Command_TogglePower;
                toggleDef.icon   = ContentFinder <Texture2D> .Get("UI/Icons/Commands/Autoplay", true);

                toggleDef.defaultLabel = "Autoplay";
                toggleDef.defaultDesc  = "Enables automatic playing of music through the radio.";
                toggleDef.isActive     = (() => this.autoPlay);
                toggleDef.toggleAction = delegate
                {
                    this.autoPlay = !this.autoPlay;
                };
                toggleDef.disabled = true;
                if (powerTrader.PowerOn)
                {
                    toggleDef.disabled = false;
                }
                yield return(toggleDef);
            }
            yield break;
        }
Example #18
0
        private Gizmo GetManagePowerNetworkGizmo()
        {
            Command_Toggle command = new Command_Toggle();

            command.defaultLabel = "WTH_Gizmo_ManagePowerNetwork_Label".Translate();
            command.defaultDesc  = "WTH_Gizmo_ManagePowerNetwork_Description".Translate();
            command.icon         = ContentFinder <Texture2D> .Get("UI/RogueAI_Manage_Network", true);

            command.disabled       = GlobalShouldDisable(out string reason);
            command.disabledReason = reason;
            if (DataLevelComp.curLevel < MINLEVELMANAGEPOWER)
            {
                command.disabled        = true;
                command.disabledReason += "\n- " + "WTH_Reason_LevelInsufficient".Translate(MINLEVELMANAGEPOWER);
            }
            command.isActive = delegate
            {
                return(managingPowerNetwork);
            };
            command.toggleAction = delegate
            {
                managingPowerNetwork = !managingPowerNetwork;
                //GoRogue();
            };
            return(command);
        }
Example #19
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo baseGizmo in base.GetGizmos())
            {
                yield return(baseGizmo);
            }

            if (this.CanSetForcedTarget)
            {
                {
                    Command_VerbPewPew attack = new Command_VerbPewPew();
                    attack.defaultLabel = "CommandSetForceAttackTarget".Translate();
                    attack.defaultDesc  = "CommandSetForceAttackTargetDesc".Translate();
                    attack.icon         = ContentFinder <Texture2D> .Get("UI/Commands/Attack", true);

                    attack.verb   = GunCompEq.PrimaryVerb;
                    attack.hotKey = KeyBindingDefOf.Misc4;
                    yield return(attack);
                }
                {
                    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.ResetForcedTarget();
                        SoundDefOf.TickLow.PlayOneShotOnCamera();
                    };
                    if (!this.forcedTarget.IsValid)
                    {
                        stop.Disable("CommandStopAttackFailNotForceAttacking".Translate());
                    }
                    stop.hotKey = KeyBindingDefOf.Misc5;
                    yield return(stop);
                }
            }

            if (this.CanToggleHoldFire)
            {
                Command_Toggle toggleHoldFire = new Command_Toggle();
                toggleHoldFire.defaultLabel = "CommandHoldFire".Translate();
                toggleHoldFire.defaultDesc  = "CommandHoldFireDesc".Translate();
                toggleHoldFire.icon         = ContentFinder <Texture2D> .Get("UI/Commands/HoldFire", true);

                toggleHoldFire.hotKey       = KeyBindingDefOf.Misc6;
                toggleHoldFire.toggleAction = delegate
                {
                    this.holdFire = !this.holdFire;
                    if (this.holdFire)
                    {
                        this.currentTargetInt     = LocalTargetInfo.Invalid;
                        this.burstWarmupTicksLeft = 0;
                    }
                };
                toggleHoldFire.isActive = (() => this.holdFire);
                yield return(toggleHoldFire);
            }
        }
Example #20
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (var g in base.GetGizmos())
            {
                yield return(g);
            }

            Command_Toggle com = new Command_Toggle();

            if (pather.Stopped)
            {
                com.defaultLabel = "Continue";
                com.defaultDesc  = "Click to continue the cart moving";
            }
            else
            {
                com.defaultLabel = "Stop";
                com.defaultDesc  = "Click to stop the cart";
            }
            com.groupKey = 13008961;
            //com.icon=
            com.isActive     = () => { return(pather.Stopped); };
            com.toggleAction = () => { pather.ToggleStopped(); };
            yield return(com);
        }
Example #21
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            if (parent == null)
            {
                yield break;
            }
            var pawn = parent as Pawn;

            if (SlaveUtility.IsPawnColonySlave(pawn))
            {
                var hediff = SlaveUtility.GetEnslavedHediff(pawn);

                var freeSlave = new Command_Toggle();
                freeSlave.isActive     = () => hediff.toBeFreed;
                freeSlave.defaultLabel = "LabelWordEmancipate".Translate();
                freeSlave.defaultDesc  = "CommandDescriptionEmancipate".Translate(pawn.Name.ToStringShort);
                freeSlave.toggleAction = () => hediff.toBeFreed = !hediff.toBeFreed;
                freeSlave.alsoClickIfOtherInGroupClicked = true;
                freeSlave.activateSound = SoundDefOf.Click;
                freeSlave.icon          = ContentFinder <Texture2D> .Get("UI/Commands/Emancipate", true);

                yield return(freeSlave);

                var shackleSlave = new Command_Toggle();
                shackleSlave.isActive     = () => hediff.shackledGoal;
                shackleSlave.defaultLabel = "LabelWordShackle".Translate();
                shackleSlave.defaultDesc  = "CommandDescriptionShackle".Translate(pawn.Name.ToStringShort);
                shackleSlave.toggleAction = () => hediff.shackledGoal = !hediff.shackledGoal;
                shackleSlave.alsoClickIfOtherInGroupClicked = true;
                shackleSlave.activateSound = SoundDefOf.Click;
                shackleSlave.icon          = ContentFinder <Texture2D> .Get("UI/Commands/Shackle", true);

                yield return(shackleSlave);
            }
        }
Example #22
0
        // ===================== Gizmos =====================
        public override IEnumerable <Gizmo> GetGizmos()
        {
            int groupKeyBase = 700000114;

            IList <Gizmo> buttonList = new List <Gizmo>();

            foreach (Gizmo gizmo in base.GetGizmos())
            {
                buttonList.Add(gizmo);
            }
            Command_Toggle allowFishingButton = new Command_Toggle();

            allowFishingButton.icon = ContentFinder <Texture2D> .Get(Util_FishIndustry.BluebladeTexturePath);

            allowFishingButton.defaultLabel = "FishIndustry.AllowFishingLabel".Translate();
            allowFishingButton.defaultDesc  = "FishIndustry.AllowFishingDesc".Translate();
            allowFishingButton.isActive     = (() => this.allowFishing);
            allowFishingButton.toggleAction = delegate
            {
                this.allowFishing = !this.allowFishing;
            };
            allowFishingButton.groupKey = groupKeyBase + 1;
            buttonList.Add(allowFishingButton);
            return(buttonList);
        }
 private static void AddIconReplacementSupport(Command_Toggle toggle, Designator standInDesignator)
 {
     if (AllowToolController.Instance.Handles.ReplaceIconsSetting.Value)
     {
         toggle.icon = standInDesignator.icon;
     }
 }
        //public override IEnumerable<Gizmo> GetGizmos()
        static void Postfix(Building_PlantGrower __instance, ref IEnumerable <Gizmo> __result)
        {
            if (!Mod.settings.zoneHarvestableToggle)
            {
                return;
            }

            List <Gizmo> result = new List <Gizmo>(__result);

            Gizmo harvestGizmo = new Command_Toggle
            {
                defaultLabel = "TD.AllowHarvesting".Translate(),
                defaultDesc  = "TD.AllowHarvestingDesc".Translate(),
                icon         = ContentFinder <UnityEngine.Texture2D> .Get("UI/Designators/Harvest", true),
                isActive     = (() => __instance.CanHarvest()),
                toggleAction = delegate
                {
                    __instance.ToggleHarvest();
                }
            };

            result.Add(harvestGizmo);

            // make caller use the list
            __result = result.AsEnumerable();
        }
        public static void EnhanceStockAllowToggle(Command_Toggle toggle)
        {
            var standInDesignator = toggle.isActive() ? allowDesignatorStandIn : forbidDesignatorStandIn;

            DesignatorContextMenuController.RegisterReverseDesignatorPair(standInDesignator, toggle);
            AddIconReplacementSupport(toggle, standInDesignator);
        }
        internal IEnumerable <Gizmo> GetGizmos()
        {
            Command_Toggle draft = new Command_Toggle();

            draft.hotKey       = KeyBindingDefOf.Command_ColonistDraft;
            draft.isActive     = new Func <bool>(this.get_Drafted);
            draft.toggleAction = delegate()
            {
                this.Drafted = !this.Drafted;
                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Drafting, KnowledgeAmount.SpecificInteraction);
                if (this.Drafted)
                {
                    LessonAutoActivator.TeachOpportunity(ConceptDefOf.QueueOrders, OpportunityType.GoodToKnow);
                }
            };
            draft.defaultDesc  = "CommandToggleDraftDesc".Translate();
            draft.icon         = TexCommand.Draft;
            draft.turnOnSound  = SoundDefOf.DraftOn;
            draft.turnOffSound = SoundDefOf.DraftOff;
            if (!this.Drafted)
            {
                draft.defaultLabel = "CommandDraftLabel".Translate();
            }
            if (this.pawn.Downed)
            {
                draft.Disable("IsIncapped".Translate(new object[]
                {
                    this.pawn.LabelShort
                }));
            }
            if (!this.Drafted)
            {
                draft.tutorTag = "Draft";
            }
            else
            {
                draft.tutorTag = "Undraft";
            }
            yield return(draft);

            if (this.Drafted && this.pawn.equipment.Primary != null && this.pawn.equipment.Primary.def.IsRangedWeapon)
            {
                yield return(new Command_Toggle
                {
                    hotKey = KeyBindingDefOf.Misc6,
                    isActive = new Func <bool>(this.get_FireAtWill),
                    toggleAction = delegate()
                    {
                        this.FireAtWill = !this.FireAtWill;
                    },
                    icon = TexCommand.FireAtWill,
                    defaultLabel = "CommandFireAtWillLabel".Translate(),
                    defaultDesc = "CommandFireAtWillDesc".Translate(),
                    tutorTag = "FireAtWillToggle"
                });
            }
            yield break;
        }
Example #27
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo g in base.GetGizmos())
            {
                yield return(g);
            }
            if (this.def.building.bed_humanlike && base.Faction == Faction.OfPlayer)
            {
                Command_Toggle pris = new Command_Toggle();
                pris.defaultLabel = "CommandBedSetForPrisonersLabel".Translate();
                pris.defaultDesc  = "CommandBedSetForPrisonersDesc".Translate();
                pris.icon         = ContentFinder <Texture2D> .Get("UI/Commands/ForPrisoners", true);

                pris.isActive     = new Func <bool>(this.get_ForPrisoners);
                pris.toggleAction = delegate()
                {
                    this.ToggleForPrisonersByInterface();
                };
                if (!Building_Bed.RoomCanBePrisonCell(this.GetRoom(RegionType.Set_Passable)) && !this.ForPrisoners)
                {
                    pris.Disable("CommandBedSetForPrisonersFailOutdoors".Translate());
                }
                pris.hotKey       = KeyBindingDefOf.Misc3;
                pris.turnOffSound = null;
                pris.turnOnSound  = null;
                yield return(pris);

                yield return(new Command_Toggle
                {
                    defaultLabel = "CommandBedSetAsMedicalLabel".Translate(),
                    defaultDesc = "CommandBedSetAsMedicalDesc".Translate(),
                    icon = ContentFinder <Texture2D> .Get("UI/Commands/AsMedical", true),
                    isActive = new Func <bool>(this.get_Medical),
                    toggleAction = delegate()
                    {
                        this.Medical = !this.Medical;
                    },
                    hotKey = KeyBindingDefOf.Misc2
                });

                if (!this.ForPrisoners && !this.Medical)
                {
                    yield return(new Command_Action
                    {
                        defaultLabel = "CommandBedSetOwnerLabel".Translate(),
                        icon = ContentFinder <Texture2D> .Get("UI/Commands/AssignOwner", true),
                        defaultDesc = "CommandBedSetOwnerDesc".Translate(),
                        action = delegate()
                        {
                            Find.WindowStack.Add(new Dialog_AssignBuildingOwner(this));
                        },
                        hotKey = KeyBindingDefOf.Misc3
                    });
                }
            }
            yield break;
        }
Example #28
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    if (!(this.parent is Building) || this.parent.Faction == Faction.OfPlayer)
                    {
                        com              = new Command_Toggle();
                        com.hotKey       = KeyBindingDefOf.Command_ItemForbid;
                        com.icon         = TexCommand.Forbidden;
                        com.isActive     = (() => !this.forbiddenInt);
                        com.defaultLabel = "CommandForbid".Translate();
                        if (this.forbiddenInt)
                        {
                            com.defaultDesc = "CommandForbiddenDesc".Translate();
                        }
                        else
                        {
                            com.defaultDesc = "CommandNotForbiddenDesc".Translate();
                        }
                        if (this.parent.def.IsDoor)
                        {
                            com.tutorTag     = "ToggleForbidden-Door";
                            com.toggleAction = delegate()
                            {
                                base.Forbidden = !base.Forbidden;
                                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.ForbiddingDoors, KnowledgeAmount.SpecificInteraction);
                            };
                        }
                        else
                        {
                            com.tutorTag     = "ToggleForbidden";
                            com.toggleAction = delegate()
                            {
                                base.Forbidden = !base.Forbidden;
                                PlayerKnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Forbidding, KnowledgeAmount.SpecificInteraction);
                            };
                        }
                        this.$current = com;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        return(true);
                    }
                    break;

                case 1u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            var armGizmo = new Command_Toggle {
                toggleAction = ArmGizmoAction,
                isActive     = () => desiredArmState,
                icon         = Resources.Textures.UIArm,
                defaultLabel = ArmButtonLabel,
                defaultDesc  = ArmButtonDesc,
                hotKey       = Resources.KeyBinging.RemoteExplosiveArm
            };

            yield return(armGizmo);

            if (RemoteExplosivesUtility.ChannelsUnlocked())
            {
                var channelGizmo = RemoteExplosivesUtility.MakeChannelGizmo(desiredChannel, currentChannel, ChannelGizmoAction);
                yield return(channelGizmo);
            }

            if (replaceComp != null)
            {
                yield return(replaceComp.MakeGizmo());
            }

            if (DebugSettings.godMode)
            {
                yield return(new Command_Action {
                    action = () => {
                        if (isArmed)
                        {
                            Disarm();
                        }
                        else
                        {
                            Arm();
                        }
                    },
                    icon = Resources.Textures.UIArm,
                    defaultLabel = "DEV: Toggle armed"
                });

                yield return(new Command_Action {
                    action = () => {
                        Arm();
                        LightFuse();
                    },
                    icon = Resources.Textures.UIDetonate,
                    defaultLabel = "DEV: Detonate now"
                });
            }

            foreach (var g in base.GetGizmos())
            {
                yield return(g);
            }
        }
 public CustomHoldOpenToggle(Command_Toggle orig, Building door)
 {
     defaultLabel = orig.defaultLabel;
     defaultDesc  = orig.defaultDesc;
     hotKey       = orig.hotKey;
     icon         = orig.icon;
     isActive     = orig.isActive;
     toggleAction = orig.toggleAction + HoldOpenOpensDoors;
     this.door    = door;
 }
Example #31
0
    public override IEnumerable<Command> CompCommands()
    {
        Command_Toggle com = new Command_Toggle();
        com.hotKey = KeyCode.F;
        com.defaultLabel = "CommandGatherSpotToggleLabel".Translate();
        com.icon = ButtonIconActive;
        com.isActive = ()=>Active;
        com.toggleAction = ()=>Active = !Active;
        com.groupKey = 61733;

        if( Active )
            com.defaultDesc = "CommandGatherSpotToggleDescActive".Translate();
        else
            com.defaultDesc = "CommandGatherSpotToggleDescInactive".Translate();

        yield return com;
    }
 public override IEnumerable<Gizmo> CompGetGizmosExtra()
 {
     Command_Toggle command = new Command_Toggle();
     command.isActive = () => sparklesEnabled;
     command.toggleAction = () => sparklesEnabled = !sparklesEnabled;
     command.groupKey = 02134657;
     command.icon = Resources.sparklesButtonTexture;
     command.defaultLabel = "CompRTQuantumStockpile_SparklesToggle".Translate();
     if (sparklesEnabled)
     {
         command.defaultDesc = "CompRTQuantumStockpile_SparklesAreOn".Translate();
     }
     else
     {
         command.defaultDesc = "CompRTQuantumStockpile_SparklesAreOff".Translate();
     }
     yield return command;
 }
        public override IEnumerable<Gizmo> GetGizmos()
        {
            foreach (var g in base.GetGizmos())
            {
                yield return g;
            }

            var l = new Command_Toggle
            {
                defaultLabel = ResourceBank.StringToggleAirflowLabel,
                defaultDesc = ResourceBank.StringToggleAirflowDesc,
                hotKey = KeyBindingDefOf.CommandItemForbid,
                icon = ResourceBank.UILock,
                groupKey = 912515,
                isActive = () => isLocked,
                toggleAction = () => isLocked = !isLocked
            };
            yield return l;
        }
Example #34
0
    public override IEnumerable<Command> CompCommands()
    {
        Command_Toggle com = new Command_Toggle();
        com.hotKey = KeyCode.F;
        com.icon = ButtonIconForbidden;
        com.isActive = ()=>!forbidden;
        com.toggleAction = ()=>
            {
                forbidden = !forbidden;

                KnowledgeDatabase.KnowledgeDemonstrated(ConceptDefOf.Forbidding, KnowledgeAmount.SpecificInteraction);
            };

        if( forbidden )
            com.defaultDesc = "CommandForbiddenDesc".Translate();
        else
            com.defaultDesc = "CommandNotForbiddenDesc".Translate();
        com.groupKey = 125691;
        com.tutorHighlightTag = "ToggleForbidden";

        yield return com;
    }
Example #35
0
        public override IEnumerable<Gizmo> GetGizmos()
        {
            foreach(var g in base.GetGizmos())
            {
                yield return g;
            }

            Command_Toggle com = new Command_Toggle();
            if(pather.Stopped)
            {
                com.defaultLabel="Continue";
                com.defaultDesc = "Click to continue the cart moving";
            }
            else
            {
                com.defaultLabel = "Stop";
                com.defaultDesc = "Click to stop the cart";
            }
            com.groupKey = 13008961;
            //com.icon=
            com.isActive = () => { return pather.Stopped; };
            com.toggleAction = () => { pather.ToggleStopped(); };
            yield return com;
        }
 public override IEnumerable<Command> CompGetGizmosExtra()
 {
     if( this.parent.Faction == Faction.OfPlayer )
     {
         var lockCommand = new Command_Toggle();
         lockCommand.defaultLabel = Data.Strings.DoorLockToggle.Translate();
         lockCommand.defaultDesc = Data.Strings.DoorLockToggleDesc.Translate();
         lockCommand.groupKey = 912515;
         //lockCommand.hotKey = KeyBindingDefOf.CommandItemForbid;
         lockCommand.icon = Data.Icons.Lock;
         lockCommand.isActive = () =>
         {
             return locked;
         };
         lockCommand.toggleAction = () =>
         {
             if( setLockState == locked )
             {
                 Locked = !Locked;
             }
             else
             {
                 Locked = locked;
             }
         };
         yield return lockCommand;
     }
     foreach( var baseCommand in base.CompGetGizmosExtra() )
     {
         yield return baseCommand;
     }
 }
Example #37
0
        public override IEnumerable<Command> CompGetGizmosExtra()
        {
            IEnumerator<Command> cmd = base.CompGetGizmosExtra().GetEnumerator();
            while (cmd.MoveNext())
            {
                yield return cmd.Current;
            }
            cmd.Dispose();

            if (this.parent.Faction == Faction.OfColony)
            {
                GasCompProperties GasCompProps = this.props as GasCompProperties;
                if ((GasCompProps != null) && GasCompProps.pressureToggleable)
                {
                    Command_Toggle togglePressure = new Command_Toggle();
                    //togglePressure.hotKey =
                    togglePressure.icon = CompGasTrader.ButtonIconDesireGas;
                    togglePressure.defaultLabel = "Toggle Pressure";
                    togglePressure.defaultDesc = "Activate heat transfer to Gas network: pressure and temperature will increase";
                    togglePressure.isActive = new Func<bool>(() =>
                    {
                        return this.wantTransfer;
                    });
                    togglePressure.toggleAction = new Action(() =>
                    {
                        this.wantTransfer = !this.wantTransfer;
                        FlickUtility.UpdateFlickDesignation(this.parent);
                    });
                    yield return togglePressure;
                }
            }
        }
 public override IEnumerable<Gizmo> GetGizmos()
 {
     Command_Toggle c = new Command_Toggle();
     c.isActive = () => stripBodies;
     c.toggleAction = () => stripBodies = !stripBodies;
     c.icon = ShirtIcon;
     c.defaultLabel = stripBodies ? "DontStripBodies".Translate() : "StripBodies".Translate();
     c.defaultDesc = stripBodies ? "DontStripBodiesDesc".Translate() : "StripBodiesDesc".Translate();
     c.groupKey = 1500055;
     yield return c;
 }
        public override IEnumerable<Gizmo> CompGetGizmosExtra()
        {
            Command_Toggle commandSparkles = new Command_Toggle();
            commandSparkles.isActive = () => sparklesEnabled;
            commandSparkles.toggleAction = () => sparklesEnabled = !sparklesEnabled;
            commandSparkles.groupKey = 95918723;
            commandSparkles.icon = Resources.sparklesButtonTexture;
            commandSparkles.defaultLabel = "CompRTQuantumRelay_SparklesToggle".Translate();
            if (sparklesEnabled)
            {
                commandSparkles.defaultDesc = "CompRTQuantumRelay_SparklesAreOn".Translate();
            }
            else
            {
                commandSparkles.defaultDesc = "CompRTQuantumRelay_SparklesAreOff".Translate();
            }
            yield return commandSparkles;

            Command_Action commandWarehousePrev = new Command_Action();
            commandWarehousePrev.icon = Resources.leftArrowTexture;
            commandWarehousePrev.groupKey = 56182375;
            commandWarehousePrev.defaultLabel = "CompRTQuantumRelay_WarehousePrevLabel".Translate();
            commandWarehousePrev.defaultDesc = "CompRTQuantumRelay_WarehousePrevDesc".Translate();
            commandWarehousePrev.action = delegate
            {
                registered = false;
                if (compWarehouse != null) compWarehouse.DeRegisterRelay(this);
                List<Zone> zones = parent.Map.zoneManager.AllZones;
                if (zones != null && zones.Count != 0)
                {
                    List<Zone_Stockpile> stockpileZones =
                        (from zone in zones
                         where zone.GetType() == typeof(Zone_Stockpile)
                         select zone as Zone_Stockpile).ToList();
                    if (stockpileZones != null && stockpileZones.Count != 0)
                    {
                        List<CompRTQuantumWarehouse> warehouses =
                            (from zone in stockpileZones
                             where zone.FindWarehouse() != null
                             select zone.FindWarehouse()).ToList();
                        if (warehouses != null && warehouses.Count != 0)
                        {
                            if (compWarehouse != null)
                            {
                                CompRTQuantumWarehouse warehouse = warehouses.Find((CompRTQuantumWarehouse t) => t == compWarehouse);
                                if (warehouse != null)
                                {
                                    int warehouseIndex = warehouses.FindIndex((CompRTQuantumWarehouse t) => t == compWarehouse);
                                    if (warehouseIndex == 0)
                                    {
                                        compWarehouse = warehouses[warehouses.Count - 1];
                                    }
                                    else
                                    {
                                        compWarehouse = warehouses[warehouseIndex - 1];
                                    }
                                }
                                else
                                {
                                    compWarehouse = warehouses.First();
                                }
                            }
                            else
                            {
                                compWarehouse = warehouses.First();
                            }
                        }
                    }
                }
            };
            yield return commandWarehousePrev;

            Command_Action commandWarehouseNext = new Command_Action();
            commandWarehouseNext.icon = Resources.rightArrowTexture;
            commandWarehouseNext.groupKey = 91915621;
            commandWarehouseNext.defaultLabel = "CompRTQuantumRelay_WarehouseNextLabel".Translate();
            commandWarehouseNext.defaultDesc = "CompRTQuantumRelay_WarehouseNextDesc".Translate();
            commandWarehouseNext.action = delegate
            {
                registered = false;
                if (compWarehouse != null) compWarehouse.DeRegisterRelay(this);
                List<Zone> zones = parent.Map.zoneManager.AllZones;
                if (zones != null && zones.Count != 0)
                {
                    List<Zone_Stockpile> stockpileZones =
                        (from zone in zones
                         where zone.GetType() == typeof(Zone_Stockpile)
                         select zone as Zone_Stockpile).ToList();
                    if (stockpileZones != null && stockpileZones.Count != 0)
                    {
                        List<CompRTQuantumWarehouse> warehouses =
                            (from zone in stockpileZones
                             where zone.FindWarehouse() != null
                             select zone.FindWarehouse()).ToList();
                        if (warehouses != null && warehouses.Count != 0)
                        {
                            if (compWarehouse != null)
                            {
                                CompRTQuantumWarehouse warehouse = warehouses.Find((CompRTQuantumWarehouse t) => t == compWarehouse);
                                if (warehouse != null)
                                {
                                    int warehouseIndex = warehouses.FindIndex((CompRTQuantumWarehouse t) => t == compWarehouse);
                                    if (warehouseIndex == warehouses.Count - 1)
                                    {
                                        compWarehouse = warehouses.First();
                                    }
                                    else
                                    {
                                        compWarehouse = warehouses[warehouseIndex + 1];
                                    }
                                }
                                else
                                {
                                    compWarehouse = warehouses.First();
                                }
                            }
                            else
                            {
                                compWarehouse = warehouses.First();
                            }
                        }
                    }
                }
            };
            yield return commandWarehouseNext;
        }
Example #40
0
 public override IEnumerable<Gizmo> GetGizmos()
 {
     if (base.GetGizmos() != null)
     {
         foreach (Gizmo c in base.GetGizmos())
         {
             yield return c;
         }
     }
     Command_Toggle a = new Command_Toggle();
     a.toggleAction = () =>
     {
         stripBodies = !stripBodies;
     };
     a.activateSound = SoundDefOf.Click;
     if (this.stripBodies)
     {
         a.defaultDesc = "Click to toggle off stripping bodies";
         a.defaultLabel = "Stripping bodies";
     }
     else
     {
         a.defaultDesc = "Click to toggle on stripping bodies";
         a.defaultLabel = "Not stripping bodies";
     }
     a.isActive = () => { return this.stripBodies; };
     a.hotKey = Keys.Named("CrematoriusToggleStripBodies");
     a.disabled = false;
     a.groupKey = 313740005;
     a.icon = this.ShirtIcon;
     yield return a;
 }
Example #41
0
        public override IEnumerable<Gizmo> GetGizmos()
        {
            //Hunt Gizmo is not needed.
            //foreach (var baseGizmo in base.GetGizmos())
            //    yield return baseGizmo;

            if (this.Faction == Faction.OfColony && IsMounted)
            {
                Command_Action dismountGizmo = new Command_Action();

                dismountGizmo.defaultLabel = "Dismount";
                dismountGizmo.icon = ContentFinder<Texture2D>.Get("UI/Commands/IconDismount");
                dismountGizmo.activateSound = SoundDef.Named("Click");
                dismountGizmo.defaultDesc = "Dismount";
                dismountGizmo.action = () => { this.Dismount(); };

                yield return dismountGizmo;

                Command_Toggle draftGizmo = new Command_Toggle();

                draftGizmo.hotKey = KeyBindingDefOf.CommandColonistDraft;
                draftGizmo.isActive = () => this.drafter.Drafted;
                draftGizmo.toggleAction = () =>
                {
                    this.drafter.Drafted = !this.drafter.Drafted;
                    ConceptDatabase.KnowledgeDemonstrated(ConceptDefOf.Drafting, KnowledgeAmount.SpecificInteraction);
                };
                draftGizmo.defaultDesc = Translator.Translate("CommandToggleDraftDesc");
                draftGizmo.icon = ContentFinder<Texture2D>.Get("UI/Commands/Draft", true);
                draftGizmo.turnOnSound = SoundDef.Named("DraftOn");
                draftGizmo.turnOffSound = SoundDef.Named("DraftOff");
                draftGizmo.defaultLabel = (!this.drafter.Drafted) ? Translator.Translate("CommandDraftLabel") : Translator.Translate("CommandUndraftLabel");
                if (this.drafter.pawn.Downed)
                {
                    Command_Toggle commandToggle = draftGizmo;
                    string key = "IsIncapped";
                    object[] objArray = new object[1];
                    int index = 0;
                    string nameStringShort = this.drafter.pawn.NameStringShort;
                    objArray[index] = (object)nameStringShort;
                    string reason = Translator.Translate(key, objArray);
                    commandToggle.Disable(reason);
                }
                draftGizmo.tutorHighlightTag = "ToggleDrafted";

                yield return draftGizmo;

                Designator_Move designator = new Designator_Move();

                designator.vehicle = this;
                designator.defaultLabel = "Move";
                designator.defaultDesc = "Move vehicle";
                designator.icon = ContentFinder<Texture2D>.Get("UI/Commands/IconMove");
                designator.activateSound = SoundDef.Named("Click");
                designator.hotKey = KeyBindingDefOf.Misc1;

                yield return designator;

                if (!turretGuns.NullOrEmpty())
                {
                    Designator_ForcedTarget designator2 = new Designator_ForcedTarget();

                    designator2.turretGuns = turretGuns;
                    designator2.defaultLabel = "Set forced target";
                    designator2.defaultDesc = "Set forced target";
                    designator2.icon = ContentFinder<Texture2D>.Get("UI/Commands/Attack");
                    designator2.activateSound = SoundDef.Named("Click");
                    designator2.hotKey = KeyBindingDefOf.Misc2;

                    yield return designator2;

                    Command_Action haltGizmo = new Command_Action();

                    haltGizmo.defaultLabel = "Stop forced target";
                    haltGizmo.icon = ContentFinder<Texture2D>.Get("UI/Commands/Halt");
                    haltGizmo.activateSound = SoundDef.Named("Click");
                    haltGizmo.defaultDesc = "Stop forced target ";
                    haltGizmo.action = () =>
                    {
                        foreach (Parts_TurretGun turretGun in turretGuns)
                            turretGun.forcedTarget = null;
                    };

                    yield return haltGizmo;
                }
            }
            else if (!IsMounted && this.Faction == Faction.OfColony)
            {
                Designator_Mount designator = new Designator_Mount();

                designator.vehicle = this;
                designator.mountPos = MountPos;
                designator.defaultLabel = "Mount";
                designator.defaultDesc = "Mount";
                designator.icon = ContentFinder<Texture2D>.Get("UI/Commands/IconMount");
                designator.activateSound = SoundDef.Named("Click");

                yield return designator;
            }
            else if (!IsMounted && this.Faction != Faction.OfColony)
            {
                Designator_Claim designatorClaim = new Designator_Claim();

                designatorClaim.vehicle = this;
                designatorClaim.defaultLabel = "Claim";
                designatorClaim.defaultDesc = "Claim";
                designatorClaim.icon = ContentFinder<Texture2D>.Get("UI/Commands/Claim");
                designatorClaim.activateSound = SoundDef.Named("Click");

                yield return designatorClaim;
            }

            if (this.Faction == Faction.OfColony && vehicleDef.vehicle.boardableNum > 0 && this.inventory.container.Count(x => x is Pawn) < vehicleDef.vehicle.boardableNum)
            {
                Designator_Board designatorBoard = new Designator_Board();

                designatorBoard.vehicle = this;
                designatorBoard.mountPos = MountPos;
                designatorBoard.defaultLabel = "Board";
                designatorBoard.defaultDesc = "Board";
                designatorBoard.icon = ContentFinder<Texture2D>.Get("UI/Commands/IconBoard");
                designatorBoard.activateSound = SoundDef.Named("Click");

                yield return designatorBoard;
            }

            if (this.Faction == Faction.OfColony && vehicleDef.vehicle.boardableNum > 0 && this.inventory.container.Count(x => x is Pawn) > 0)
            {
                Command_Action commandUnboardAll = new Command_Action();

                commandUnboardAll.defaultLabel = "UnboardAll";
                commandUnboardAll.defaultDesc = "UnboardAll";
                commandUnboardAll.icon = ContentFinder<Texture2D>.Get("UI/Commands/IconUnboardAll");
                commandUnboardAll.activateSound = SoundDef.Named("Click");
                commandUnboardAll.action = () => { this.UnboardAll(); };

                yield return commandUnboardAll;
            }
        }
 public override IEnumerable<Gizmo> CompGetGizmosExtra()
 {
     Command_Toggle commandSparkles = new Command_Toggle();
     commandSparkles.isActive = () => sparklesEnabled;
     commandSparkles.toggleAction = () => sparklesEnabled = !sparklesEnabled;
     commandSparkles.groupKey = 4719905;
     commandSparkles.icon = Resources.sparklesButtonTexture;
     commandSparkles.defaultLabel = "CompRTQuantumChunkSilo_SparklesToggle".Translate();
     if (sparklesEnabled)
     {
         commandSparkles.defaultDesc = "CompRTQuantumChunkSilo_SparklesAreOn".Translate();
     }
     else
     {
         commandSparkles.defaultDesc = "CompRTQuantumChunkSilo_SparklesAreOff".Translate();
     }
     yield return commandSparkles;
 }
 public override IEnumerable<Gizmo> GetGizmos()
 {
     Command_Toggle com = new Command_Toggle();
     if (isActive)
     {
         com.defaultDesc = "Click to deactivate this building";
         com.defaultLabel = "Active";
         com.icon = Icon;
     }
     else
     {
         com.icon = Icon;
         com.defaultLabel = "Not active";
         com.defaultDesc = "Click to activate this building";
     }
     com.disabled = false;
     com.groupKey = 313740004;
     com.hotKey = Keys.BuildingOnOffToggle;
     com.toggleAction = () =>
         {
             this.isActive = !this.isActive;
         };
     com.isActive = () => { return this.isActive; };
     yield return com;
     com = new Command_Toggle();
     if (takingResources)
     {
         com.defaultDesc = "Click to stop this building from taking fuel";
         com.defaultLabel = "Fuel intake enabled";
         com.icon = Icon;
     }
     else
     {
         com.icon = Icon;
         com.defaultLabel = "Fuel intake disabled";
         com.defaultDesc = "Click to this building to take fuel";
     }
     com.disabled = false;
     com.groupKey = 313740005;
     com.hotKey = Keys.Named("CoalPowerToggleFuelConsume");
     com.toggleAction = () =>
     {
         this.takingResources = !this.takingResources;
     };
     com.isActive = () => { return this.takingResources; };
     yield return com;
     foreach (Command c in base.GetGizmos())
     {
         yield return c;
     }
 }