Example #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);
        }
Example #2
0
        public virtual IEnumerable <Gizmo> GetGizmos()
        {
            yield return(new Command_Action
            {
                icon = ContentFinder <Texture2D> .Get("UI/Commands/RenameZone", true),
                defaultLabel = "CommandRenameZoneLabel".Translate(),
                defaultDesc = "CommandRenameZoneDesc".Translate(),
                action = delegate()
                {
                    Find.WindowStack.Add(new Dialog_RenameZone(this));
                },
                hotKey = KeyBindingDefOf.Misc1
            });

            yield return(new Command_Toggle
            {
                icon = ContentFinder <Texture2D> .Get("UI/Commands/HideZone", true),
                defaultLabel = ((!this.hidden) ? "CommandHideZoneLabel".Translate() : "CommandUnhideZoneLabel".Translate()),
                defaultDesc = "CommandHideZoneDesc".Translate(),
                isActive = (() => this.hidden),
                toggleAction = delegate()
                {
                    this.hidden = !this.hidden;
                    foreach (IntVec3 loc in this.Cells)
                    {
                        this.Map.mapDrawer.MapMeshDirty(loc, MapMeshFlag.Zone);
                    }
                },
                hotKey = KeyBindingDefOf.Misc2
            });

            foreach (Gizmo gizmo in this.GetZoneAddGizmos())
            {
                yield return(gizmo);
            }
            Designator delete = DesignatorUtility.FindAllowedDesignator <Designator_ZoneDelete_Shrink>();

            if (delete != null)
            {
                yield return(delete);
            }
            yield return(new Command_Action
            {
                icon = ContentFinder <Texture2D> .Get("UI/Buttons/Delete", true),
                defaultLabel = "CommandDeleteZoneLabel".Translate(),
                defaultDesc = "CommandDeleteZoneDesc".Translate(),
                action = new Action(this.Delete),
                hotKey = KeyBindingDefOf.Misc3
            });

            yield break;
        }
Example #3
0
 public virtual void RenderHighlight(List <IntVec3> dragCells)
 {
     DesignatorUtility.RenderHighlightOverSelectableThings(this, dragCells);
 }