// ######## Gizmos ######## //

        public override IEnumerable<Gizmo> GetGizmos()
        {
            int groupKeyBase = 700000300;

            List<Gizmo> gizmoList = new List<Gizmo>();
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                gizmoList.Add(gizmo);
            }
            if (this.Faction != Faction.OfPlayer)
            {
                return gizmoList;
            }

            Command_Action applyPlantDefToWholeRoomGizmo = new Command_Action();
            applyPlantDefToWholeRoomGizmo.icon = applyToWholeRoomGizmoIcon;
            applyPlantDefToWholeRoomGizmo.defaultDesc = "Order to grow the same kind of plant in all hydroponics basins in this room.";
            applyPlantDefToWholeRoomGizmo.defaultLabel = "Apply to whole room."; 
            applyPlantDefToWholeRoomGizmo.activateSound = SoundDef.Named("Click");
            applyPlantDefToWholeRoomGizmo.action = new Action(ApplyPlantDefToWholeRoom);
            applyPlantDefToWholeRoomGizmo.groupKey = groupKeyBase + 1;
            gizmoList.Add(applyPlantDefToWholeRoomGizmo);

            return gizmoList;
        }
Beispiel #2
0
 public static void DrawInspectGizmoGridFor(IEnumerable <object> selectedObjects, out Gizmo mouseoverGizmo)
 {
     mouseoverGizmo = null;
     try
     {
         objList.Clear();
         objList.AddRange(selectedObjects);
         gizmoList.Clear();
         for (int i = 0; i < objList.Count; i++)
         {
             ISelectable selectable = objList[i] as ISelectable;
             if (selectable != null)
             {
                 gizmoList.AddRange(selectable.GetGizmos());
             }
         }
         for (int j = 0; j < objList.Count; j++)
         {
             Thing t = objList[j] as Thing;
             if (t == null)
             {
                 continue;
             }
             List <Designator> allDesignators = Find.ReverseDesignatorDatabase.AllDesignators;
             for (int k = 0; k < allDesignators.Count; k++)
             {
                 Designator des = allDesignators[k];
                 if (!des.CanDesignateThing(t).Accepted)
                 {
                     continue;
                 }
                 Command_Action command_Action = new Command_Action();
                 command_Action.defaultLabel = des.LabelCapReverseDesignating(t);
                 command_Action.icon         = des.IconReverseDesignating(t, out var angle, out var offset);
                 command_Action.iconAngle    = angle;
                 command_Action.iconOffset   = offset;
                 command_Action.defaultDesc  = des.DescReverseDesignating(t);
                 command_Action.order        = ((des is Designator_Uninstall) ? (-11f) : (-20f));
                 command_Action.action       = delegate
                 {
                     if (TutorSystem.AllowAction(des.TutorTagDesignate))
                     {
                         des.DesignateThing(t);
                         des.Finalize(somethingSucceeded: true);
                     }
                 };
                 command_Action.hotKey   = des.hotKey;
                 command_Action.groupKey = des.groupKey;
                 gizmoList.Add(command_Action);
             }
         }
         objList.Clear();
         GizmoGridDrawer.DrawGizmoGrid(gizmoList, InspectPaneUtility.PaneWidthFor(Find.WindowStack.WindowOfType <IInspectPane>()) + GizmoGridDrawer.GizmoSpacing.y, out mouseoverGizmo);
         gizmoList.Clear();
     }
     catch (Exception ex)
     {
         Log.ErrorOnce(ex.ToString(), 3427734);
     }
 }
        public override IEnumerable<Gizmo> GetGizmos()
        {
            // Default gizmos
            foreach( Gizmo curGizmo in base.GetGizmos() )
            {
                yield return curGizmo;
            }

            // Grow zone gizmo
            var comActGrowZone = new Command_Action();
            if( comActGrowZone != null )
            {
                comActGrowZone.icon = Icon.GrowZone;
                comActGrowZone.defaultLabel = "CommandSunLampMakeGrowingZoneLabel".Translate();
                comActGrowZone.defaultDesc = "CommandSunLampMakeGrowingZoneDesc".Translate();
                comActGrowZone.activateSound = SoundDef.Named( "Click" );
                comActGrowZone.action = new Action( MakeMatchingGrowZone );
                if( comActGrowZone.action != null )
                {
                    yield return comActGrowZone;
                }
            }

            // No more gizmos
            yield break;
        }
Beispiel #4
0
        public override IEnumerable<Gizmo> GetGizmos()
        {
            foreach (var gizmo in base.GetGizmos())
                yield return gizmo;

            var gizmo_copySettings = new Command_Action
            {
                defaultDesc = "Copy dummy's settings",
                defaultLabel = "Copy Settings",
                icon = ContentFinder<Texture2D>.Get("UI/Commands/CopySettings"),
                activateSound = SoundDef.Named("Click"),
                action = CopySettings
            };
            yield return gizmo_copySettings;

            var gizmo_pasteSettings = new Command_Action
            {
                defaultDesc = "Paste dummy's settings",
                defaultLabel = "Paste Settings",
                icon = ContentFinder<Texture2D>.Get("UI/Commands/PasteSettings"),
                activateSound = SoundDef.Named("Click"),
                action = PasteSettings
            };
            yield return gizmo_pasteSettings;
        }
Beispiel #5
0
        public override IEnumerable <Command> GetCommands()
        {
            IList <Command> list           = new List <Command>();
            Command_Action  command_Action = new Command_Action();

            if (powerComp.PowerOn && Toggle)
            {
                command_Action.icon        = HoloBase.UI_Pon;
                command_Action.defaultDesc = "On";
            }

            if (!Toggle || !powerComp.PowerOn)
            {
                command_Action.icon        = HoloBase.UI_Poff;
                command_Action.defaultDesc = "Off";
            }

            command_Action.activateSound = SoundDef.Named("Click");
            command_Action.action        = new Action(ToggleStatus);
            command_Action.groupKey      = 887767441;
            list.Add(command_Action);
            IEnumerable <Command> commands = base.GetCommands();

            return((commands == null) ? list.AsEnumerable <Command>() : list.AsEnumerable <Command>().Concat(commands));
        }
Beispiel #6
0
        // ===================== Gizmos =====================
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IList <Gizmo> buttonList   = new List <Gizmo>();
            int           groupKeyBase = 700000106;

            if (this.repairsAreStarted == false)
            {
                Command_Action startRepairsButton = new Command_Action();
                startRepairsButton.icon = ContentFinder <Texture2D> .Get("Things/Item/Resource/Medicine/MedicineUltratech/MedicineUltratech_a");

                startRepairsButton.defaultLabel  = "Start repairs";
                startRepairsButton.defaultDesc   = "Click to transfer repair materials to the spaceship. Make sure the materials are stockpiled near the spaceship. Your colonists will then be able to repair the spaceship.";
                startRepairsButton.activateSound = SoundDef.Named("Click");
                startRepairsButton.action        = new Action(TryStartRepairs);
                startRepairsButton.groupKey      = groupKeyBase + 1;
                buttonList.Add(startRepairsButton);
            }

            IEnumerable <Gizmo> resultButtonList;
            IEnumerable <Gizmo> basebuttonList = base.GetGizmos();

            if (basebuttonList != null)
            {
                resultButtonList = basebuttonList.Concat(buttonList);
            }
            else
            {
                resultButtonList = buttonList;
            }
            return(resultButtonList);
        }
Beispiel #7
0
 public override IEnumerable <Gizmo> GetGizmos()
 {
     foreach (Gizmo g in base.GetGizmos())
     {
         yield return(g);
     }
     if (this.TraderKind != null)
     {
         yield return(new Command_Action
         {
             defaultLabel = "CommandShowSellableItems".Translate(),
             defaultDesc = "CommandShowSellableItemsDesc".Translate(),
             icon = SettlementBase.ShowSellableItemsCommand,
             action = delegate()
             {
                 Find.WindowStack.Add(new Dialog_SellableItems(this.TraderKind));
             }
         });
     }
     if (base.Faction != Faction.OfPlayer && !PlayerKnowledgeDatabase.IsComplete(ConceptDefOf.FormCaravan))
     {
         Command_Action formCaravan = new Command_Action();
         formCaravan.defaultLabel = "CommandFormCaravan".Translate();
         formCaravan.defaultDesc  = "CommandFormCaravanDesc".Translate();
         formCaravan.icon         = SettlementBase.FormCaravanCommand;
         formCaravan.action       = delegate()
         {
             Find.Tutor.learningReadout.TryActivateConcept(ConceptDefOf.FormCaravan);
             Messages.Message("MessageSelectOwnBaseToFormCaravan".Translate(), MessageTypeDefOf.RejectInput, false);
         };
         yield return(formCaravan);
     }
     yield break;
 }
