From a88779e5880f9a02b442ace50faf23c9a6bd4491 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 13 Oct 2023 13:10:04 +0200 Subject: [PATCH] Use dimmed placeholder text instead of empty box on cleared bindings --- .../Sections/Input/KeyBindingRow_KeyButton.cs | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow_KeyButton.cs b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow_KeyButton.cs index cf26300fb6..53d0f50605 100644 --- a/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow_KeyButton.cs +++ b/osu.Game/Overlays/Settings/Sections/Input/KeyBindingRow_KeyButton.cs @@ -12,11 +12,13 @@ using osu.Framework.Graphics.Shapes; using osu.Framework.Input; using osu.Framework.Input.Bindings; using osu.Framework.Input.Events; +using osu.Framework.Localisation; using osu.Game.Graphics; using osu.Game.Graphics.Sprites; using osu.Game.Graphics.UserInterface; using osu.Game.Input; using osu.Game.Input.Bindings; +using osu.Game.Localisation; using osuTK.Graphics; namespace osu.Game.Overlays.Settings.Sections.Input @@ -153,7 +155,20 @@ namespace osu.Game.Overlays.Settings.Sections.Input { Scheduler.AddOnce(updateText); - void updateText() => Text.Text = keyCombinationProvider.GetReadableString(KeyBinding.Value.KeyCombination); + void updateText() + { + LocalisableString keyCombinationString = keyCombinationProvider.GetReadableString(KeyBinding.Value.KeyCombination); + float alpha = 1; + + if (LocalisableString.IsNullOrEmpty(keyCombinationString)) + { + keyCombinationString = InputSettingsStrings.ActionHasNoKeyBinding; + alpha = 0.4f; + } + + Text.Text = keyCombinationString; + Text.Alpha = alpha; + } } protected override void Dispose(bool isDisposing)