mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Use similar method of consuming OnlineID
as done in beatmap classes
This commit is contained in:
parent
c9f6c5c673
commit
f7c5a3f506
@ -147,7 +147,7 @@ namespace osu.Game.Database
|
|||||||
|
|
||||||
modelBuilder.Entity<BeatmapInfo>().HasOne(b => b.BaseDifficulty);
|
modelBuilder.Entity<BeatmapInfo>().HasOne(b => b.BaseDifficulty);
|
||||||
|
|
||||||
modelBuilder.Entity<ScoreInfo>().HasIndex(b => b.OnlineScoreID).IsUnique();
|
modelBuilder.Entity<ScoreInfo>().HasIndex(b => b.OnlineID).IsUnique();
|
||||||
}
|
}
|
||||||
|
|
||||||
private class OsuDbLoggerFactory : ILoggerFactory
|
private class OsuDbLoggerFactory : ILoggerFactory
|
||||||
|
@ -137,7 +137,14 @@ namespace osu.Game.Scoring
|
|||||||
[Column("Beatmap")]
|
[Column("Beatmap")]
|
||||||
public BeatmapInfo BeatmapInfo { get; set; }
|
public BeatmapInfo BeatmapInfo { get; set; }
|
||||||
|
|
||||||
public long? OnlineScoreID { get; set; }
|
private long? onlineID;
|
||||||
|
|
||||||
|
[Column("OnlineScoreID")]
|
||||||
|
public long? OnlineID
|
||||||
|
{
|
||||||
|
get => onlineID;
|
||||||
|
set => onlineID = value > 0 ? value : null;
|
||||||
|
}
|
||||||
|
|
||||||
public DateTimeOffset Date { get; set; }
|
public DateTimeOffset Date { get; set; }
|
||||||
|
|
||||||
@ -243,12 +250,7 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
#region Implementation of IHasOnlineID
|
#region Implementation of IHasOnlineID
|
||||||
|
|
||||||
[NotMapped]
|
long IHasOnlineID<long>.OnlineID => OnlineID ?? -1;
|
||||||
public long OnlineID
|
|
||||||
{
|
|
||||||
get => OnlineScoreID ?? -1;
|
|
||||||
set => OnlineScoreID = value;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
@ -1031,7 +1031,7 @@ namespace osu.Game.Screens.Play
|
|||||||
//
|
//
|
||||||
// Until we better define the server-side logic behind this, let's not store the online ID to avoid potential unique constraint
|
// Until we better define the server-side logic behind this, let's not store the online ID to avoid potential unique constraint
|
||||||
// conflicts across various systems (ie. solo and multiplayer).
|
// conflicts across various systems (ie. solo and multiplayer).
|
||||||
long onlineScoreId = score.ScoreInfo.OnlineID;
|
long? onlineScoreId = score.ScoreInfo.OnlineID;
|
||||||
score.ScoreInfo.OnlineID = -1;
|
score.ScoreInfo.OnlineID = -1;
|
||||||
|
|
||||||
await scoreManager.Import(score.ScoreInfo, replayReader).ConfigureAwait(false);
|
await scoreManager.Import(score.ScoreInfo, replayReader).ConfigureAwait(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user