Beispiel #8
0
        // ===================== Gizmos =====================
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IList <Gizmo> buttonList   = new List <Gizmo>();
            int           groupKeyBase = 700000112;

            if (this.takeOffRequestIsEnabled)
            {
                Command_Action requestTakeOffButton = new Command_Action();
                requestTakeOffButton.icon = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip");

                requestTakeOffButton.defaultLabel  = "Request ship take-off";
                requestTakeOffButton.defaultDesc   = "Request ship take-off. Note: solar flare and other events may delay actual take-off.";
                requestTakeOffButton.activateSound = SoundDef.Named("Click");
                requestTakeOffButton.action        = new Action(RequestTakeOff);
                requestTakeOffButton.groupKey      = groupKeyBase + 1;
                buttonList.Add(requestTakeOffButton);
            }

            IEnumerable <Gizmo> resultButtonList;
            IEnumerable <Gizmo> basebuttonList = base.GetGizmos();

            if (basebuttonList != null)
            {
                resultButtonList = basebuttonList.Concat(buttonList);
            }
            else
            {
                resultButtonList = buttonList;
            }
            return(resultButtonList);
        }
Beispiel #9
0
        public static Command BuildCopyCommand(BuildableDef buildable, ThingDef stuff)
        {
            Designator_Build des = BuildCopyCommandUtility.FindAllowedDesignator(buildable, true);

            if (des == null)
            {
                return(null);
            }
            Command_Action command_Action = new Command_Action();

            command_Action.action = delegate
            {
                SoundDefOf.SelectDesignator.PlayOneShotOnCamera(null);
                des.SetStuffDef(stuff);
                Find.DesignatorManager.Select(des);
            };
            command_Action.defaultLabel    = "CommandBuildCopy".Translate();
            command_Action.defaultDesc     = "CommandBuildCopyDesc".Translate();
            command_Action.icon            = des.icon;
            command_Action.iconProportions = des.iconProportions;
            command_Action.iconDrawScale   = des.iconDrawScale;
            command_Action.iconTexCoords   = des.iconTexCoords;
            if (stuff != null)
            {
                command_Action.defaultIconColor = stuff.stuffProps.color;
            }
            else
            {
                command_Action.defaultIconColor = buildable.IconDrawColor;
            }
            command_Action.hotKey = KeyBindingDefOf.Misc11;
            return(command_Action);
        }
Beispiel #10
0
        public Command_Action Btn_ChangeState()
        {
            Command_Action command_Action = new Command_Action();

            command_Action.defaultLabel = MADstateHelp.defaultLabel();
            command_Action.defaultDesc  = MADstateHelp.defaultDesc(curStateName);
            command_Action.icon         = MADstateHelp.Icon(curStateName);
            //if (stateMAD.name == "trait")
            //{
            //    command_Action.icon = ContentFinder<Texture2D>.Get("UI/Commands/MAD_trait", true);
            //}
            //else
            //{
            //    command_Action.icon = ContentFinder<Texture2D>.Get("UI/Commands/MAD_story", true);
            //}

            command_Action.action = delegate
            {
                if (curStateName == "trait")
                {
                    curStateName = "story";
                }
                else
                {
                    curStateName = "trait";
                }
                if (HasAnyContents)
                {
                    EjectContents();
                }
                oldStateName = curStateName;
            };
            command_Action.activateSound = SoundDef.Named("Click");
            return(command_Action);
        }
Beispiel #11
0
        // ===================== Gizmos =====================
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IList <Gizmo> buttonList   = new List <Gizmo>();
            int           groupKeyBase = 700000113;

            Command_Action ejectPlayerPawnsButton = new Command_Action();

            ejectPlayerPawnsButton.icon = ContentFinder <Texture2D> .Get("UI/Commands/PodEject");

            ejectPlayerPawnsButton.defaultLabel  = "Disembark";
            ejectPlayerPawnsButton.defaultDesc   = "Disembark pawns awaiting orbital healing.";
            ejectPlayerPawnsButton.activateSound = SoundDef.Named("Click");
            ejectPlayerPawnsButton.action        = new Action(EjectPlayerPawns);
            ejectPlayerPawnsButton.groupKey      = groupKeyBase + 1;
            buttonList.Add(ejectPlayerPawnsButton);

            IEnumerable <Gizmo> resultButtonList;
            IEnumerable <Gizmo> basebuttonList = base.GetGizmos();

            if (basebuttonList != null)
            {
                resultButtonList = basebuttonList.Concat(buttonList);
            }
            else
            {
                resultButtonList = buttonList;
            }
            return(resultButtonList);
        }
Beispiel #12
0
        // ===================== Gizmos =====================
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IList <Gizmo> buttonList   = new List <Gizmo>();
            int           groupKeyBase = 700000106;

            if (this.repairsAreStarted == false)
            {
                Command_Action startRepairsButton = new Command_Action();
                startRepairsButton.icon = ContentFinder <Texture2D> .Get("Things/Item/Resource/MedicineGlitterworld");

                startRepairsButton.defaultLabel  = "Start repairs";
                startRepairsButton.defaultDesc   = "Deliver needed materials to repair the spaceship.";
                startRepairsButton.activateSound = SoundDef.Named("Click");
                startRepairsButton.action        = new Action(TryStartRepairs);
                startRepairsButton.groupKey      = groupKeyBase + 1;
                buttonList.Add(startRepairsButton);
            }

            IEnumerable <Gizmo> resultButtonList;
            IEnumerable <Gizmo> basebuttonList = base.GetGizmos();

            if (basebuttonList != null)
            {
                resultButtonList = basebuttonList.Concat(buttonList);
            }
            else
            {
                resultButtonList = buttonList;
            }
            return(resultButtonList);
        }
Beispiel #13
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo c in this.< GetGizmos > __BaseCallProxy0())
            {
                yield return(c);
            }
            foreach (Gizmo c2 in ShipUtility.ShipStartupGizmos(this))
            {
                yield return(c2);
            }
            Command_Action launch = new Command_Action();

            launch.action       = new Action(this.TryLaunch);
            launch.defaultLabel = "CommandShipLaunch".Translate();
            launch.defaultDesc  = "CommandShipLaunchDesc".Translate();
            if (!this.CanLaunchNow)
            {
                launch.Disable(ShipUtility.LaunchFailReasons(this).First <string>());
            }
            if (ShipCountdown.CountingDown)
            {
                launch.Disable(null);
            }
            launch.hotKey = KeyBindingDefOf.Misc1;
            launch.icon   = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip", true);

            yield return(launch);

            yield break;
        }
