Beispiel #1
0
        public virtual IEnumerable <Gizmo> GetGizmos()
        {
            Command_Action command_Action = new Command_Action();

            command_Action.icon = ContentFinder <Texture2D> .Get("UI/Commands/RenameZone");

            command_Action.defaultLabel = "CommandRenameZoneLabel".Translate();
            command_Action.defaultDesc  = "CommandRenameZoneDesc".Translate();
            command_Action.action       = delegate
            {
                Dialog_RenameZone dialog_RenameZone = new Dialog_RenameZone(this);
                if (KeyBindingDefOf.Misc1.IsDown)
                {
                    dialog_RenameZone.WasOpenedByHotkey();
                }
                Find.WindowStack.Add(dialog_RenameZone);
            };
            command_Action.hotKey = KeyBindingDefOf.Misc1;
            yield return(command_Action);

            Command_Toggle command_Toggle = new Command_Toggle();

            command_Toggle.icon = ContentFinder <Texture2D> .Get("UI/Commands/HideZone");

            command_Toggle.defaultLabel = (hidden ? "CommandUnhideZoneLabel".Translate() : "CommandHideZoneLabel".Translate());
            command_Toggle.defaultDesc  = "CommandHideZoneDesc".Translate();
            command_Toggle.isActive     = (() => hidden);
            command_Toggle.toggleAction = delegate
            {
                hidden = !hidden;
                foreach (IntVec3 cell in Cells)
                {
                    Map.mapDrawer.MapMeshDirty(cell, MapMeshFlag.Zone);
                }
            };
            command_Toggle.hotKey = KeyBindingDefOf.Misc2;
            yield return(command_Toggle);

            foreach (Gizmo zoneAddGizmo in GetZoneAddGizmos())
            {
                yield return(zoneAddGizmo);
            }
            Designator designator = DesignatorUtility.FindAllowedDesignator <Designator_ZoneDelete_Shrink>();

            if (designator != null)
            {
                yield return(designator);
            }
            Command_Action command_Action2 = new Command_Action();

            command_Action2.icon         = TexButton.DeleteX;
            command_Action2.defaultLabel = "CommandDeleteZoneLabel".Translate();
            command_Action2.defaultDesc  = "CommandDeleteZoneDesc".Translate();
            command_Action2.action       = Delete;
            command_Action2.hotKey       = KeyBindingDefOf.Designator_Deconstruct;
            yield return(command_Action2);
        }
Beispiel #2
0
        public IEnumerable <Gizmo> GetGizmos()
        {
            if (!pawn.IsColonistPlayerControlled || !pawn.Drafted || Find.Selector.SingleSelectedThing != pawn || pawn.IsTeetotaler())
            {
                yield break;
            }
            usableDrugsTmp.Clear();
            foreach (Thing drug3 in GetDrugs())
            {
                if (FoodUtility.WillIngestFromInventoryNow(pawn, drug3))
                {
                    usableDrugsTmp.Add(drug3);
                }
            }
            if (usableDrugsTmp.Count == 0)
            {
                yield break;
            }
            if (usableDrugsTmp.Count == 1)
            {
                Thing          drug           = usableDrugsTmp[0];
                Command_Action command_Action = new Command_Action();
                command_Action.defaultLabel = "ConsumeThing".Translate(drug.LabelNoCount, drug);
                command_Action.defaultDesc  = drug.LabelCapNoCount + ": " + drug.def.description.CapitalizeFirst();
                command_Action.icon         = drug.def.uiIcon;
                command_Action.iconAngle    = drug.def.uiIconAngle;
                command_Action.iconOffset   = drug.def.uiIconOffset;
                command_Action.action       = delegate
                {
                    FoodUtility.IngestFromInventoryNow(pawn, drug);
                };
                yield return(command_Action);

                yield break;
            }
            Command_Action command_Action2 = new Command_Action();

            command_Action2.defaultLabel = "TakeDrug".Translate();
            command_Action2.defaultDesc  = "TakeDrugDesc".Translate();
            command_Action2.icon         = DrugTex;
            command_Action2.action       = delegate
            {
                List <FloatMenuOption> list = new List <FloatMenuOption>();
                foreach (Thing drug2 in usableDrugsTmp)
                {
                    list.Add(new FloatMenuOption("ConsumeThing".Translate(drug2.LabelNoCount, drug2), delegate
                    {
                        FoodUtility.IngestFromInventoryNow(pawn, drug2);
                    }));
                }
                Find.WindowStack.Add(new FloatMenu(list));
            };
            yield return(command_Action2);
        }
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    if ((base.IsPrioritized || (this.pawn.CurJob != null && this.pawn.CurJob.playerForced) || this.pawn.jobs.jobQueue.AnyPlayerForced) && !this.pawn.Drafted)
                    {
                        Command_Action c = new Command_Action();
                        c.defaultLabel  = "CommandClearPrioritizedWork".Translate();
                        c.defaultDesc   = "CommandClearPrioritizedWorkDesc".Translate();
                        c.icon          = TexCommand.ClearPrioritizedWork;
                        c.activateSound = SoundDefOf.Tick_Low;
                        c.action        = delegate()
                        {
                            base.ClearPrioritizedWorkAndJobQueue();
                            if (this.pawn.CurJob.playerForced)
                            {
                                this.pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, true);
                            }
                        };
                        c.hotKey      = KeyBindingDefOf.Designator_Cancel;
                        c.groupKey    = 6165612;
                        this.$current = c;
                        if (!this.$disposing)
                        {
                            this.$PC = 1;
                        }
                        return(true);
                    }
                    break;

                case 1u:
                    break;

                default:
                    return(false);
                }
                this.$PC = -1;
                return(false);
            }
