mirror of
https://github.com/ppy/osu
synced 2024-12-27 01:12:45 +00:00
Add versioning of local scores
For any potential future usage
This commit is contained in:
parent
0648201844
commit
a4baa0a716
@ -196,6 +196,7 @@ namespace osu.Game.Tests.Scores.IO
|
|||||||
User = new APIUser { Username = "Test user" },
|
User = new APIUser { Username = "Test user" },
|
||||||
BeatmapInfo = beatmap.Beatmaps.First(),
|
BeatmapInfo = beatmap.Beatmaps.First(),
|
||||||
Ruleset = new OsuRuleset().RulesetInfo,
|
Ruleset = new OsuRuleset().RulesetInfo,
|
||||||
|
Version = "12345",
|
||||||
Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() },
|
Mods = new Mod[] { new OsuModHardRock(), new OsuModDoubleTime() },
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -203,6 +204,7 @@ namespace osu.Game.Tests.Scores.IO
|
|||||||
|
|
||||||
Assert.IsTrue(imported.Mods.Any(m => m is OsuModHardRock));
|
Assert.IsTrue(imported.Mods.Any(m => m is OsuModHardRock));
|
||||||
Assert.IsTrue(imported.Mods.Any(m => m is OsuModDoubleTime));
|
Assert.IsTrue(imported.Mods.Any(m => m is OsuModDoubleTime));
|
||||||
|
Assert.That(imported.Version, Is.EqualTo(toImport.Version));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
|
@ -41,6 +41,9 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
private BeatmapSetInfo? importedSet;
|
private BeatmapSetInfo? importedSet;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuGameBase osu { get; set; } = null!;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host, AudioManager audio)
|
private void load(GameHost host, AudioManager audio)
|
||||||
{
|
{
|
||||||
@ -153,6 +156,7 @@ namespace osu.Game.Tests.Visual.Gameplay
|
|||||||
|
|
||||||
AddUntilStep("results displayed", () => Player.GetChildScreen() is ResultsScreen);
|
AddUntilStep("results displayed", () => Player.GetChildScreen() is ResultsScreen);
|
||||||
AddUntilStep("score in database", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID) != null));
|
AddUntilStep("score in database", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID) != null));
|
||||||
|
AddUntilStep("score has correct version", () => Realm.Run(r => r.Find<ScoreInfo>(Player.Score.ScoreInfo.ID)!.Version), () => Is.EqualTo(osu.Version));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -90,8 +90,9 @@ namespace osu.Game.Database
|
|||||||
/// 36 2023-10-26 Add LegacyOnlineID to ScoreInfo. Move osu_scores_*_high IDs stored in OnlineID to LegacyOnlineID. Reset anomalous OnlineIDs.
|
/// 36 2023-10-26 Add LegacyOnlineID to ScoreInfo. Move osu_scores_*_high IDs stored in OnlineID to LegacyOnlineID. Reset anomalous OnlineIDs.
|
||||||
/// 38 2023-12-10 Add EndTimeObjectCount and TotalObjectCount to BeatmapInfo.
|
/// 38 2023-12-10 Add EndTimeObjectCount and TotalObjectCount to BeatmapInfo.
|
||||||
/// 39 2023-12-19 Migrate any EndTimeObjectCount and TotalObjectCount values of 0 to -1 to better identify non-calculated values.
|
/// 39 2023-12-19 Migrate any EndTimeObjectCount and TotalObjectCount values of 0 to -1 to better identify non-calculated values.
|
||||||
|
/// 40 2023-12-21 Add ScoreInfo.Version to keep track of which build scores were set on.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int schema_version = 39;
|
private const int schema_version = 40;
|
||||||
|
|
||||||
/// <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.
|
||||||
|
@ -46,6 +46,12 @@ namespace osu.Game.Scoring
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public BeatmapInfo? BeatmapInfo { get; set; }
|
public BeatmapInfo? BeatmapInfo { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The version of the client this score was set using.
|
||||||
|
/// Sourced from <see cref="OsuGameBase.Version"/> at the point of score submission.
|
||||||
|
/// </summary>
|
||||||
|
public string Version { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The <see cref="osu.Game.Beatmaps.BeatmapInfo.Hash"/> at the point in time when the score was set.
|
/// The <see cref="osu.Game.Beatmaps.BeatmapInfo.Hash"/> at the point in time when the score was set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -109,6 +109,9 @@ namespace osu.Game.Screens.Play
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private MusicController musicController { get; set; }
|
private MusicController musicController { get; set; }
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private OsuGameBase game { get; set; }
|
||||||
|
|
||||||
public GameplayState GameplayState { get; private set; }
|
public GameplayState GameplayState { get; private set; }
|
||||||
|
|
||||||
private Ruleset ruleset;
|
private Ruleset ruleset;
|
||||||
@ -1155,7 +1158,11 @@ namespace osu.Game.Screens.Play
|
|||||||
/// <returns>The <see cref="Scoring.Score"/>.</returns>
|
/// <returns>The <see cref="Scoring.Score"/>.</returns>
|
||||||
protected virtual Score CreateScore(IBeatmap beatmap) => new Score
|
protected virtual Score CreateScore(IBeatmap beatmap) => new Score
|
||||||
{
|
{
|
||||||
ScoreInfo = new ScoreInfo { User = api.LocalUser.Value },
|
ScoreInfo = new ScoreInfo
|
||||||
|
{
|
||||||
|
User = api.LocalUser.Value,
|
||||||
|
Version = game.Version,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user