Beispiel #14
0
        protected void displayInspectActions()
        {
            //Since InspectGizmoGrid is internal(you gotta love that vanilla codebase...) lets redo the entire code for the inspect toolbar
            List <Gizmo>  gizmoList       = new List <Gizmo>();
            List <object> selectedObjects = Find.Selector.SelectedObjectsListForReading;

            if (selectedObjects.NullOrEmpty())
            {
                return;
            }
            for (int i = 0; i < selectedObjects.Count; i++)
            {
                ISelectable selectable = selectedObjects[i] as ISelectable;
                if (selectable != null)
                {
                    foreach (Gizmo current in selectable.GetGizmos())
                    {
                        gizmoList.Add(current);
                    }
                }
            }
            for (int j = 0; j < selectedObjects.Count; j++)
            {
                Thing t = selectedObjects[j] as Thing;
                if (t != null)
                {
                    IEnumerable <Designator> allDesignators = Find.ReverseDesignatorDatabase.AllDesignators.Concat(designatorDebugDestroy);
                    foreach (Designator des in allDesignators)
                    {
                        if (des.CanDesignateThing(t).Accepted)
                        {
                            Command_Action command_Action = new Command_Action();
                            command_Action.defaultLabel = des.LabelCapReverseDesignating(t);
                            float   iconAngle;
                            Vector2 iconOffset;
                            command_Action.icon        = des.IconReverseDesignating(t, out iconAngle, out iconOffset);
                            command_Action.iconAngle   = iconAngle;
                            command_Action.iconOffset  = iconOffset;
                            command_Action.defaultDesc = des.DescReverseDesignating(t);
                            command_Action.action      = delegate
                            {
                                if (!TutorSystem.AllowAction(des.TutorTagDesignate))
                                {
                                    return;
                                }
                                des.DesignateThing(t);
                                des.Finalize(true);
                            };
                            command_Action.hotKey   = des.hotKey;
                            command_Action.groupKey = des.groupKey;
                            gizmoList.Add(command_Action);
                        }
                    }
                }
            }

            Gizmo mouseoverGizmo;

            GizmoGridDrawer.DrawGizmoGrid(gizmoList, 20f + windowRect.width, out mouseoverGizmo);
        }
        /// <summary>
        /// This creates new selection buttons with a new graphic
        /// </summary>
        /// <returns></returns>
        public override IEnumerable <Gizmo> GetGizmos()
        {
            if (!UI_ForceSleepButtonPath.NullOrEmpty())
            {
                UI_ForceSleepButton = ContentFinder <Texture2D> .Get(UI_ForceSleepButtonPath, true);
            }

            // Add base.GetCommands()
            List <Gizmo> baseList = base.GetGizmos().ToList();

            for (int i = 0; i < baseList.Count; i++)
            {
                yield return(baseList[i]);
            }


            int groupBaseKey = 31367670;

            // Key-Binding B - Call owner To rest
            Command_Action opt1;

            opt1                = new Command_Action();
            opt1.disabled       = this.OwnersForReading == null || this.OwnersForReading.Count == 0;
            opt1.disabledReason = txtNoOwner.Translate();
            opt1.defaultDesc    = txtSendOwnerToSleep.Translate();
            opt1.icon           = UI_ForceSleepButton;
            opt1.hotKey         = KeyBindingDefOf.Misc1;
            opt1.activateSound  = SoundDef.Named("Click");
            opt1.action         = Button_CallOwnerToRecharge;
            opt1.groupKey       = groupBaseKey + 1;
            yield return(opt1);
        }
 public override IEnumerable <Gizmo> GetCaravanGizmos(Caravan caravan)
 {
     if (Visitable)
     {
         var action = new Command_Action {
             icon         = SettleUtility.SettleCommandTex,
             defaultLabel = "EnterCity".Translate(),
             defaultDesc  = "EnterCityDesc".Translate(),
             action       = () => {
                 LongEventHandler.QueueLongEvent(() => {
                     var orGenerateMap = GetOrGenerateMapUtility.GetOrGenerateMap(Tile, null);
                     CaravanEnterMapUtility.Enter(caravan, orGenerateMap, CaravanEnterMode.Edge, CaravanDropInventoryMode.DoNotDrop, draftColonists: true);
                 }, "GeneratingMapForNewEncounter", false, null);
             },
         };
         if (this.EnterCooldownBlocksEntering())
         {
             action.disabled       = true;
             action.disabledReason = "MessageEnterCooldownBlocksEntering".Translate(this.EnterCooldownDaysLeft().ToString("0.#"));
         }
         yield return(action);
     }
     foreach (var gizmo in base.GetCaravanGizmos(caravan))
     {
         yield return(gizmo);
     }
 }
Beispiel #17
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            IList <Gizmo>  source        = (IList <Gizmo>) new List <Gizmo>();
            Command_Action commandAction = new Command_Action();

            if (!this.Change && this.powerComp.PowerOn)
            {
                if (this.stateOpen)
                {
                    commandAction.icon        = FoodBench.Ui_Pmode2;
                    commandAction.defaultDesc = "Change to Un-Packing Mode";
                }
                else
                {
                    commandAction.icon        = FoodBench.Ui_Pmode1;
                    commandAction.defaultDesc = "Change to Packing Mode";
                }
                commandAction.activateSound = SoundDef.Named("Click");
                commandAction.action        = new Action(this.Open);
                commandAction.groupKey      = 78142894;
                commandAction.hotKey        = KeyBindingDefOf.Misc1;
                source.Add((Gizmo)commandAction);
            }
            IEnumerable <Gizmo> gizmos = base.GetGizmos();

            return(gizmos == null?source.AsEnumerable <Gizmo>() : source.AsEnumerable <Gizmo>().Concat <Gizmo>(gizmos));
        }
Beispiel #18
0
        public void GetFacingGizmo(ref Command_Action command)
        {
            command              = new Command_Action();
            command.icon         = GraphicCache.FlipIcon;
            command.defaultLabel = "switchfacing".TranslateSimple();
            command.defaultDesc  = "switchfacingdesc".TranslateSimple();
            command.action       = delegate
            {
                if (Parent.Rotation.IsHorizontal)
                {
                    if (facing == LinkDirections.Left)
                    {
                        facing = LinkDirections.Right;
                    }
                    else
                    {
                        facing = LinkDirections.Left;
                    }
                }
                else
                {
                    if (facing == LinkDirections.Up)
                    {
                        facing = LinkDirections.Down;
                    }
                    else
                    {
                        facing = LinkDirections.Up;
                    }
                }

                UpdateWindow();
            };
        }
Beispiel #19
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (var g in base.GetGizmos())
            {
                yield return(g);
            }

            var direction = new Command_Action();

            direction.action = () =>
            {
                if (this.outputIndex + 1 >= this.adjacent.Count())
                {
                    this.outputIndex = 0;
                }
                else
                {
                    this.outputIndex++;
                }
            };
            direction.activateSound = SoundDefOf.Checkbox_TurnedOn;
            direction.defaultLabel  = "PRF.AutoMachineTool.SelectOutputDirectionLabel".Translate();
            direction.defaultDesc   = "PRF.AutoMachineTool.SelectOutputDirectionDesc".Translate();
            direction.icon          = RS.OutputDirectionIcon;
            yield return(direction);
        }
Beispiel #20
0
        // ######## Gizmos ######## //

        public override IEnumerable <Gizmo> GetGizmos()
        {
            int groupKeyBase = 700000200;

            List <Gizmo> gizmoList = new List <Gizmo>();

            foreach (Gizmo gizmo in base.GetGizmos())
            {
                gizmoList.Add(gizmo);
            }
            if (this.Faction != Faction.OfPlayer)
            {
                return(gizmoList);
            }

            if (this.campfirePartyIsStarted == false)
            {
                Command_Action startCampfirePartyGizmo = new Command_Action();
                startCampfirePartyGizmo.icon          = startCampfirePartyGizmoIcon;
                startCampfirePartyGizmo.defaultDesc   = "Start campfire party.";
                startCampfirePartyGizmo.defaultLabel  = "Start campfire party.";
                startCampfirePartyGizmo.activateSound = SoundDef.Named("Click");
                startCampfirePartyGizmo.action        = new Action(TryToStartCampfireParty);
                startCampfirePartyGizmo.groupKey      = groupKeyBase + 1;
                gizmoList.Add(startCampfirePartyGizmo);
            }

            // TODO: add a tribal-style party. People run in circle around pyre and get a combat bonus! Only available if allied with a local tribe.

            return(gizmoList);
        }
        public static IEnumerable <Gizmo> CopyPasteGizmosFor(StorageSettings s)
        {
            yield return(new Command_Action
            {
                icon = ContentFinder <Texture2D> .Get("UI/Commands/CopySettings", true),
                defaultLabel = "CommandCopyZoneSettingsLabel".Translate(),
                defaultDesc = "CommandCopyZoneSettingsDesc".Translate(),
                action = delegate
                {
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                    StorageSettingsClipboard.Copy(s);
                },
                hotKey = KeyBindingDefOf.Misc4
            });

            Command_Action paste = new Command_Action();

            paste.icon = ContentFinder <Texture2D> .Get("UI/Commands/PasteSettings", true);

            paste.defaultLabel = "CommandPasteZoneSettingsLabel".Translate();
            paste.defaultDesc  = "CommandPasteZoneSettingsDesc".Translate();
            paste.action       = delegate
            {
                SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                StorageSettingsClipboard.PasteInto(s);
            };
            paste.hotKey = KeyBindingDefOf.Misc5;
            if (!StorageSettingsClipboard.HasCopiedSettings)
            {
                paste.Disable(null);
            }
            yield return(paste);
        }