Beispiel #4
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            Command_Action command_Action = new Command_Action();

            command_Action.defaultLabel = "CommandCancelConstructionLabel".Translate();
            command_Action.defaultDesc  = "CommandCancelConstructionDesc".Translate();
            command_Action.icon         = ContentFinder <Texture2D> .Get("UI/Designators/Cancel");

            command_Action.hotKey = KeyBindingDefOf.Designator_Cancel;
            command_Action.action = delegate
            {
                Destroy(DestroyMode.Cancel);
            };
            yield return(command_Action);
        }
Beispiel #5
0
 public IEnumerable <Gizmo> GetGizmos()
 {
     if ((IsPrioritized || (pawn.CurJob != null && pawn.CurJob.playerForced) || pawn.jobs.jobQueue.AnyPlayerForced) && !pawn.Drafted)
     {
         Command_Action command_Action = new Command_Action();
         command_Action.defaultLabel  = "CommandClearPrioritizedWork".Translate();
         command_Action.defaultDesc   = "CommandClearPrioritizedWorkDesc".Translate();
         command_Action.icon          = TexCommand.ClearPrioritizedWork;
         command_Action.activateSound = SoundDefOf.Tick_Low;
         command_Action.action        = delegate
         {
             ClearPrioritizedWorkAndJobQueue();
             if (pawn.CurJob.playerForced)
             {
                 pawn.jobs.EndCurrentJob(JobCondition.InterruptForced);
             }
         };
         command_Action.hotKey   = KeyBindingDefOf.Designator_Cancel;
         command_Action.groupKey = 6165612;
         yield return(command_Action);
     }
 }
        // Token: 0x06000008 RID: 8 RVA: 0x000022A8 File Offset: 0x000004A8
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            bool flag = Find.Selector.SingleSelectedThing == GetWearer;

            if (flag)
            {
                int            num            = 700000101;
                Command_Action command_Action = new Command_Action();
                switch (this.lightMode)
                {
                case CompEquippableLight.LightMode.Automatic:
                    command_Action.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_LigthModeAutomatic", true);

                    command_Action.defaultLabel = "Ligth: automatic.";
                    break;

                case CompEquippableLight.LightMode.ForcedOn:
                    command_Action.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_LigthModeForcedOn", true);

                    command_Action.defaultLabel = "Ligth: on.";
                    break;

                case CompEquippableLight.LightMode.ForcedOff:
                    command_Action.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_LigthModeForcedOff", true);

                    command_Action.defaultLabel = "Ligth: off.";
                    break;
                }
                command_Action.defaultDesc   = "Switch mode.";
                command_Action.activateSound = SoundDef.Named("Click");
                command_Action.action        = new Action(this.SwitchLigthMode);
                command_Action.groupKey      = num + 1;

                yield return(command_Action);
            }
            yield break;
        }
Beispiel #7
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:
                    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();
                        }
                    }
                }
                Command_Action com = new Command_Action();

                com.defaultLabel = "CommandCancelConstructionLabel".Translate();
                com.defaultDesc  = "CommandCancelConstructionDesc".Translate();
                com.icon         = ContentFinder <Texture2D> .Get("UI/Designators/Cancel", true);

                com.hotKey = KeyBindingDefOf.Designator_Cancel;
                com.action = delegate()
                {
                    this.Destroy(DestroyMode.Cancel);
                };
                this.$current = com;
                if (!this.$disposing)
                {
                    this.$PC = 2;
                }
                return(true);
            }