1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-30 04:23:21 +08:00

Add migration to update users which have previous default bindings for beat snap

This commit is contained in:
Dean Herbert 2024-12-23 22:14:03 +09:00
parent 097828ded2
commit 9ff4a58fa3
No known key found for this signature in database

View File

@ -96,7 +96,7 @@ namespace osu.Game.Database
/// 43 2024-10-14 Reset keybind for toggling FPS display to avoid conflict with "convert to stream" in the editor, if not already changed by user.
/// 44 2024-11-22 Removed several properties from BeatmapInfo which did not need to be persisted to realm.
/// </summary>
private const int schema_version = 44;
private const int schema_version = 45;
/// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.
@ -1205,6 +1205,22 @@ namespace osu.Game.Database
break;
}
case 45:
{
// Cycling beat snap divisors no longer requires holding shift (just control).
var keyBindings = migration.NewRealm.All<RealmKeyBinding>();
var nextBeatSnapBinding = keyBindings.FirstOrDefault(k => k.ActionInt == (int)GlobalAction.EditorCycleNextBeatSnapDivisor);
if (nextBeatSnapBinding != null && nextBeatSnapBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Shift, InputKey.Control, InputKey.MouseWheelLeft }))
migration.NewRealm.Remove(nextBeatSnapBinding);
var previousBeatSnapBinding = keyBindings.FirstOrDefault(k => k.ActionInt == (int)GlobalAction.EditorCyclePreviousBeatSnapDivisor);
if (previousBeatSnapBinding != null && previousBeatSnapBinding.KeyCombination.Keys.SequenceEqual(new[] { InputKey.Shift, InputKey.Control, InputKey.MouseWheelRight }))
migration.NewRealm.Remove(previousBeatSnapBinding);
break;
}
}
Logger.Log($"Migration completed in {stopwatch.ElapsedMilliseconds}ms");