Beispiel #22
0
        static void Postfix(Pawn __instance, ref IEnumerable <Gizmo> __result)
        {
            List <Gizmo> NewList = new List <Gizmo>();

            // copy vanilla entries into the new list
            foreach (Gizmo entry in __result)
            {
                NewList.Add(entry);
            }

            if (Prefs.DevMode && RJWSettings.DevMode && !MP.IsInMultiplayer)
            {
                Command_Action addSemen = new Command_Action();
                addSemen.defaultDesc  = "AddSemenHediff";
                addSemen.defaultLabel = "AddSemen";
                addSemen.action       = delegate()
                {
                    Addsemen(__instance);
                };

                NewList.Add(addSemen);
            }

            IEnumerable <Gizmo> output = NewList;

            // make caller use the list
            __result = output;
        }
Beispiel #23
0
        public static IEnumerable <Gizmo> CopyPasteGizmosFor(StorageSettings s)
        {
            yield return(new Command_Action
            {
                icon = ContentFinder <Texture2D> .Get("UI/Commands/CopySettings", true),
                defaultLabel = "CommandCopyBioReactorSettingsLabel".Translate(),
                defaultDesc = "CommandCopyBioReactorSettingsDesc".Translate(),
                action = delegate()
                {
                    SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                    Copy(s);
                },
                hotKey = KeyBindingDefOf.Misc4
            });

            Command_Action command_Action = new Command_Action();

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

            command_Action.defaultLabel = "CommandPasteBioReactorSettingsLabel".Translate();
            command_Action.defaultDesc  = "CommandPasteBioReactorSettingsDesc".Translate();
            command_Action.action       = delegate()
            {
                SoundDefOf.Tick_High.PlayOneShotOnCamera(null);
                PasteInto(s);
            };
            command_Action.hotKey = KeyBindingDefOf.Misc5;
            if (!HasCopiedSettings)
            {
                command_Action.Disable(null);
            }
            yield return(command_Action);

            yield break;
        }
Beispiel #24
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo gizmo in base.GetGizmos())
            {
                yield return(gizmo);
            }
            foreach (Gizmo item in ShipUtility.ShipStartupGizmos(this))
            {
                yield return(item);
            }
            Command_Action command_Action = new Command_Action();

            command_Action.action       = TryLaunch;
            command_Action.defaultLabel = "CommandShipLaunch".Translate();
            command_Action.defaultDesc  = "CommandShipLaunchDesc".Translate();
            if (!CanLaunchNow)
            {
                command_Action.Disable(ShipUtility.LaunchFailReasons(this).First());
            }
            if (ShipCountdown.CountingDown)
            {
                command_Action.Disable();
            }
            command_Action.hotKey = KeyBindingDefOf.Misc1;
            command_Action.icon   = ContentFinder <Texture2D> .Get("UI/Commands/LaunchShip");

            yield return(command_Action);
        }
Beispiel #25
0
        public static Command TradeCommand(LandedShip caravan)
        {
            Pawn           bestNegotiator = CaravanVisitUtility.BestNegotiator(caravan);
            Command_Action command_Action = new Command_Action();

            command_Action.defaultLabel = "CommandTrade".Translate();
            command_Action.defaultDesc  = "CommandTradeDesc".Translate();
            command_Action.icon         = DropShipUtility.TradeCommandTex;
            command_Action.action       = delegate
            {
                Settlement factionBase = CaravanVisitUtility.SettlementVisitedNow(caravan);
                if (factionBase != null && factionBase.CanTradeNow)
                {
                    caravan.UnloadCargoForTrading();
                    //Find.WindowStack.Add(new Dialog_TradeFromShips(caravan, bestNegotiator, factionBase));
                    Find.WindowStack.Add(new Dialog_TradeFromShips(caravan, bestNegotiator, factionBase));
                    string empty  = string.Empty;
                    string empty2 = string.Empty;
                    PawnRelationUtility.Notify_PawnsSeenByPlayer(factionBase.Goods.OfType <Pawn>(), ref empty, ref empty2, "LetterRelatedPawnsTradingWithFactionBase".Translate(), false);
                    if (!empty2.NullOrEmpty())
                    {
                        Find.LetterStack.ReceiveLetter(empty, empty2, LetterDefOf.Good, factionBase, null);
                    }
                }
            };
            if (bestNegotiator == null)
            {
                command_Action.Disable("CommandTradeFailNoNegotiator".Translate());
            }
            return(command_Action);
        }
Beispiel #26
0
        private Command FulfillRequestCommand(Caravan caravan)
        {
            Command_Action command_Action = new Command_Action();

            command_Action.defaultLabel = "CommandFulfillTradeOffer".Translate();
            command_Action.defaultDesc  = "CommandFulfillTradeOfferDesc".Translate();
            command_Action.icon         = TradeCommandTex;
            command_Action.action       = delegate
            {
                if (!ActiveRequest)
                {
                    Log.Error("Attempted to fulfill an unavailable request");
                }
                else if (!CaravanInventoryUtility.HasThings(caravan, requestThingDef, requestCount, PlayerCanGive))
                {
                    Messages.Message("CommandFulfillTradeOfferFailInsufficient".Translate(TradeRequestUtility.RequestedThingLabel(requestThingDef, requestCount)), MessageTypeDefOf.RejectInput, historical: false);
                }
                else
                {
                    Find.WindowStack.Add(Dialog_MessageBox.CreateConfirmation("CommandFulfillTradeOfferConfirm".Translate(GenLabel.ThingLabel(requestThingDef, null, requestCount), GenThing.ThingsToCommaList(rewards, useAnd: true)), delegate
                    {
                        Fulfill(caravan);
                    }));
                }
            };
            if (!CaravanInventoryUtility.HasThings(caravan, requestThingDef, requestCount, PlayerCanGive))
            {
                command_Action.Disable("CommandFulfillTradeOfferFailInsufficient".Translate(TradeRequestUtility.RequestedThingLabel(requestThingDef, requestCount)));
            }
            return(command_Action);
        }
Beispiel #27
0
        public Command_Action GetBreedButton(string fishLabelPlural, string speciesDescription, string buttonTexturePath, PawnKindDef fishSpecies,
                                             Bill currentActiveBill, RecipeDef supplyEggsRecipe, Action actionOnClick, int keyOffset)
        {
            Command_Action breedButton = new Command_Action();

            breedButton.icon = ContentFinder <Texture2D> .Get(buttonTexturePath);

            if (this.breedingSpeciesDef == fishSpecies)
            {
                breedButton.defaultLabel = "FishIndustry.Breeding".Translate() + fishLabelPlural;
                breedButton.defaultDesc  = "FishIndustry.BasinIsBreeding".Translate() + fishLabelPlural + ". " + speciesDescription;
                breedButton.action       = RemoveAllBills;
            }
            else if ((currentActiveBill != null) &&
                     (currentActiveBill.recipe == supplyEggsRecipe))
            {
                breedButton.defaultLabel = "FishIndustry.WaitingForEggs".Translate();
                breedButton.defaultDesc  = "FishIndustry.ClickToCancel".Translate() + fishLabelPlural + ". " + "FishIndustry.EnsureHaveHunterAndEggs".Translate();
                breedButton.action       = RemoveAllBills;
            }
            else
            {
                breedButton.defaultLabel = "FishIndustry.Breed".Translate() + fishLabelPlural;
                breedButton.defaultDesc  = "FishIndustry.ClickToStart".Translate() + fishLabelPlural + ". " + speciesDescription + " " + "FishIndustry.EnsureHaveHunterAndEggs".Translate();
                breedButton.action       = actionOnClick;
            }
            breedButton.activateSound = SoundDef.Named("Click");
            breedButton.groupKey      = keyOffset;
            return(breedButton);
        }
