1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00

Merge branch 'master' into snapping-tidy-distance

This commit is contained in:
Bartłomiej Dach 2022-05-05 13:15:24 +02:00 committed by GitHub
commit a9eae3a544
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 27 additions and 22 deletions

View File

@ -59,6 +59,9 @@ namespace osu.Game.Input.Bindings
new KeyBinding(InputKey.Up, GlobalAction.SelectPrevious),
new KeyBinding(InputKey.Down, GlobalAction.SelectNext),
new KeyBinding(InputKey.Left, GlobalAction.SelectPreviousGroup),
new KeyBinding(InputKey.Right, GlobalAction.SelectNextGroup),
new KeyBinding(InputKey.Space, GlobalAction.Select),
new KeyBinding(InputKey.Enter, GlobalAction.Select),
new KeyBinding(InputKey.KeypadEnter, GlobalAction.Select),
@ -105,7 +108,7 @@ namespace osu.Game.Input.Bindings
new KeyBinding(InputKey.F1, GlobalAction.ToggleModSelection),
new KeyBinding(InputKey.F2, GlobalAction.SelectNextRandom),
new KeyBinding(new[] { InputKey.Shift, InputKey.F2 }, GlobalAction.SelectPreviousRandom),
new KeyBinding(InputKey.F3, GlobalAction.ToggleBeatmapOptions)
new KeyBinding(InputKey.F3, GlobalAction.ToggleBeatmapOptions),
};
public IEnumerable<KeyBinding> AudioControlKeyBindings => new[]
@ -309,5 +312,11 @@ namespace osu.Game.Input.Bindings
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorDecreaseDistanceSpacing))]
EditorDecreaseDistanceSpacing,
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectPreviousGroup))]
SelectPreviousGroup,
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.SelectNextGroup))]
SelectNextGroup,
}
}

View File

@ -129,6 +129,16 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString SelectNext => new TranslatableString(getKey(@"select_next"), @"Next selection");
/// <summary>
/// "Select previous group"
/// </summary>
public static LocalisableString SelectPreviousGroup => new TranslatableString(getKey(@"select_previous_group"), @"Select previous group");
/// <summary>
/// "Select next group"
/// </summary>
public static LocalisableString SelectNextGroup => new TranslatableString(getKey(@"select_next_group"), @"Select next group");
/// <summary>
/// "Home"
/// </summary>

View File

@ -372,12 +372,12 @@ namespace osu.Game.Overlays.Volume
switch (e.Action)
{
case GlobalAction.SelectPrevious:
case GlobalAction.SelectPreviousGroup:
State = SelectionState.Selected;
adjust(1, false);
return true;
case GlobalAction.SelectNext:
case GlobalAction.SelectNextGroup:
State = SelectionState.Selected;
adjust(-1, false);
return true;

View File

@ -604,34 +604,20 @@ namespace osu.Game.Screens.Select
public void ScrollToSelected(bool immediate = false) =>
pendingScrollOperation = immediate ? PendingScrollOperation.Immediate : PendingScrollOperation.Standard;
#region Key / button selection logic
protected override bool OnKeyDown(KeyDownEvent e)
{
switch (e.Key)
{
case Key.Left:
SelectNext(-1);
return true;
case Key.Right:
SelectNext();
return true;
}
return false;
}
#region Button selection logic
public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
{
switch (e.Action)
{
case GlobalAction.SelectNext:
SelectNext(1, false);
case GlobalAction.SelectNextGroup:
SelectNext(1, e.Action == GlobalAction.SelectNextGroup);
return true;
case GlobalAction.SelectPrevious:
SelectNext(-1, false);
case GlobalAction.SelectPreviousGroup:
SelectNext(-1, e.Action == GlobalAction.SelectPreviousGroup);
return true;
}