static void Postfix(KeyBindingDef __instance, ref bool __result) { if (__instance == KeyBindingDefOf.QueueOrder && shouldQueue.HasValue) { __result = shouldQueue.Value; } }
static H_KeyPresses() { key = KeyBindingDef.Named("DubsOptimizerKey"); restartkey = KeyBindingDef.Named("DubsOptimizerRestartKey"); alertKey = KeyBindingDef.Named("dpa_ToggleAlertBlock"); PatchMe(Modbase.StaticHarmony); }
public MapComponent_ColonistSelections(Map map) : base(map) { kbDef_Help = DefDatabase <KeyBindingDef> .GetNamed("ColonistSelectionKeys_Help"); kbDef_Release = DefDatabase <KeyBindingDef> .GetNamed("ColonistSelectionKeys_Release"); kbDef_Group1 = DefDatabase <KeyBindingDef> .GetNamed("ColonistSelectionKeys_Group1"); kbDef_Group2 = DefDatabase <KeyBindingDef> .GetNamed("ColonistSelectionKeys_Group2"); kbDef_Group3 = DefDatabase <KeyBindingDef> .GetNamed("ColonistSelectionKeys_Group3"); kbDef_Group4 = DefDatabase <KeyBindingDef> .GetNamed("ColonistSelectionKeys_Group4"); kbDef_Colony = DefDatabase <KeyBindingDef> .GetNamed("ColonistSelectionKeys_CenterOnColony"); PawnsKey_Group1 = new List <Pawn>(); CellsKey_Group1 = new List <IntVec3>(); PawnsKey_Group2 = new List <Pawn>(); CellsKey_Group2 = new List <IntVec3>(); PawnsKey_Group3 = new List <Pawn>(); CellsKey_Group3 = new List <IntVec3>(); PawnsKey_Group4 = new List <Pawn>(); CellsKey_Group4 = new List <IntVec3>(); //if (kbDef_Eat == null || kbDef_Sleep == null || kbDef_Help == null || kbDef_Release == null || kbDef_Group1 == null || kbDef_Group2 == null || kbDef_Group3 == null || kbDef_Group4 == null) // Log.Error("Somethings null!!!"); //else // Log.Error("KeyBinding done."); LongEventHandler.ExecuteWhenFinished(InitGraphics); }
private void DrawKeyEntry(KeyBindingDef keyDef, Rect parentRect, ref float curY, bool skipDrawing) { if (!skipDrawing) { Rect rect = new Rect(parentRect.x, parentRect.y + curY, parentRect.width, 34f).ContractedBy(3f); GenUI.SetLabelAlign(TextAnchor.MiddleLeft); Widgets.Label(rect, keyDef.LabelCap); GenUI.ResetLabelAlign(); float num = 4f; Vector2 vector = new Vector2(140f, 28f); Rect rect2 = new Rect(rect.x + rect.width - vector.x * 2f - num, rect.y, vector.x, vector.y); Rect rect3 = new Rect(rect.x + rect.width - vector.x, rect.y, vector.x, vector.y); TooltipHandler.TipRegion(rect2, new TipSignal("BindingButtonToolTip".Translate())); TooltipHandler.TipRegion(rect3, new TipSignal("BindingButtonToolTip".Translate())); if (Widgets.ButtonText(rect2, keyPrefsData.GetBoundKeyCode(keyDef, KeyPrefs.BindingSlot.A).ToStringReadable())) { SettingButtonClicked(keyDef, KeyPrefs.BindingSlot.A); } if (Widgets.ButtonText(rect3, keyPrefsData.GetBoundKeyCode(keyDef, KeyPrefs.BindingSlot.B).ToStringReadable())) { SettingButtonClicked(keyDef, KeyPrefs.BindingSlot.B); } } curY += 34f; }
// public override void Tick() // { // base.Tick(); // //Put on backpack // if (postWearer == null && wearer != null) // { // postWearer = wearer; // } // //Put off backpack. Should drop all from postWearer // else if (postWearer != null && wearer == null) // { // slotsComp.slots.TryDropAll(postWearer.Position, ThingPlaceMode.Near); // postWearer = null; // numOfSavedItems = 0; // } // if (wearer != null && numOfSavedItems > slotsComp.slots.Count) // numOfSavedItems = slotsComp.slots.Count; // } public override IEnumerable <Gizmo> GetWornGizmos() { // Designator_PutInInventory designator = new Designator_PutInInventory(); // designator.backpack = this; // designator.icon = ContentFinder<Texture2D>.Get("UI/Commands/IconPutIn"); // designator.defaultLabel = DesignatorPutInInventoryDefaultLabel + "(" + wearer.inventory.innerContainer.Count + "/" + MaxItem + ")"; // designator.defaultDesc = DesignatorPutInInventoryDefaultDesc + wearer.inventory.innerContainer.Count + "/" + MaxItem; // designator.hotKey = KeyBindingDef.Named("CommandPutInInventory"); // designator.activateSound = SoundDef.Named("Click"); // yield return designator; Designator_PutInBackpackSlot designator2 = new Designator_PutInBackpackSlot { SlotsBackpackComp = this.SlotsComp, defaultLabel = string.Format( "Put in ({0}/{1})", this.SlotsComp.slots.Count, this.MaxItem), defaultDesc = string.Format("Put thing in {0}.", this.Label), hotKey = KeyBindingDef.Named("CommandPutInInventory"), activateSound = SoundDef.Named("Click"), icon = this.def.uiIcon, MaxItem = this.MaxItem }; // not used, but need to be defined, so that gizmo could accept actions yield return(designator2); Gizmo_BackpackEquipment gizmo = new Gizmo_BackpackEquipment { backpack = this }; yield return(gizmo); }
public DesignatorEntry(Designator_SelectableThings designator, KeyBindingDef key, SettingHandle <bool> visibilitySetting) { Designator = designator; Key = key; VisibilitySetting = visibilitySetting; }
public Dialog_DefineBinding(KeyPrefsData keyPrefsData, KeyBindingDef keyDef, KeyPrefs.BindingSlot slot) { this.keyDef = keyDef; this.slot = slot; this.keyPrefsData = keyPrefsData; base.forcePause = true; base.onlyOneOfTypeAllowed = true; base.absorbInputAroundWindow = true; }
public Dialog_DefineBinding(KeyPrefsData keyPrefsData, KeyBindingDef keyDef, KeyPrefs.BindingSlot slot) { this.keyDef = keyDef; this.slot = slot; this.keyPrefsData = keyPrefsData; this.closeOnAccept = false; this.closeOnCancel = false; this.forcePause = true; this.onlyOneOfTypeAllowed = true; this.absorbInputAroundWindow = true; }
public Designator_MineVein() { this.defaultLabel = MineVein.label; this.defaultDesc = MineVein.description; this.icon = MineVein.icon; this.useMouseIcon = true; this.soundDragSustain = SoundDefOf.DesignateDragStandard; this.soundDragChanged = SoundDefOf.DesignateDragStandardChanged; this.soundSucceeded = SoundDefOf.DesignateMine; this.hotKey = KeyBindingDef.Named( "MineVein" ); this.tutorHighlightTag = "DesignatorMine"; }
public Designator_SmoothWall() { this.defaultLabel = SmoothWall.label; this.defaultDesc = SmoothWall.description; this.icon = SmoothWall.icon; this.useMouseIcon = true; this.soundDragSustain = SoundDefOf.DesignateDragStandard; this.soundDragChanged = SoundDefOf.DesignateDragStandardChanged; this.soundSucceeded = SoundDefOf.DesignateSmoothFloor; this.hotKey = KeyBindingDef.Named("SmoothWall"); this.tutorHighlightTag = "SmoothFloor"; }
// Token: 0x06000005 RID: 5 RVA: 0x000020D0 File Offset: 0x000002D0 public Designator_ForcedRepair() { this.defaultLabel = Translator.Translate("Designator_ForcedRepair"); this.defaultDesc = Translator.Translate("Designator_ForcedRepairDesc"); this.icon = ContentFinder <Texture2D> .Get("Designations/ForcedRepair", true); this.soundDragSustain = SoundDefOf.Designate_DragStandard; this.soundDragChanged = SoundDefOf.Designate_DragStandard_Changed; this.useMouseIcon = true; this.soundSucceeded = SoundDefOf.Designate_Deconstruct; this.hotKey = KeyBindingDef.Named("DesignatorForcedRepair"); }
private void CheckKeyBindingToggle(KeyBindingDef keyBinding, ref bool value) { if (keyBinding.KeyDownEvent) { value = !value; if (value) { SoundDefOf.Checkbox_TurnedOn.PlayOneShotOnCamera(null); } else { SoundDefOf.Checkbox_TurnedOff.PlayOneShotOnCamera(null); } } }
public static void AddQuickGoToConfigPawnPage(List <ListableOption> optList) { if (Event.current.type == EventType.KeyDown) { KeyBindingDef quickKey = DefDatabase <KeyBindingDef> .GetNamed("Dev_QuickGoToConfigPawnPage"); if (quickKey.JustPressed) { Patch_DoMainMenuControls.GoToConfigPawnPage(); } } //optList.Add(new ListableOption((string)"RandomPlus.Debug.QuickStartButton".Translate(), () => { // GoToConfigPawnPage(); //}, (string)null)); }
public SquadShortcuts() { this.squadSelectionBindings.Clear(); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad1")); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad2")); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad3")); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad4")); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad5")); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad6")); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad7")); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad8")); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad9")); this.squadSelectionBindings.Add(KeyBindingDef.Named("EdB_Interface_Squad10")); this.nextSquadKeyBinding = KeyBindingDef.Named("EdB_Interface_NextSquad"); this.previousSquadKeyBinding = KeyBindingDef.Named("EdB_Interface_PreviousSquad"); }
public override IEnumerable <Gizmo> GetWornGizmos() { Designator_PutInInventory designator = new Designator_PutInInventory(); designator.backpack = this; designator.icon = ContentFinder <Texture2D> .Get("UI/Commands/IconPutIn"); designator.defaultLabel = DesignatorPutInInventoryDefaultLabel + "(" + wearer.inventory.container.Count + "/" + MaxItem + ")"; designator.defaultDesc = DesignatorPutInInventoryDefaultDesc + wearer.inventory.container.Count + "/" + MaxItem; designator.hotKey = KeyBindingDef.Named("CommandPutInInventory"); designator.activateSound = SoundDef.Named("Click"); yield return(designator); Gizmo_BackpackEquipment gizmo = new Gizmo_BackpackEquipment(); gizmo.backpack = this; yield return(gizmo); }
//public override void Tick() //{ // base.Tick(); // //Put on backpack // if (postWearer == null && wearer != null) // { // postWearer = wearer; // } // // //Put off backpack. Should drop all from postWearer // else if (postWearer != null && wearer == null) // { // slotsComp.slots.TryDropAll(postWearer.Position, ThingPlaceMode.Near); // postWearer = null; // } //} public override IEnumerable <Gizmo> GetWornGizmos() { Designator_PutInToolbeltSlot designator2 = new Designator_PutInToolbeltSlot(); designator2.SlotsToolbeltComp = slotsComp; designator2.defaultLabel = string.Format("Put in ({0}/{1})", slotsComp.slots.Count, MaxItem); designator2.defaultDesc = string.Format("Put thing in {0}.", Label); designator2.hotKey = KeyBindingDef.Named("CommandPutInInventory"); designator2.activateSound = SoundDef.Named("Click"); // not used, but need to be defined, so that gizmo could accept actions designator2.icon = def.uiIcon; designator2.MaxItem = MaxItem; yield return(designator2); Gizmo_ToolbeltEquipment gizmo = new Gizmo_ToolbeltEquipment(); gizmo.toolbelt = this; yield return(gizmo); }
private void SettingButtonClicked(KeyBindingDef keyDef, KeyPrefs.BindingSlot slot) { if (Event.current.button == 0) { Find.WindowStack.Add(new Dialog_DefineBinding(keyPrefsData, keyDef, slot)); Event.current.Use(); } else if (Event.current.button == 1) { List <FloatMenuOption> list = new List <FloatMenuOption>(); list.Add(new FloatMenuOption("ResetBinding".Translate(), delegate { KeyCode keyCode = (slot != 0) ? keyDef.defaultKeyCodeB : keyDef.defaultKeyCodeA; keyPrefsData.SetBinding(keyDef, slot, keyCode); })); list.Add(new FloatMenuOption("ClearBinding".Translate(), delegate { keyPrefsData.SetBinding(keyDef, slot, KeyCode.None); })); Find.WindowStack.Add(new FloatMenu(list)); } }
public static bool AttemptToInitialiseKeys() { attemptedInitialise = true; try { key = KeyBindingDef.Named("DubsOptimizerKey"); restartkey = KeyBindingDef.Named("DubsOptimizerRestartKey"); alertKey = KeyBindingDef.Named("dpa_ToggleAlertBlock"); var biff = new HarmonyMethod(typeof(H_KeyPresses).GetMethod(nameof(OnGUI))); var skiff = typeof(UIRoot_Entry).GetMethod(nameof(UIRoot_Entry.UIRootOnGUI)); Modbase.StaticHarmony.Patch(skiff, biff); skiff = typeof(UIRoot_Play).GetMethod(nameof(UIRoot_Play.UIRootOnGUI)); Modbase.StaticHarmony.Patch(skiff, biff); } catch (Exception e) { ThreadSafeLogger.ReportException(e, "Failed to load keybindings"); return(false); } return(true); }
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); } }
public DesignatorEntry(Designator_SelectableThings designator, KeyBindingDef key, SettingHandle<bool> visibilitySetting) { this.designator = designator; this.key = key; this.visibilitySetting = visibilitySetting; }
public override void DoWindowContents(Rect inRect) { Vector2 vector = new Vector2(120f, 40f); float y = vector.y; float num = 600f; float num2 = (inRect.width - num) / 2f; Rect position = new Rect(num2 + inRect.x, inRect.y, num, inRect.height - (y + 10f)).ContractedBy(10f); Rect position2 = new Rect(position.x, position.y + position.height + 10f, position.width, y); GUI.BeginGroup(position); Rect rect = new Rect(0f, 0f, position.width, 40f); Text.Font = GameFont.Medium; GenUI.SetLabelAlign(TextAnchor.MiddleCenter); Widgets.Label(rect, "KeyboardConfig".Translate()); GenUI.ResetLabelAlign(); Text.Font = GameFont.Small; Rect outRect = new Rect(0f, rect.height, position.width, position.height - rect.height); Rect rect2 = new Rect(0f, 0f, outRect.width - 16f, contentHeight); Widgets.BeginScrollView(outRect, ref scrollPosition, rect2); float curY = 0f; KeyBindingCategoryDef keyBindingCategoryDef = null; keyBindingsWorkingList.Clear(); keyBindingsWorkingList.AddRange(DefDatabase <KeyBindingDef> .AllDefs); keyBindingsWorkingList.SortBy((KeyBindingDef x) => x.category.index, (KeyBindingDef x) => x.index); for (int i = 0; i < keyBindingsWorkingList.Count; i++) { KeyBindingDef keyBindingDef = keyBindingsWorkingList[i]; if (keyBindingCategoryDef != keyBindingDef.category) { bool skipDrawing = curY - scrollPosition.y + 40f < 0f || curY - scrollPosition.y > outRect.height; keyBindingCategoryDef = keyBindingDef.category; DrawCategoryEntry(keyBindingCategoryDef, rect2.width, ref curY, skipDrawing); } bool skipDrawing2 = curY - scrollPosition.y + 34f < 0f || curY - scrollPosition.y > outRect.height; DrawKeyEntry(keyBindingDef, rect2, ref curY, skipDrawing2); } Widgets.EndScrollView(); GUI.EndGroup(); GUI.BeginGroup(position2); int num3 = 3; float num4 = vector.x * (float)num3 + 10f * (float)(num3 - 1); float num5 = (position2.width - num4) / 2f; float num6 = vector.x + 10f; Rect rect3 = new Rect(num5, 0f, vector.x, vector.y); Rect rect4 = new Rect(num5 + num6, 0f, vector.x, vector.y); Rect rect5 = new Rect(num5 + num6 * 2f, 0f, vector.x, vector.y); if (Widgets.ButtonText(rect3, "ResetButton".Translate())) { keyPrefsData.ResetToDefaults(); keyPrefsData.ErrorCheck(); SoundDefOf.Tick_Low.PlayOneShotOnCamera(); Event.current.Use(); } if (Widgets.ButtonText(rect4, "CancelButton".Translate())) { Close(); Event.current.Use(); } if (Widgets.ButtonText(rect5, "OK".Translate())) { KeyPrefs.KeyPrefsData = keyPrefsData; KeyPrefs.Save(); Close(); keyPrefsData.ErrorCheck(); Event.current.Use(); } GUI.EndGroup(); }
static bool Prefix(KeyBindingDef __instance) => !(__instance == KeyBindingDefOf.QueueOrder && shouldQueue.HasValue);
public DesignatorEntry(Designator_SelectableThings designator, KeyBindingDef key) { this.designator = designator; this.key = key; }
internal Hotkey(KeyBindingDef def) => Def = def;
public HotkeyListener(Designator designator, KeyBindingDef hotKey) { this.designator = designator; this.hotKey = hotKey; }
private static ushort <DoWindowContents> m__1(KeyBindingDef x) { return(x.index); }
public override void DoWindowContents(Rect inRect) { Vector2 vector = new Vector2(120f, 40f); float y = vector.y; float num = 600f; float num2 = (float)((inRect.width - num) / 2.0); Rect position = new Rect(num2 + inRect.x, inRect.y, num, (float)(inRect.height - (y + 10.0))).ContractedBy(10f); Rect position2 = new Rect(position.x, (float)(position.y + position.height + 10.0), position.width, y); GUI.BeginGroup(position); Rect rect = new Rect(0f, 0f, position.width, 40f); Text.Font = GameFont.Medium; GenUI.SetLabelAlign(TextAnchor.MiddleCenter); Widgets.Label(rect, "KeyboardConfig".Translate()); GenUI.ResetLabelAlign(); Text.Font = GameFont.Small; Rect outRect = new Rect(0f, rect.height, position.width, position.height - rect.height); Rect rect2 = new Rect(0f, 0f, (float)(outRect.width - 16.0), this.contentHeight); Widgets.BeginScrollView(outRect, ref this.scrollPosition, rect2, true); float num3 = 0f; KeyBindingCategoryDef keyBindingCategoryDef = null; Dialog_KeyBindings.keyBindingsWorkingList.Clear(); Dialog_KeyBindings.keyBindingsWorkingList.AddRange(DefDatabase <KeyBindingDef> .AllDefs); Dialog_KeyBindings.keyBindingsWorkingList.SortBy((KeyBindingDef x) => x.category.index, (KeyBindingDef x) => x.index); for (int i = 0; i < Dialog_KeyBindings.keyBindingsWorkingList.Count; i++) { KeyBindingDef keyBindingDef = Dialog_KeyBindings.keyBindingsWorkingList[i]; if (keyBindingCategoryDef != keyBindingDef.category) { bool skipDrawing = num3 - this.scrollPosition.y + 40.0 < 0.0 || num3 - this.scrollPosition.y > outRect.height; keyBindingCategoryDef = keyBindingDef.category; this.DrawCategoryEntry(keyBindingCategoryDef, rect2.width, ref num3, skipDrawing); } bool skipDrawing2 = num3 - this.scrollPosition.y + 34.0 < 0.0 || num3 - this.scrollPosition.y > outRect.height; this.DrawKeyEntry(keyBindingDef, rect2, ref num3, skipDrawing2); } Widgets.EndScrollView(); GUI.EndGroup(); GUI.BeginGroup(position2); int num4 = 3; float num5 = (float)(vector.x * (float)num4 + 10.0 * (float)(num4 - 1)); float num6 = (float)((position2.width - num5) / 2.0); float num7 = (float)(vector.x + 10.0); Rect rect3 = new Rect(num6, 0f, vector.x, vector.y); Rect rect4 = new Rect(num6 + num7, 0f, vector.x, vector.y); Rect rect5 = new Rect((float)(num6 + num7 * 2.0), 0f, vector.x, vector.y); if (Widgets.ButtonText(rect3, "ResetButton".Translate(), true, false, true)) { this.keyPrefsData.ResetToDefaults(); this.keyPrefsData.ErrorCheck(); SoundDefOf.TickLow.PlayOneShotOnCamera(null); Event.current.Use(); } if (Widgets.ButtonText(rect4, "CancelButton".Translate(), true, false, true)) { this.Close(true); Event.current.Use(); } if (Widgets.ButtonText(rect5, "OK".Translate(), true, false, true)) { KeyPrefs.KeyPrefsData = this.keyPrefsData; KeyPrefs.Save(); this.Close(true); this.keyPrefsData.ErrorCheck(); Event.current.Use(); } GUI.EndGroup(); }
public DesignatorEntry(Designator_MineTool designator, KeyBindingDef key) { this.designator = designator; this.key = key; }
public CinematicCameraManager(Game game) { toggleCamera = KeyBindingDef.Named("CinematicCamera"); }