Beispiel #28
0
        public override IEnumerable <Gizmo> GetGizmos()
        {
            foreach (Gizmo c in base.GetGizmos())
            {
                yield return(c);
            }
            foreach (Gizmo c2 in ArchotechUtility.ShipStartupGizmos(this))
            {
                yield return(c2);
            }
            Command_Action launch = new Command_Action();

            launch.action       = new Action(this.TryLaunch);
            launch.defaultLabel = "GR_ArchotechProjectLaunch".Translate();
            launch.defaultDesc  = "GR_ArchotechProjectLaunchDesc".Translate();
            if (!this.CanLaunchNow)
            {
                launch.Disable(ArchotechUtility.LaunchFailReasons(this).First <string>());
            }
            if (ShipCountdown.CountingDown)
            {
                launch.Disable(null);
            }
            launch.hotKey = KeyBindingDefOf.Misc1;
            launch.icon   = ContentFinder <Texture2D> .Get("ui/commands/GR_AwakenArchotech", true);

            yield return(launch);
        }
 public override IEnumerable<Command> CompGetGizmosExtra()
 {
     // Show a gizmo button to allow the player to force the operational mode
     Command_Action actionToggleMode = new Command_Action();
     if( actionToggleMode != null )
     {
         actionToggleMode.icon = ContentFinder<Texture2D>.Get( "UI/Icons/Commands/UndertakerMode", true);;
         actionToggleMode.defaultLabel = Constants.TxtUndertakerModeToggle.Translate();
         actionToggleMode.activateSound = SoundDef.Named( "Click" );
         if( this.IsLift() )
         {
             actionToggleMode.defaultDesc = Constants.TxtUndertakerModeSlide.Translate();
             actionToggleMode.action = new Action( delegate()
                 {
                     ChangeOperationalMode( UndertakerMode.UnpoweredSlide, true );
                 } );
         }
         else
         {
             actionToggleMode.defaultDesc = Constants.TxtUndertakerModeLift.Translate();
             actionToggleMode.action = new Action( delegate()
                 {
                     ChangeOperationalMode( UndertakerMode.PoweredLift, true );
                 } );
         }
         if( actionToggleMode.action != null )
         {
             yield return actionToggleMode;
         }
     }
     // No more gizmos
     yield break;
 }
Beispiel #30
0
        public static Command TradeCommand(Caravan caravan, Faction faction = null, TraderKindDef trader = null)
        {
            Pawn           bestNegotiator = BestCaravanPawnUtility.FindBestNegotiator(caravan, faction, trader);
            Command_Action command_Action = new Command_Action();

            command_Action.defaultLabel = "CommandTrade".Translate();
            command_Action.defaultDesc  = "CommandTradeDesc".Translate();
            command_Action.icon         = TradeCommandTex;
            command_Action.action       = delegate
            {
                Settlement settlement = SettlementVisitedNow(caravan);
                if (settlement != null && settlement.CanTradeNow)
                {
                    Find.WindowStack.Add(new Dialog_Trade(bestNegotiator, settlement));
                    PawnRelationUtility.Notify_PawnsSeenByPlayer_Letter_Send(settlement.Goods.OfType <Pawn>(), "LetterRelatedPawnsTradingWithSettlement".Translate(Faction.OfPlayer.def.pawnsPlural), LetterDefOf.NeutralEvent);
                }
            };
            if (bestNegotiator == null)
            {
                if (trader != null && trader.permitRequiredForTrading != null && !caravan.PawnsListForReading.Any((Pawn p) => p.royalty != null && p.royalty.HasPermit(trader.permitRequiredForTrading, faction)))
                {
                    command_Action.Disable("CommandTradeFailNeedPermit".Translate(trader.permitRequiredForTrading.LabelCap));
                }
                else
                {
                    command_Action.Disable("CommandTradeFailNoNegotiator".Translate());
                }
            }
            if (bestNegotiator != null && bestNegotiator.skills.GetSkill(SkillDefOf.Social).TotallyDisabled)
            {
                command_Action.Disable("CommandTradeFailSocialDisabled".Translate());
            }
            return(command_Action);
        }
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            foreach (Gizmo g in base.CompGetGizmosExtra())
            {
                yield return(g);
            }
            Command_Action launch = new Command_Action
            {
                defaultLabel = "D9CTM_CommandLaunchPod".Translate(base.parent.Label),
                defaultDesc  = "D9CTM_CommandLaunchPodDesc".Translate(base.parent.Label),
                icon         = LaunchCommandTex,
                alsoClickIfOtherInGroupClicked = false,
                action = delegate
                {
                    TryLaunch();
                }
            };

            if (!EnoughFuel)
            {
                launch.Disable("D9CTM_PodUnderfueled".Translate(base.parent.Label));
            }
            else if (IsUnderRoof)
            {
                launch.Disable("D9CTM_PodUnderRoof".Translate(base.parent.Label));
            }
            yield return(launch);
        }
Beispiel #32
0
        public override IEnumerable <Gizmo> GetWornGizmos()
        {
            IList <Gizmo>  list = new List <Gizmo>();
            int            num  = 700000101;
            Command_Action val  = new Command_Action();

            switch (lightMode)
            {
            case LightMode.Automatic:
                val.icon = ContentFinder <Texture2D> .Get("Ui/Commands/CommandButton_LigthModeAutomatic", true);

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

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

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

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

                val.defaultLabel = "Ligth: off.";
                break;
            }
            val.defaultDesc   = "Switch mode.";
            val.activateSound = SoundDef.Named("Click");
            val.action        = SwitchLigthMode;
            val.groupKey      = num + 1;
            list.Add(val);
            return(list);
        }
        public override IEnumerable <Gizmo> GetGizmos()
        {
            int groupKeyBase = 700000200;

            // The deconstruction option is not available, thus we don't add the base gizmos.
            List <Gizmo> gizmosList = new List <Gizmo>();

            /*foreach (Gizmo gizmo in base.GetGizmos())
             * {
             *  gizmosList.Add(gizmo);
             * }*/

            if (this.reverseEngineeringState >= Building_MechanoidTerraformer.ReverseEngineeringState.StudyCompleted)
            {
                Command_Action displayStudyReportButton = new Command_Action();
                displayStudyReportButton.icon          = displayStudyReportIcon;
                displayStudyReportButton.defaultDesc   = "Display study report.";
                displayStudyReportButton.defaultLabel  = "Display study report.";
                displayStudyReportButton.activateSound = SoundDef.Named("Click");
                displayStudyReportButton.action        = new Action(DisplayStudyReport);
                displayStudyReportButton.groupKey      = groupKeyBase + 1;
                gizmosList.Add(displayStudyReportButton);
            }
            return(gizmosList);
        }
