mirror of
https://github.com/ppy/osu.git
synced 2025-01-27 10:23:03 +08:00
Add key binding to deselect all mods
Defaults to `Backspace`.
This commit is contained in:
parent
6e74244022
commit
a759cf2dab
@ -1,4 +1,4 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
@ -416,6 +416,22 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
AddAssert("unimplemented mod panel is filtered", () => getPanelForMod(typeof(TestUnimplementedMod)).Filtered.Value);
|
AddAssert("unimplemented mod panel is filtered", () => getPanelForMod(typeof(TestUnimplementedMod)).Filtered.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public void TestDeselectAllViaKey()
|
||||||
|
{
|
||||||
|
createScreen();
|
||||||
|
changeRuleset(0);
|
||||||
|
|
||||||
|
AddStep("select DT + HD", () => SelectedMods.Value = new Mod[] { new OsuModDoubleTime(), new OsuModHidden() });
|
||||||
|
AddAssert("DT + HD selected", () => modSelectOverlay.ChildrenOfType<ModPanel>().Count(panel => panel.Active.Value) == 2);
|
||||||
|
|
||||||
|
AddStep("press bakcspace", () =>
|
||||||
|
{
|
||||||
|
InputManager.Key(Key.BackSpace);
|
||||||
|
});
|
||||||
|
AddUntilStep("all mods deselected", () => !SelectedMods.Value.Any());
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void TestDeselectAllViaButton()
|
public void TestDeselectAllViaButton()
|
||||||
{
|
{
|
||||||
|
@ -109,6 +109,7 @@ namespace osu.Game.Input.Bindings
|
|||||||
new KeyBinding(InputKey.F2, GlobalAction.SelectNextRandom),
|
new KeyBinding(InputKey.F2, GlobalAction.SelectNextRandom),
|
||||||
new KeyBinding(new[] { InputKey.Shift, InputKey.F2 }, GlobalAction.SelectPreviousRandom),
|
new KeyBinding(new[] { InputKey.Shift, InputKey.F2 }, GlobalAction.SelectPreviousRandom),
|
||||||
new KeyBinding(InputKey.F3, GlobalAction.ToggleBeatmapOptions),
|
new KeyBinding(InputKey.F3, GlobalAction.ToggleBeatmapOptions),
|
||||||
|
new KeyBinding(InputKey.BackSpace, GlobalAction.DeselectAllMods),
|
||||||
};
|
};
|
||||||
|
|
||||||
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
|
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
|
||||||
@ -318,5 +319,8 @@ namespace osu.Game.Input.Bindings
|
|||||||
|
|
||||||
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectNextGroup))]
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectNextGroup))]
|
||||||
SelectNextGroup,
|
SelectNextGroup,
|
||||||
|
|
||||||
|
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.DeselectAllMods))]
|
||||||
|
DeselectAllMods,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,6 +209,11 @@ namespace osu.Game.Localisation
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public static LocalisableString ToggleModSelection => new TranslatableString(getKey(@"toggle_mod_selection"), @"Toggle Mod Select");
|
public static LocalisableString ToggleModSelection => new TranslatableString(getKey(@"toggle_mod_selection"), @"Toggle Mod Select");
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// "Deselect all mods"
|
||||||
|
/// </summary>
|
||||||
|
public static LocalisableString DeselectAllMods => new TranslatableString(getKey(@"deselect_all_mods"), @"Deselect all mods");
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// "Random"
|
/// "Random"
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -508,6 +508,10 @@ namespace osu.Game.Overlays.Mods
|
|||||||
hideOverlay(true);
|
hideOverlay(true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
case GlobalAction.DeselectAllMods:
|
||||||
|
DeselectAll();
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnPressed(e);
|
return base.OnPressed(e);
|
||||||
|
Loading…
Reference in New Issue
Block a user