1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 14:17:26 +08:00

Store user settings to realm

This commit is contained in:
Dean Herbert 2022-03-01 16:22:51 +09:00
parent fab09575ec
commit acf8db13ac
3 changed files with 24 additions and 1 deletions

View File

@ -40,6 +40,8 @@ namespace osu.Game.Beatmaps
[Backlink(nameof(ScoreInfo.BeatmapInfo))] [Backlink(nameof(ScoreInfo.BeatmapInfo))]
public IQueryable<ScoreInfo> Scores { get; } = null!; public IQueryable<ScoreInfo> Scores { get; } = null!;
public BeatmapUserSettings UserSettings { get; set; } = null!;
public BeatmapInfo(RulesetInfo? ruleset = null, BeatmapDifficulty? difficulty = null, BeatmapMetadata? metadata = null) public BeatmapInfo(RulesetInfo? ruleset = null, BeatmapDifficulty? difficulty = null, BeatmapMetadata? metadata = null)
{ {
ID = Guid.NewGuid(); ID = Guid.NewGuid();
@ -51,6 +53,7 @@ namespace osu.Game.Beatmaps
}; };
Difficulty = difficulty ?? new BeatmapDifficulty(); Difficulty = difficulty ?? new BeatmapDifficulty();
Metadata = metadata ?? new BeatmapMetadata(); Metadata = metadata ?? new BeatmapMetadata();
UserSettings = new BeatmapUserSettings();
} }
[UsedImplicitly] [UsedImplicitly]

View File

@ -0,0 +1,19 @@
// 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.
#nullable enable
using Realms;
namespace osu.Game.Beatmaps
{
/// <summary>
/// User settings overrides that are attached to a beatmap.
/// </summary>
public class BeatmapUserSettings : EmbeddedObject
{
/// <summary>
/// An audio offset that can be used for timing adjustments.
/// </summary>
public double Offset { get; set; }
}
}

View File

@ -54,8 +54,9 @@ namespace osu.Game.Database
/// 11 2021-11-22 Use ShortName instead of RulesetID for ruleset key bindings. /// 11 2021-11-22 Use ShortName instead of RulesetID for ruleset key bindings.
/// 12 2021-11-24 Add Status to RealmBeatmapSet. /// 12 2021-11-24 Add Status to RealmBeatmapSet.
/// 13 2022-01-13 Final migration of beatmaps and scores to realm (multiple new storage fields). /// 13 2022-01-13 Final migration of beatmaps and scores to realm (multiple new storage fields).
/// 14 2022-03-01 Added BeatmapUserSettings to BeatmapInfo.
/// </summary> /// </summary>
private const int schema_version = 13; private const int schema_version = 14;
/// <summary> /// <summary>
/// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods. /// Lock object which is held during <see cref="BlockAllOperations"/> sections, blocking realm retrieval during blocking periods.