Beispiel #34
0
        public override IEnumerable <Gizmo> CompGetGizmosExtra()
        {
            foreach (var current in base.CompGetGizmosExtra())
            {
                yield return(current);
            }

            if (this.parent.Faction == Faction.OfPlayer)
            {
                Command_Action act = new Command_Action();

                act.defaultLabel  = ResourceBank.CycleLayerLabel;
                act.defaultDesc   = ResourceBank.CycleLayerDesc;
                act.icon          = currentLayer == NetLayer.Lower ? ResourceBank.UILower : ResourceBank.UIUpper;
                act.activateSound = SoundDef.Named("DesignateMine");
                act.hotKey        = KeyBindingDefOf.CommandColonistDraft;
                act.action        = () =>
                {
                    var oldLayer = currentLayer;
                    currentLayer = currentLayer == NetLayer.Lower ? NetLayer.Upper : NetLayer.Lower;
                    MoteMaker.ThrowText(parent.Position.ToVector3Shifted(), parent.Map,
                                        ResourceBank.CycleLayerMote.Translate(currentLayer.ToStringTranslated())
                                        );
                    AirNetManager.NotifyCompLayerChange(this, oldLayer);
                };
                yield return(act);
            }
        }
        public override IEnumerable<Gizmo> GetGizmos()
        {
            foreach (var g in base.GetGizmos())
                yield return g;

            Command_Action a = new Command_Action();
            a.action = () => Find.LayerStack.Add(new Page_Drafting(null));
            yield return a;
        }
 //Fissure Generator Commands
 public override IEnumerable<Gizmo> GetGizmos()
 {
     //Start/Stop
     var command = new Command_Action();
     if (!this.started)
     {
         command.defaultLabel = "Begin";
         string desc = "Click here to begin the drilling process once you have chosen your desired fissure size";
         command.defaultDesc = desc;
         command.icon = Building_FissureGenerator.beginIcon;
     }
     else
     {
         if (this.running)
         {
             command.defaultLabel = "Pause";
             string desc2 = "Click here to pause the drilling process";
             command.defaultDesc = desc2;
             command.icon = Building_FissureGenerator.pauseIcon;
         }
         else
         {
             command.defaultLabel = "Resume";
             string desc3 = "Click here to resume the drilling process";
             command.defaultDesc = desc3;
             command.icon = Building_FissureGenerator.beginIcon;
         }
     }
     command.hotKey = Keys.BuildingOnOffToggle;
     command.activateSound = SoundDef.Named("Click");
     command.action = new Action(ToggleStarted);
     command.disabled = false;
     command.groupKey = 313740003;
     yield return command;
     //Cycle through the fissure sizes to generate
     command = new Command_Action
     {
         icon = Building_FissureGenerator.cycleButton,
         defaultLabel = "Choose Fissure",
         defaultDesc = "Choose Fissure",
         hotKey = Keys.FissureGeneratorChangeFissure,
         activateSound = SoundDef.Named("Click"),
         action = new Action(CycleThroughFissuresToGenerate),
         disabled = false,
         groupKey = 313740004
     };
     if (!this.started)
     {
         yield return command;
     }
     if (base.GetGizmos() != null)
     {
         foreach (var c in base.GetGizmos())
             yield return c;
     }
 }
Beispiel #37
0
        public override IEnumerable<Gizmo> GetGizmos()
        {
            Command_Action com = new Command_Action();

            com.defaultLabel = "CommandDetonateLabel".Translate();
            com.icon = ContentFinder<Texture2D>.Get("UI/Commands/Detonate");
            com.defaultDesc = "CommandDetonateDesc".Translate();
            com.action = () => Command_Detonate();

            yield return com;
        }
Beispiel #38
0
        public override IEnumerable<Gizmo> GetGizmos()
        {
            foreach (var baseGizmo in base.GetGizmos())
                yield return baseGizmo;

            Designator_DeliveryZone designator1 = new Designator_DeliveryZone();

            designator1.vehicle = this;
            designator1.stockpileNum = 0;
            designator1.defaultLabel = "Set delivery zone1";
            designator1.defaultDesc = "Set delivery zone1";
            designator1.icon = ContentFinder<Texture2D>.Get("UI/Commands/RenameZone");
            designator1.activateSound = SoundDef.Named("Click");

            yield return designator1;

            Designator_DeliveryZone designator2 = new Designator_DeliveryZone();

            designator2.vehicle = this;
            designator2.stockpileNum = 1;
            designator2.defaultLabel = "Set delivery zone2";
            designator2.defaultDesc = "Set delivery zone2";
            designator2.icon = ContentFinder<Texture2D>.Get("UI/Commands/RenameZone");
            designator2.activateSound = SoundDef.Named("Click");

            yield return designator2;

            Command_Action gizmo = new Command_Action();

            if (this.IsMounted)
            {
                gizmo.defaultLabel = "Transfer";
                //gizmo.icon = ContentFinder<Texture2D>.Get("UI/Commands/IconDismount");
                gizmo.activateSound = SoundDef.Named("Click");
                gizmo.defaultDesc = "Transfer";
                gizmo.action = () =>
                {
                    IntVec3 dest = IntVec3.Invalid;
                    if (this.Position.GetZone() == this.deliveryZone1)
                        dest = deliveryZone2.Cells.First();
                    else if (this.Position.GetZone() == this.deliveryZone2)
                        dest = deliveryZone1.Cells.First();
                    else
                        dest = deliveryZone1.Cells.First();
                    Job jobNew = new Job(JobDefOf.Goto, dest);
                    this.drafter.TakeOrderedJob(jobNew);
                };

                yield return gizmo;
            }
        }
        public override IEnumerable<Gizmo> GetGizmos()
        {
            //Add the stock Gizmoes
            foreach (var g in base.GetGizmos())
            {
                yield return g;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.tryReplacePawn();
                act.icon = UI_UPGRADE;
                act.defaultLabel = "Upgrade To NanoShield";
                act.defaultDesc = "Upgrade To NanoShield";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }

            if (flag_charge)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.SwitchCharge();
                act.icon = UI_CHARGE_ON;
                act.defaultLabel = "Charge Shields";
                act.defaultDesc = "On";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }
            else
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.SwitchCharge();
                act.icon = UI_CHARGE_OFF;
                act.defaultLabel = "Charge Shields";
                act.defaultDesc = "Off";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }
        }
        public override IEnumerable<Gizmo> GetGizmos()
        {
            foreach (var g in base.GetGizmos())
                yield return g;

            Command_Action action = new Command_Action();
            action.action = () =>
            {
                Droid droid = Blueprint.GenerateDroid(Blueprint.Default, Faction.OfColony);
                droid.parts.ReplacePowerCell(ThingMaker.MakeThing(ThingDef.Named("MD2DroidPowerCell")));
                GenSpawn.Spawn(droid, base.InteractionCell);
            };
            action.defaultLabel = "click";
            action.groupKey = 10008999;
            yield return action;
        }
 public override IEnumerable<Gizmo> GetGizmos()
 {
     if (base.GetGizmos() != null)
     {
         foreach (Gizmo c in base.GetGizmos())
         {
             yield return c;
         }
     }
     Command_Action com = new Command_Action();
     com.action = () => OpenManagerUI();
     com.defaultDesc = "Opens the manufacturing manager user interface";
     com.defaultLabel = "Open manufacturing manager";
     com.icon = Manufacturing_Icon;
     com.disabled = false;
     com.groupKey = 123456789;
     yield return com;
 }
Beispiel #42
0
 public override IEnumerable<Command> CompGetGizmosExtra()
 {
     GizmoAmmoStatus gizmoAmmoStatus = new GizmoAmmoStatus
     {
         compAmmo = this
     };
     yield return gizmoAmmoStatus;
     if (this.Wielder != null)
     {
         Command_Action command_Action = new Command_Action
         {
             action = new Action(this.StartReload),
             defaultLabel = Translator.Translate("Plasma_ReloadLabel"),
             defaultDesc = Translator.Translate("Plasma_ReloadDesc"),
             icon = ContentFinder<Texture2D>.Get("UI/Buttons/Reload", true)
         };
         yield return command_Action;
     }
     yield break;
 }
 public override IEnumerable<Gizmo> CompGetGizmosExtra()
 {
     if (canSwitchModes)
     {
         Command_Action commandModeSwitch = new Command_Action();
         commandModeSwitch.groupKey = 676192;
         if (switchedToChunkSilo)
         {
             commandModeSwitch.defaultLabel = "CompRTDeviceModeSwitcher_StockpileModeLabel".Translate();
             commandModeSwitch.defaultDesc = "CompRTDeviceModeSwitcher_StockpileModeDesc".Translate();
             commandModeSwitch.icon = Resources.stockpileTexture;
         }
         else
         {
             commandModeSwitch.defaultLabel = "CompRTDeviceModeSwitcher_ChunkSiloModeLabel".Translate();
             commandModeSwitch.defaultDesc = "CompRTDeviceModeSwitcher_ChunkSiloModeDesc".Translate();
             commandModeSwitch.icon = Resources.chunkSiloTexture;
         }
         commandModeSwitch.action = () =>
         {
             CompFlickable compFlickable = parent.TryGetComp<CompFlickable>();
             if (compFlickable != null)
             {
                 compFlickable.ResetToOn();
                 compFlickable.DoFlick();
                 FlickUtility.UpdateFlickDesignation(parent);
             }
             if (switchedToChunkSilo)
             {
                 CompRTQuantumChunkSilo compChunkSilo = parent.TryGetComp<CompRTQuantumChunkSilo>();
                 if (compChunkSilo != null)
                 {
                     compChunkSilo.EmptyOut();
                 }
             }
             switchedToChunkSilo = !switchedToChunkSilo;
             SortOutComps();
         };
         yield return commandModeSwitch;
     }
 }
