From 1b6ab8e6d72239c9e60f41b2fad57852f92c3033 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bart=C5=82omiej=20Dach?= Date: Fri, 13 Sep 2024 11:33:06 +0200 Subject: [PATCH] Change default keybinding for seeking to previous/next objects (and clear old conflicting default) Closes https://github.com/ppy/osu/issues/29803. --- .../Visual/Editing/TestSceneEditorSeeking.cs | 14 ++++++------- osu.Game/Database/RealmAccess.cs | 20 ++++++++++++++++++- .../Input/Bindings/GlobalActionContainer.cs | 4 ++-- 3 files changed, 28 insertions(+), 10 deletions(-) diff --git a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs index 06facc546d02..9f16bed00ee4 100644 --- a/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs +++ b/osu.Game.Tests/Visual/Editing/TestSceneEditorSeeking.cs @@ -152,13 +152,13 @@ public void TestSeekBetweenObjects() }); AddStep("seek to 0", () => EditorClock.Seek(0)); - pressAndCheckTime(Key.Right, 1000, Key.ControlLeft); - pressAndCheckTime(Key.Right, 2250, Key.ControlLeft); - pressAndCheckTime(Key.Right, 3600, Key.ControlLeft); - pressAndCheckTime(Key.Right, 3600, Key.ControlLeft); - pressAndCheckTime(Key.Left, 2250, Key.ControlLeft); - pressAndCheckTime(Key.Left, 1000, Key.ControlLeft); - pressAndCheckTime(Key.Left, 1000, Key.ControlLeft); + pressAndCheckTime(Key.Right, 1000, Key.ControlLeft, Key.AltLeft); + pressAndCheckTime(Key.Right, 2250, Key.ControlLeft, Key.AltLeft); + pressAndCheckTime(Key.Right, 3600, Key.ControlLeft, Key.AltLeft); + pressAndCheckTime(Key.Right, 3600, Key.ControlLeft, Key.AltLeft); + pressAndCheckTime(Key.Left, 2250, Key.ControlLeft, Key.AltLeft); + pressAndCheckTime(Key.Left, 1000, Key.ControlLeft, Key.AltLeft); + pressAndCheckTime(Key.Left, 1000, Key.ControlLeft, Key.AltLeft); } private void pressAndCheckTime(Key key, double expectedTime, params Key[] modifiers) diff --git a/osu.Game/Database/RealmAccess.cs b/osu.Game/Database/RealmAccess.cs index cb91d6923bb3..58849a59cfe9 100644 --- a/osu.Game/Database/RealmAccess.cs +++ b/osu.Game/Database/RealmAccess.cs @@ -93,8 +93,9 @@ public class RealmAccess : IDisposable /// 40 2023-12-21 Add ScoreInfo.Version to keep track of which build scores were set on. /// 41 2024-04-17 Add ScoreInfo.TotalScoreWithoutMods for future mod multiplier rebalances. /// 42 2024-08-07 Update mania key bindings to reflect changes to ManiaAction + /// 43 2024-09-13 Reset default seek to previous/next object key bindings to avoid conflict with selection nudge hotkeys. /// - private const int schema_version = 42; + private const int schema_version = 43; /// /// Lock object which is held during sections, blocking realm retrieval during blocking periods. @@ -1192,6 +1193,23 @@ void remapKeyBinding(int oldAction, int newAction) } break; + + case 43: + { + // Clear default bindings for the chat focus toggle, + // as they would conflict with the newly-added leaderboard toggle. + var keyBindings = migration.NewRealm.All(); + + var seekToPreviousBinding = keyBindings.FirstOrDefault(bind => bind.ActionInt == (int)GlobalAction.EditorSeekToPreviousHitObject); + if (seekToPreviousBinding != null && seekToPreviousBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Control, InputKey.Left })) + migration.NewRealm.Remove(seekToPreviousBinding); + + var seekToNextBinding = keyBindings.FirstOrDefault(bind => bind.ActionInt == (int)GlobalAction.EditorSeekToNextHitObject); + if (seekToNextBinding != null && seekToNextBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Control, InputKey.Right })) + migration.NewRealm.Remove(seekToNextBinding); + + break; + } } Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms"); diff --git a/osu.Game/Input/Bindings/GlobalActionContainer.cs b/osu.Game/Input/Bindings/GlobalActionContainer.cs index aca0984e0fd4..68811a0b00fa 100644 --- a/osu.Game/Input/Bindings/GlobalActionContainer.cs +++ b/osu.Game/Input/Bindings/GlobalActionContainer.cs @@ -147,8 +147,8 @@ public static IEnumerable GetGlobalActionsFor(GlobalActionCategory 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.Control, InputKey.Left }, GlobalAction.EditorSeekToPreviousHitObject), - new KeyBinding(new[] { InputKey.Control, InputKey.Right }, GlobalAction.EditorSeekToNextHitObject), + new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.Left }, GlobalAction.EditorSeekToPreviousHitObject), + new KeyBinding(new[] { InputKey.Control, InputKey.Alt, InputKey.Right }, GlobalAction.EditorSeekToNextHitObject), new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.Left }, GlobalAction.EditorSeekToPreviousSamplePoint), new KeyBinding(new[] { InputKey.Control, InputKey.Shift, InputKey.Right }, GlobalAction.EditorSeekToNextSamplePoint), };