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

Allow for long online IDs and implement in ScoreInfo

This commit is contained in:
Dean Herbert 2021-10-29 11:48:36 +09:00
parent 7ab68525b4
commit 34d4715220
5 changed files with 8 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,7 @@ namespace osu.Game.Scoring
return ReferenceEquals(this, other);
}
public long OnlineID => OnlineScoreID ?? -1;
}
}