Beispiel #44
0
 public override IEnumerable<Command> CompGetGizmosExtra()
 {
     if (Find.DesignationManager.DesignationOn(parent)?.def != DesignationDefOf.Deconstruct)
     {
         // Setup a new command
         var gizmoLoot = new Command_Action
         {
             // Command icon
             icon = parent.def.uiIcon,
             // Command label
             defaultLabel = "Loot",
             // Command description
             defaultDesc = "Search for useful things inside " + parent.Label,
             // Command sound when activated
             activateSound = SoundDef.Named("Click"),
             // Action to call
             action = DesignateForLooting
         };
         yield return gizmoLoot;
     }
 }
 public override IEnumerable<Gizmo> GetGizmos()
 {
     var com = new Command_Action()
     {
         action = () =>
         {
             ToggleStateOne();
         },
         defaultDesc = "Click to extend the wall",
         defaultLabel = "Extend Wall",
         activateSound = SoundDef.Named("Click"),
         hotKey = Keys.Named("ExtendMechWall"),
         disabled = false,
         groupKey = 313740010,
         icon = ExtendIcon
     };
     yield return com;
     com = new Command_Action()
     {
         action = () =>
         {
             ToggleStateTwo();
         },
         defaultDesc = "Click to recess the wall into the ground",
         defaultLabel = "Recess Wall",
         activateSound = SoundDef.Named("Click"),
         hotKey = Keys.Named("RecessMechWall"),
         disabled = false,
         groupKey = 313740009,
         icon = RecessIcon
     };
     yield return com;
     if (base.GetGizmos() != null)
     {
         foreach (Command c in base.GetGizmos())
         {
             yield return c;
         }
     }
 }
        public override IEnumerable<Command> CompGetGizmosExtra()
        {
            var ammoStat = new GizmoAmmoStatus
            {
                compAmmo = this
            };

            yield return ammoStat;

            if (this.Wielder != null)
            {
                var com = new Command_Action
                {
                    action = StartReload,
                    defaultLabel = "CR_ReloadLabel".Translate(),
                    defaultDesc = "CR_ReloadDesc".Translate(),
                    icon = ContentFinder<Texture2D>.Get("UI/Buttons/Reload", true)
                };

                yield return com;
            }
        }
        public override IEnumerable<Gizmo> GetGizmos()
        {
            //Add the stock Gizmoes
            foreach (var g in base.GetGizmos())
            {
                yield return g;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.ActivateDrill();
                act.icon = UI_ACTIVATE_GATE;
                act.defaultLabel = "Activate Drill";
                act.defaultDesc = "Activate Drill";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }
        }
        public override IEnumerable<Command> CompGetGizmosExtra()
        {
            var gizmo = new Command_Action
            {
                defaultDesc = "Upgrade this so you can get advanced version and save some resources",
                defaultLabel = "Upgrade",
                icon = ContentFinder<Texture2D>.Get("UI/Icons/Upgrade"),
                activateSound = SoundDef.Named("Click"),
                action = UpgradeBuilding
            };

            if (!ResearchPrereqsFulfilled)
                gizmo.Disable(DisabledReasonString());

            if (Properties.upgradeTargetDef == null || ThingDef.Named(Properties.upgradeTargetDef.ToString()) == null)
            {
                Log.Error("No such def to upgrade to.");
                yield return null;
            }

            yield return gizmo;
        }
        public override IEnumerable<Command> CompGetGizmosExtra()
        {
            if (((Building_CryptosleepCasket)this.parent).GetContainer().Count == 0)
            {

                var com = new Command_Action
                {
                    action = delegate                 {
                    List<Pawn> list = Find.ListerPawns.PawnsInFaction(Faction.OfColony).Where(p => p.RaceProps.Animal && !p.InContainer && p.BodySize < this.props.maxSizeAllowance)
                                                 .OrderBy(p => p.LabelCap).ToList();

                    if (list.Count > 0)
                    {
                        List<FloatMenuOption> list2 = new List<FloatMenuOption>();
                        list2.AddRange(list.ConvertAll<FloatMenuOption>((Pawn p) => new FloatMenuOption(p.LabelCap, delegate
                        {
            #if DEBUG
                            Log.Message(p.LabelCap + " sent to " + parent.LabelCap + ", bodySize " + p.BodySize.ToString() + " sizeAllowance " + this.props.maxSizeAllowance);
            #endif
                            Designation_PutInCrypto des = new Designation_PutInCrypto();
                            des.target = p;
                            des.target2 = this.parent;
                            des.def = PutInCrypto.designationDef;
                            Find.DesignationManager.RemoveAllDesignationsOn(p, false);
                            Find.DesignationManager.AddDesignation(des);
                        }, MenuOptionPriority.Medium, null, null)));
                        Find.WindowStack.Add(new FloatMenu(list2, false));
                    }
                },
                    defaultLabel = "Designate animal",
                    defaultDesc = "Designates an animal to be placed in cryptosleep.\nNo Colonist Left Behind!",
                    icon = ContentFinder<Texture2D>.Get("UI/Buttons/PutInCrypto", true)
                };

                yield return com;
            }
            yield break;
        }
        public override IEnumerable<Command> CompGetGizmosExtra()
        {
            var com = new Command_Action
            {
                defaultLabel  = ResourceBank.CycleLayerLabel,
                defaultDesc   = ResourceBank.CycleLayerDesc,
                icon          = currentLayer == NetLayer.Lower ? ResourceBank.UILower : ResourceBank.UIUpper,
                activateSound = SoundDef.Named( "DesignateMine" ),
                hotKey        = KeyBindingDefOf.CommandColonistDraft,
                action        = () =>
                {
                    var oldLayer = currentLayer;
                    currentLayer = currentLayer == NetLayer.Lower ? NetLayer.Upper : NetLayer.Lower;
                    MoteThrower.ThrowText( parent.Position.ToVector3Shifted(),
                                           ResourceBank.CycleLayerMote.Translate( currentLayer.ToStringTranslated() ) );
                    AirNetManager.NotifyCompLayerChange( this, oldLayer );
                }
            };

            foreach (var current in base.CompGetGizmosExtra())
                yield return current;

            yield return com;
        }
        public override IEnumerable<Gizmo> GetGizmos()
        {
            int groupKeyBase = 700000200;

            // The deconstruction option is not available, thus we don't add the base gizmos.
            List<Gizmo> gizmosList = new List<Gizmo>();
            /*foreach (Gizmo gizmo in base.GetGizmos())
            {
                gizmosList.Add(gizmo);
            }*/

            if (this.reverseEngineeringState >= Building_MechanoidTerraformer.ReverseEngineeringState.StudyCompleted)
            {
                Command_Action displayStudyReportButton = new Command_Action();
                displayStudyReportButton.icon = displayStudyReportIcon;
                displayStudyReportButton.defaultDesc = "Display study report.";
                displayStudyReportButton.defaultLabel = "Display study report.";
                displayStudyReportButton.activateSound = SoundDef.Named("Click");
                displayStudyReportButton.action = new Action(DisplayStudyReport);
                displayStudyReportButton.groupKey = groupKeyBase + 1;
                gizmosList.Add(displayStudyReportButton);
            }
            return gizmosList;
        }
