mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 17:43:05 +08:00
Update all EF based models to implement new read only interfaces
This commit is contained in:
parent
619dfe0690
commit
d309636460
@ -17,13 +17,14 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
[Serializable]
|
||||
public class BeatmapInfo : IEquatable<BeatmapInfo>, IHasPrimaryKey
|
||||
public class BeatmapInfo : IEquatable<BeatmapInfo>, IHasPrimaryKey, IBeatmapInfo
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
public int BeatmapVersion;
|
||||
|
||||
private int? onlineBeatmapID;
|
||||
private IRulesetInfo ruleset;
|
||||
|
||||
[JsonProperty("id")]
|
||||
public int? OnlineBeatmapID
|
||||
@ -187,5 +188,21 @@ namespace osu.Game.Beatmaps
|
||||
/// Returns a shallow-clone of this <see cref="BeatmapInfo"/>.
|
||||
/// </summary>
|
||||
public BeatmapInfo Clone() => (BeatmapInfo)MemberwiseClone();
|
||||
|
||||
#region Implementation of IHasOnlineID
|
||||
|
||||
public int? OnlineID => ID;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IBeatmapInfo
|
||||
|
||||
public string DifficultyName => Version;
|
||||
IBeatmapMetadataInfo IBeatmapInfo.Metadata => Metadata;
|
||||
public IBeatmapDifficultyInfo Difficulty => BaseDifficulty;
|
||||
IRulesetInfo IBeatmapInfo.Ruleset => Ruleset;
|
||||
public double StarRating => StarDifficulty;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ namespace osu.Game.Beatmaps
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
[Serializable]
|
||||
public class BeatmapMetadata : IEquatable<BeatmapMetadata>, IHasPrimaryKey
|
||||
public class BeatmapMetadata : IEquatable<BeatmapMetadata>, IHasPrimaryKey, IBeatmapMetadataInfo
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
@ -128,5 +128,7 @@ namespace osu.Game.Beatmaps
|
||||
&& AudioFile == other.AudioFile
|
||||
&& BackgroundFile == other.BackgroundFile;
|
||||
}
|
||||
|
||||
string IBeatmapMetadataInfo.Author => AuthorString;
|
||||
}
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ using osu.Game.IO;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
public class BeatmapSetFileInfo : INamedFileInfo, IHasPrimaryKey
|
||||
public class BeatmapSetFileInfo : INamedFileInfo, IHasPrimaryKey, INamedFileUsage
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
@ -19,5 +19,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
[Required]
|
||||
public string Filename { get; set; }
|
||||
|
||||
public IFileInfo File => FileInfo;
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ using osu.Game.Database;
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles<BeatmapSetFileInfo>, ISoftDelete, IEquatable<BeatmapSetInfo>
|
||||
public class BeatmapSetInfo : IHasPrimaryKey, IHasFiles<BeatmapSetFileInfo>, ISoftDelete, IEquatable<BeatmapSetInfo>, IBeatmapSetInfo
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
@ -90,5 +90,19 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
return ReferenceEquals(this, other);
|
||||
}
|
||||
|
||||
#region Implementation of IHasOnlineID
|
||||
|
||||
public int? OnlineID => ID;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Implementation of IBeatmapSetInfo
|
||||
|
||||
IBeatmapMetadataInfo IBeatmapSetInfo.Metadata => Metadata;
|
||||
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
||||
IEnumerable<INamedFileUsage> IBeatmapSetInfo.Files => Files;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
@ -2,6 +2,8 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Rulesets;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using osu.Game.Database;
|
||||
|
||||
#nullable enable
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
namespace osu.Game.Database
|
||||
{
|
||||
public interface IHasOnlineID
|
||||
{
|
@ -1,9 +1,11 @@
|
||||
// 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.
|
||||
|
||||
using osu.Game.IO;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
namespace osu.Game.Database
|
||||
{
|
||||
/// <summary>
|
||||
/// A usage of a file, with a local filename attached.
|
@ -6,7 +6,7 @@ using osu.Game.Database;
|
||||
|
||||
namespace osu.Game.IO
|
||||
{
|
||||
public class FileInfo : IHasPrimaryKey
|
||||
public class FileInfo : IHasPrimaryKey, IFileInfo
|
||||
{
|
||||
public int ID { get; set; }
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
namespace osu.Game.IO
|
||||
{
|
||||
/// <summary>
|
||||
/// A representation of a tracked file.
|
@ -2,11 +2,11 @@
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using System;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Database;
|
||||
|
||||
#nullable enable
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
namespace osu.Game.Rulesets
|
||||
{
|
||||
/// <summary>
|
||||
/// A representation of a ruleset's metadata.
|
@ -10,7 +10,7 @@ using osu.Framework.Testing;
|
||||
namespace osu.Game.Rulesets
|
||||
{
|
||||
[ExcludeFromDynamicCompile]
|
||||
public class RulesetInfo : IEquatable<RulesetInfo>
|
||||
public class RulesetInfo : IEquatable<RulesetInfo>, IRulesetInfo
|
||||
{
|
||||
public int? ID { get; set; }
|
||||
|
||||
@ -54,5 +54,11 @@ namespace osu.Game.Rulesets
|
||||
}
|
||||
|
||||
public override string ToString() => Name ?? $"{Name} ({ShortName}) ID: {ID}";
|
||||
|
||||
#region Implementation of IHasOnlineID
|
||||
|
||||
public int? OnlineID => ID;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user