1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 10:12:54 +08:00

Merge pull request #15350 from peppy/long-online-id-score-info

Allow for `long` online IDs and implement in `ScoreInfo`
This commit is contained in:
Bartłomiej Dach 2021-10-30 15:02:31 +02:00 committed by GitHub
commit 7de16ff799
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 12 additions and 6 deletions

View File

@ -11,7 +11,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// A single beatmap difficulty.
/// </summary>
public interface IBeatmapInfo : IHasOnlineID
public interface IBeatmapInfo : IHasOnlineID<int>
{
/// <summary>
/// The user-specified name given to this beatmap.

View File

@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps
/// <summary>
/// A representation of a collection of beatmap difficulties, generally packaged as an ".osz" archive.
/// </summary>
public interface IBeatmapSetInfo : IHasOnlineID
public interface IBeatmapSetInfo : IHasOnlineID<int>
{
/// <summary>
/// The date when this beatmap was imported.

View File

@ -5,7 +5,7 @@
namespace osu.Game.Database
{
public interface IHasOnlineID
public interface IHasOnlineID<out T>
{
/// <summary>
/// The server-side ID representing this instance, if one exists. Any value 0 or less denotes a missing ID.
@ -14,6 +14,6 @@ namespace osu.Game.Database
/// Generally we use -1 when specifying "missing" in code, but values of 0 are also considered missing as the online source
/// is generally a MySQL autoincrement value, which can never be 0.
/// </remarks>
int OnlineID { get; }
T OnlineID { get; }
}
}

View File

@ -11,7 +11,7 @@ namespace osu.Game.Rulesets
/// <summary>
/// A representation of a ruleset's metadata.
/// </summary>
public interface IRulesetInfo : IHasOnlineID
public interface IRulesetInfo : IHasOnlineID<int>
{
/// <summary>
/// The user-exposed name of this ruleset.

View File

@ -19,7 +19,7 @@ using osu.Game.Utils;
namespace osu.Game.Scoring
{
public class ScoreInfo : IHasFiles<ScoreFileInfo>, IHasPrimaryKey, ISoftDelete, IEquatable<ScoreInfo>, IDeepCloneable<ScoreInfo>
public class ScoreInfo : IHasFiles<ScoreFileInfo>, IHasPrimaryKey, ISoftDelete, IEquatable<ScoreInfo>, IDeepCloneable<ScoreInfo>, IHasOnlineID<long>
{
public int ID { get; set; }
@ -271,5 +271,11 @@ namespace osu.Game.Scoring
return ReferenceEquals(this, other);
}
#region Implementation of IHasOnlineID
public long OnlineID => OnlineScoreID ?? -1;
#endregion
}
}