1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 18:43:04 +08:00

Make hit object and sample point seek keybinds configurable

This commit is contained in:
OliBomby 2024-07-09 12:28:23 +02:00
parent f36321a8ea
commit 306dc37ab5
3 changed files with 53 additions and 10 deletions

View File

@ -147,6 +147,10 @@ namespace osu.Game.Input.Bindings
new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.MouseWheelLeft }, GlobalAction.EditorCycleNextBeatSnapDivisor),
new KeyBinding(new[] { InputKey.Control, InputKey.R }, GlobalAction.EditorToggleRotateControl),
new KeyBinding(new[] { InputKey.Control, InputKey.E }, GlobalAction.EditorToggleScaleControl),
new KeyBinding(new[] { InputKey.Alt, InputKey.Left }, GlobalAction.EditorSeekToPreviousHitObject),
new KeyBinding(new[] { InputKey.Alt, InputKey.Right }, GlobalAction.EditorSeekToNextHitObject),
new KeyBinding(new[] { InputKey.Alt, InputKey.Shift, InputKey.Left }, GlobalAction.EditorSeekToPreviousSamplePoint),
new KeyBinding(new[] { InputKey.Alt, InputKey.Shift, InputKey.Right }, GlobalAction.EditorSeekToNextSamplePoint),
};
private static IEnumerable<KeyBinding> editorTestPlayKeyBindings => new[]
@ -456,6 +460,18 @@ namespace osu.Game.Input.Bindings
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorTestPlayQuickExitToCurrentTime))]
EditorTestPlayQuickExitToCurrentTime,
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSeekToPreviousHitObject))]
EditorSeekToPreviousHitObject,
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSeekToNextHitObject))]
EditorSeekToNextHitObject,
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSeekToPreviousSamplePoint))]
EditorSeekToPreviousSamplePoint,
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorSeekToNextSamplePoint))]
EditorSeekToNextSamplePoint,
}
public enum GlobalActionCategory

View File

@ -404,6 +404,26 @@ namespace osu.Game.Localisation
/// </summary>
public static LocalisableString DecreaseModSpeed => new TranslatableString(getKey(@"decrease_mod_speed"), @"Decrease mod speed");
/// <summary>
/// "Seek to previous hit object"
/// </summary>
public static LocalisableString EditorSeekToPreviousHitObject => new TranslatableString(getKey(@"editor_seek_to_previous_hit_object"), @"Seek to previous hit object");
/// <summary>
/// "Seek to next hit object"
/// </summary>
public static LocalisableString EditorSeekToNextHitObject => new TranslatableString(getKey(@"editor_seek_to_next_hit_object"), @"Seek to next hit object");
/// <summary>
/// "Seek to previous sample point"
/// </summary>
public static LocalisableString EditorSeekToPreviousSamplePoint => new TranslatableString(getKey(@"editor_seek_to_previous_sample_point"), @"Seek to previous sample point");
/// <summary>
/// "Seek to next sample point"
/// </summary>
public static LocalisableString EditorSeekToNextSamplePoint => new TranslatableString(getKey(@"editor_seek_to_next_sample_point"), @"Seek to next sample point");
private static string getKey(string key) => $@"{prefix}:{key}";
}
}

View File

@ -594,7 +594,7 @@ namespace osu.Game.Screens.Edit
protected override bool OnKeyDown(KeyDownEvent e)
{
if (e.ControlPressed || e.SuperPressed) return false;
if (e.ControlPressed || e.AltPressed || e.SuperPressed) return false;
switch (e.Key)
{
@ -746,6 +746,22 @@ namespace osu.Game.Screens.Edit
bottomBar.TestGameplayButton.TriggerClick();
return true;
case GlobalAction.EditorSeekToPreviousHitObject:
seekHitObject(-1);
return true;
case GlobalAction.EditorSeekToNextHitObject:
seekHitObject(1);
return true;
case GlobalAction.EditorSeekToPreviousSamplePoint:
seekSamplePoint(-1);
return true;
case GlobalAction.EditorSeekToNextSamplePoint:
seekSamplePoint(1);
return true;
default:
return false;
}
@ -1130,15 +1146,6 @@ namespace osu.Game.Screens.Edit
private void seek(UIEvent e, int direction)
{
if (e.AltPressed)
{
if (e.ShiftPressed)
seekSamplePoint(direction);
else
seekHitObject(direction);
return;
}
double amount = e.ShiftPressed ? 4 : 1;
bool trackPlaying = clock.IsRunning;