Beispiel #52
0
        public override IEnumerable<Gizmo> GetGizmos()
        {
            Command_Action com = new Command_Action();

            com.defaultLabel = "CommandDismountLabel".Translate();
            //com.icon = ContentFinder<Texture2D>.Get("UI/Commands/");
            com.activateSound = SoundDef.Named("Click");
            com.defaultDesc = "CommandDismountDesc".Translate();
            com.action = () => { this.mountContainer.TryDropAll(this.Position, ThingPlaceMode.Near); };

            yield return com;
        }
Beispiel #53
0
        public override IEnumerable<Gizmo> GetGizmos()
        {
            if (base.GetGizmos() != null)
            {
                foreach (Gizmo c in base.GetGizmos())
                {
                    yield return c;
                }
            }
            Command_Action com = new Command_Action();
            com.activateSound = SoundDefOf.Click;
            if (Active)
            {
                com.defaultDesc = "DisableDescription".Translate();
                com.defaultLabel = "Disable".Translate();
                com.icon = this.StopIcon;
            }
            else
            {
                com.defaultDesc = "EnableDescription".Translate();
                com.defaultLabel = "Enable".Translate();
                com.icon = this.StartIcon;
            }
            com.disabled = false;
            com.groupKey = 313740004;
            com.hotKey = KeyBindingDef.Named("MD2DisableDroid");
            com.action = () => { Active = !Active; };
            yield return com;
            //////////////////////////
            Command_Action deactivate = new Command_Action();
            deactivate.action =
                () =>
                {
                    Find.LayerStack.Add(new Dialog_Confirm("DeactivateDialog".Translate(),
                        delegate { utilities.Disable(); }));
                };
            deactivate.activateSound = SoundDefOf.Click;
            deactivate.defaultDesc = "DeactivateDescription".Translate();
            deactivate.defaultLabel = "DeactivateLabel".Translate();
            deactivate.disabled = false;
            deactivate.groupKey = 313740005;
            deactivate.icon = this.DeactivateIcon;
            deactivate.hotKey = KeyBindingDef.Named("MD2DeactivateDroid");
            yield return deactivate;
            ///////////////////////
            Command_Action selfDestruct = new Command_Action();
            selfDestruct.action =
                () =>
                {
                    Find.LayerStack.Add(new Dialog_Confirm("DroidSelfDestructPrompt".Translate(),
                        delegate { this.Destroy(DestroyMode.Kill); }));
                };
            selfDestruct.activateSound = SoundDefOf.Click;
            selfDestruct.defaultDesc = "SelfDestructDescription".Translate();
            selfDestruct.defaultLabel = "SelfDestructLabel".Translate();
            selfDestruct.disabled = false;
            selfDestruct.groupKey = 313740006;
            selfDestruct.icon = this.SDIcon;
            selfDestruct.hotKey = KeyBindingDef.Named("MD2SelfDestructDroid");
            yield return selfDestruct;

            foreach (var g in work.specialist.GetSpecialistGizmos())
                yield return g;
        }
Beispiel #54
0
        public override IEnumerable<Gizmo> GetGizmos()
        {
            if (base.GetGizmos() != null)
            {
                foreach (Gizmo c in base.GetGizmos())
                {
                    yield return c;
                }
            }
            Command_Action com = new Command_Action();
            com.activateSound = SoundDefOf.Click;
            if (this.active)
            {
                com.defaultDesc = "Click to deactivate this droid and save power.";
                com.defaultLabel = "Deactivate";
                com.icon = this.StopIcon;
            }
            else
            {
                com.defaultDesc = "Click to activate this droid.";
                com.defaultLabel = "Activate";
                com.icon = this.StartIcon;
            }
            com.disabled = false;
            com.groupKey = 313740008;
            com.hotKey = Keys.DeactivateDroid;
            com.action = () =>
            {
                this.ToggleActive();
            };
            yield return com;

            Command_Action a = new Command_Action();
            a.action = () =>
            {
                Find.LayerStack.Add(new Dialog_Confirm("DroidSelfDestructPrompt".Translate(), delegate
                    {
                        this.Destroy(DestroyMode.Kill);
                    }));
            };
            a.activateSound = SoundDefOf.Click;
            a.defaultDesc = "Click this button to cause the droid to self destruct";
            a.defaultLabel = "Self Destruct";
            a.disabled = false;
            a.groupKey = 313740004;
            a.icon = this.SDIcon;
            yield return a;
        }
        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;
        }
        public override IEnumerable<Gizmo> GetGizmos()
        {
            //Add the stock Gizmoes
            foreach (var g in base.GetGizmos())
            {
                yield return g;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.AddResources();
                act.icon = UI_ADD_RESOURCES;
                act.defaultLabel = "Add Resources";
                act.defaultDesc = "Add Resources";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.AddColonist();
                act.icon = UI_ADD_COLONIST;
                act.defaultLabel = "Add Colonist";
                act.defaultDesc = "Add Colonist";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.StargateDialOut();
                act.icon = UI_GATE_OUT;
                act.defaultLabel = "Dial Out";
                act.defaultDesc = "Dial Out";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.StargateRecall();
                act.icon = UI_GATE_IN;
                act.defaultLabel = "Recall";
                act.defaultDesc = "Recall";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.PowerRateIncrease();
                act.icon = UI_POWER_UP;
                act.defaultLabel = "Increase Power";
                act.defaultDesc = "Increase Power";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.PowerRateDecrease();
                act.icon = UI_POWER_DOWN;
                act.defaultLabel = "Decrease Power";
                act.defaultDesc = "Decrease Power";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }
        }
Beispiel #57
0
 public override IEnumerable<Gizmo> GetGizmos()
 {
     foreach (var c in base.GetGizmos())
     {
         yield return c;
     }
     //Delete the fissure
     var command = new Command_Action
     {
         hotKey = Keys.Named("FillInFissure"),
         icon = Fissure.icon,
         defaultDesc = "Fills the fissure in",
         defaultLabel = "Fill in fissure",
         activateSound = SoundDef.Named("Click"),
         action = delegate
         {
             Find.LayerStack.Add(new Dialog_Confirm(
                 "Are you sure you wish to fill in this fissure?",
                 delegate { DeSpawn(); }));
         },
         disabled = HasMiner,
         groupKey = 313740005
     };
     yield return command;
 }
        public override IEnumerable<Gizmo> GetGizmos()
        {
            //Add the stock Gizmoes
            foreach (var g in base.GetGizmos())
            {
                yield return g;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.PowerReceive1000();
                act.icon = UI_POWER_UP_2;
                act.defaultLabel = "Power Receive 1000";
                act.defaultDesc = "Power Receive 1000";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.PowerReceive100();
                act.icon = UI_POWER_UP_1;
                act.defaultLabel = "Power Receive 100";
                act.defaultDesc = "Power Receive 100";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.PowerTransmit100();
                act.icon = UI_POWER_DOWN_1;
                act.defaultLabel = "Power Transmit 100";
                act.defaultDesc = "Power Transmit 100";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }

            if (true)
            {
                Command_Action act = new Command_Action();
                //act.action = () => Designator_Deconstruct.DesignateDeconstruct(this);
                act.action = () => this.PowerTransmit1000();
                act.icon = UI_POWER_DOWN_2;
                act.defaultLabel = "Power Transmit 1000";
                act.defaultDesc = "Power Transmit 1000";
                act.activateSound = SoundDef.Named("Click");
                //act.hotKey = KeyBindingDefOf.DesignatorDeconstruct;
                //act.groupKey = 689736;
                yield return act;
            }
        }
 public override IEnumerable<Gizmo> GetGizmos()
 {
     if (base.GetGizmos() != null)
     {
         foreach (var c in base.GetGizmos())
         {
             yield return c;
         }
     }
     Command_Action com = new Command_Action()
     {
     action = () =>
     {
     CycleThroughAvailbleResources();
     },
     activateSound = SoundDefOf.Click,
     defaultDesc = "Click to change which resource to produce",
     defaultLabel = "Change resource",
     hotKey = Keys.Named("ExtractorChangeResource"),
     icon = chooseIcon,
     groupKey = 313740004
     };
     if (HasFissure)
     {
         com.disabled = false;
     }
     else
     {
         com.disabled = true;
     }
     yield return com;
 }
Beispiel #60
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;
            }
        }