From dbee936748439445d049ed3ddf6a9d164d2d7429 Mon Sep 17 00:00:00 2001 From: aQaTL Date: Mon, 9 Apr 2018 18:48:47 +0200 Subject: [PATCH 1/5] Allow mapping delete key via alt+delete key combination --- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 71c346d404..88005795ff 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -198,18 +198,29 @@ namespace osu.Game.Overlays.KeyBinding if (!HasFocus) return false; + KeyCombination keyCombination = KeyCombination.FromInputState(state); + switch (args.Key) { case Key.Escape: finalise(); return true; case Key.Delete: - bindTarget.UpdateKeyCombination(InputKey.None); - finalise(); - return true; + if (keyCombination.Equals(InputKey.Delete)) + { + bindTarget.UpdateKeyCombination(InputKey.None); + finalise(); + return true; + } + else if (keyCombination.Equals(new[] { InputKey.Alt, InputKey.Delete })) + { + keyCombination = InputKey.Delete; + } + + break; } - bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); + bindTarget.UpdateKeyCombination(keyCombination); if (!isModifier(args.Key)) finalise(); return true; From 38277bff35f5eb945958ecd485be489374dad3fc Mon Sep 17 00:00:00 2001 From: aQaTL Date: Tue, 10 Apr 2018 18:00:22 +0200 Subject: [PATCH 2/5] Changed mapping of deleting key binding to shift+delete --- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 25 +++++++------------ 1 file changed, 9 insertions(+), 16 deletions(-) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 88005795ff..63b5e8a7c1 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -200,24 +200,17 @@ namespace osu.Game.Overlays.KeyBinding KeyCombination keyCombination = KeyCombination.FromInputState(state); - switch (args.Key) + if (keyCombination.Equals(InputKey.Escape)) { - case Key.Escape: - finalise(); - return true; - case Key.Delete: - if (keyCombination.Equals(InputKey.Delete)) - { - bindTarget.UpdateKeyCombination(InputKey.None); - finalise(); - return true; - } - else if (keyCombination.Equals(new[] { InputKey.Alt, InputKey.Delete })) - { - keyCombination = InputKey.Delete; - } + finalise(); + return true; + } - break; + if (keyCombination.Equals(new[] { InputKey.Shift, InputKey.Delete })) + { + bindTarget.UpdateKeyCombination(InputKey.None); + finalise(); + return true; } bindTarget.UpdateKeyCombination(keyCombination); From 90beff83f6cabb47a26b4fb031322f9a3ccc2b0d Mon Sep 17 00:00:00 2001 From: aQaTL Date: Wed, 11 Apr 2018 08:07:26 +0200 Subject: [PATCH 3/5] Updated KeyBindingRow sprite text, adjusted KeyBindingOverlay width --- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 2 +- osu.Game/Overlays/KeyBindingOverlay.cs | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 63b5e8a7c1..6926e3d966 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -97,7 +97,7 @@ namespace osu.Game.Overlays.KeyBinding }, pressAKey = new OsuSpriteText { - Text = "Press a key to change binding, DEL to delete, ESC to cancel.", + Text = "Press a key to change binding, SHIFT+DEL to delete, ESC to cancel.", Y = height, Margin = new MarginPadding(padding), Alpha = 0, diff --git a/osu.Game/Overlays/KeyBindingOverlay.cs b/osu.Game/Overlays/KeyBindingOverlay.cs index b311ee68c0..3f393851c2 100644 --- a/osu.Game/Overlays/KeyBindingOverlay.cs +++ b/osu.Game/Overlays/KeyBindingOverlay.cs @@ -12,6 +12,8 @@ namespace osu.Game.Overlays { public class KeyBindingOverlay : SettingsOverlay { + protected const float WIDTH = 430; + protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!"); [BackgroundDependencyLoader(permitNulls: true)] @@ -21,6 +23,8 @@ namespace osu.Game.Overlays foreach (var ruleset in rulesets.AvailableRulesets) AddSection(new RulesetBindingsSection(ruleset)); + + ContentContainer.Width = WIDTH; } public KeyBindingOverlay() From 1dc8986c22cec2011005cc77f5f6a0d5fa691f55 Mon Sep 17 00:00:00 2001 From: aQaTL Date: Wed, 18 Apr 2018 15:06:03 +0200 Subject: [PATCH 4/5] Switched back to switch --- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 6926e3d966..4e06ce8211 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -198,22 +198,25 @@ namespace osu.Game.Overlays.KeyBinding if (!HasFocus) return false; - KeyCombination keyCombination = KeyCombination.FromInputState(state); - - if (keyCombination.Equals(InputKey.Escape)) + switch (args.Key) { - finalise(); - return true; + case Key.Escape: + finalise(); + return true; + case Key.Delete: + { + if (state.Keyboard.ShiftPressed) + { + bindTarget.UpdateKeyCombination(InputKey.None); + finalise(); + return true; + } + + break; + } } - if (keyCombination.Equals(new[] { InputKey.Shift, InputKey.Delete })) - { - bindTarget.UpdateKeyCombination(InputKey.None); - finalise(); - return true; - } - - bindTarget.UpdateKeyCombination(keyCombination); + bindTarget.UpdateKeyCombination(KeyCombination.FromInputState(state)); if (!isModifier(args.Key)) finalise(); return true; From addb864d1047202af87541763e24a116a4e3cd04 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Mon, 14 May 2018 15:41:31 +0900 Subject: [PATCH 5/5] Allow help text to wrap --- osu.Game/Overlays/KeyBinding/KeyBindingRow.cs | 14 ++++++++------ osu.Game/Overlays/KeyBindingOverlay.cs | 4 ---- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs index 41f23a8cd0..7406a9ec4f 100644 --- a/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs +++ b/osu.Game/Overlays/KeyBinding/KeyBindingRow.cs @@ -12,6 +12,7 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Game.Graphics; +using osu.Game.Graphics.Containers; using osu.Game.Graphics.Sprites; using osu.Game.Input; using OpenTK.Graphics; @@ -43,7 +44,7 @@ namespace osu.Game.Overlays.KeyBinding } private OsuSpriteText text; - private OsuSpriteText pressAKey; + private OsuTextFlowContainer pressAKey; private FillFlowContainer buttons; @@ -95,10 +96,11 @@ namespace osu.Game.Overlays.KeyBinding Anchor = Anchor.TopRight, Origin = Anchor.TopRight }, - pressAKey = new OsuSpriteText + pressAKey = new OsuTextFlowContainer { - Text = "Press a key to change binding, SHIFT+DEL to delete, ESC to cancel.", - Y = height, + Text = "Press a key to change binding, Shift+Delete to delete, Escape to cancel.", + RelativeSizeAxes = Axes.X, + AutoSizeAxes = Axes.Y, Margin = new MarginPadding(padding), Alpha = 0, Colour = colours.YellowDark @@ -268,7 +270,7 @@ namespace osu.Game.Overlays.KeyBinding GetContainingInputManager().ChangeFocus(null); pressAKey.FadeOut(300, Easing.OutQuint); - pressAKey.Padding = new MarginPadding { Bottom = -pressAKey.DrawHeight }; + pressAKey.Padding = new MarginPadding { Top = height, Bottom = -pressAKey.DrawHeight }; } protected override void OnFocus(InputState state) @@ -277,7 +279,7 @@ namespace osu.Game.Overlays.KeyBinding AutoSizeEasing = Easing.OutQuint; pressAKey.FadeIn(300, Easing.OutQuint); - pressAKey.Padding = new MarginPadding(); + pressAKey.Padding = new MarginPadding { Top = height }; updateBindTarget(); base.OnFocus(state); diff --git a/osu.Game/Overlays/KeyBindingOverlay.cs b/osu.Game/Overlays/KeyBindingOverlay.cs index bd9c8c20de..06432cfcea 100644 --- a/osu.Game/Overlays/KeyBindingOverlay.cs +++ b/osu.Game/Overlays/KeyBindingOverlay.cs @@ -12,8 +12,6 @@ namespace osu.Game.Overlays { public class KeyBindingOverlay : SettingsOverlay { - protected const float WIDTH = 430; - protected override Drawable CreateHeader() => new SettingsHeader("key configuration", "Customise your keys!"); [BackgroundDependencyLoader(permitNulls: true)] @@ -23,8 +21,6 @@ namespace osu.Game.Overlays foreach (var ruleset in rulesets.AvailableRulesets) AddSection(new RulesetBindingsSection(ruleset)); - - ContentContainer.Width = WIDTH; } public KeyBindingOverlay()