mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 04:13:03 +08:00
Update all models to implement IHasNamedFiles
This commit is contained in:
parent
416ee2447a
commit
7488ccd5fe
@ -95,7 +95,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
IBeatmapMetadataInfo IBeatmapSetInfo.Metadata => Metadata ?? Beatmaps.FirstOrDefault()?.Metadata ?? new BeatmapMetadata();
|
IBeatmapMetadataInfo IBeatmapSetInfo.Metadata => Metadata ?? Beatmaps.FirstOrDefault()?.Metadata ?? new BeatmapMetadata();
|
||||||
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
||||||
IEnumerable<INamedFileUsage> IBeatmapSetInfo.Files => Files;
|
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
|
@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// A representation of a collection of beatmap difficulties, generally packaged as an ".osz" archive.
|
/// A representation of a collection of beatmap difficulties, generally packaged as an ".osz" archive.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public interface IBeatmapSetInfo : IHasOnlineID<int>, IEquatable<IBeatmapSetInfo>
|
public interface IBeatmapSetInfo : IHasOnlineID<int>, IEquatable<IBeatmapSetInfo>, IHasNamedFiles
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The date when this beatmap was imported.
|
/// The date when this beatmap was imported.
|
||||||
@ -29,11 +29,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
IEnumerable<IBeatmapInfo> Beatmaps { get; }
|
IEnumerable<IBeatmapInfo> Beatmaps { get; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// All files used by this set.
|
|
||||||
/// </summary>
|
|
||||||
IEnumerable<INamedFileUsage> Files { get; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The maximum star difficulty of all beatmaps in this set.
|
/// The maximum star difficulty of all beatmaps in this set.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
15
osu.Game/Database/IHasNamedFiles.cs
Normal file
15
osu.Game/Database/IHasNamedFiles.cs
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
// 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 System.Collections.Generic;
|
||||||
|
|
||||||
|
namespace osu.Game.Database
|
||||||
|
{
|
||||||
|
public interface IHasNamedFiles
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// All files used by this model.
|
||||||
|
/// </summary>
|
||||||
|
IEnumerable<INamedFileUsage> Files { get; }
|
||||||
|
}
|
||||||
|
}
|
@ -76,7 +76,6 @@ namespace osu.Game.Models
|
|||||||
public bool Equals(IBeatmapSetInfo? other) => other is RealmBeatmapSet b && Equals(b);
|
public bool Equals(IBeatmapSetInfo? other) => other is RealmBeatmapSet b && Equals(b);
|
||||||
|
|
||||||
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
IEnumerable<IBeatmapInfo> IBeatmapSetInfo.Beatmaps => Beatmaps;
|
||||||
|
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
|
||||||
IEnumerable<INamedFileUsage> IBeatmapSetInfo.Files => Files;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
IBeatmapMetadataInfo IBeatmapSetInfo.Metadata => metadata;
|
IBeatmapMetadataInfo IBeatmapSetInfo.Metadata => metadata;
|
||||||
|
|
||||||
DateTimeOffset IBeatmapSetInfo.DateAdded => throw new NotImplementedException();
|
DateTimeOffset IBeatmapSetInfo.DateAdded => throw new NotImplementedException();
|
||||||
IEnumerable<INamedFileUsage> IBeatmapSetInfo.Files => throw new NotImplementedException();
|
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => throw new NotImplementedException();
|
||||||
double IBeatmapSetInfo.MaxStarDifficulty => throw new NotImplementedException();
|
double IBeatmapSetInfo.MaxStarDifficulty => throw new NotImplementedException();
|
||||||
double IBeatmapSetInfo.MaxLength => throw new NotImplementedException();
|
double IBeatmapSetInfo.MaxLength => throw new NotImplementedException();
|
||||||
double IBeatmapSetInfo.MaxBPM => BPM;
|
double IBeatmapSetInfo.MaxBPM => BPM;
|
||||||
|
@ -8,6 +8,7 @@ using JetBrains.Annotations;
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using Newtonsoft.Json.Converters;
|
using Newtonsoft.Json.Converters;
|
||||||
using osu.Game.Beatmaps;
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Database;
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
@ -147,6 +148,7 @@ namespace osu.Game.Online.API.Requests.Responses
|
|||||||
}
|
}
|
||||||
|
|
||||||
public IRulesetInfo Ruleset => new RulesetInfo { OnlineID = RulesetID };
|
public IRulesetInfo Ruleset => new RulesetInfo { OnlineID = RulesetID };
|
||||||
|
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => throw new NotImplementedException();
|
||||||
|
|
||||||
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
|
IBeatmapInfo IScoreInfo.Beatmap => Beatmap;
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ using osu.Game.Rulesets;
|
|||||||
|
|
||||||
namespace osu.Game.Scoring
|
namespace osu.Game.Scoring
|
||||||
{
|
{
|
||||||
public interface IScoreInfo : IHasOnlineID<long>
|
public interface IScoreInfo : IHasOnlineID<long>, IHasNamedFiles
|
||||||
{
|
{
|
||||||
APIUser User { get; }
|
APIUser User { get; }
|
||||||
|
|
||||||
|
@ -7,7 +7,7 @@ using osu.Game.IO;
|
|||||||
|
|
||||||
namespace osu.Game.Scoring
|
namespace osu.Game.Scoring
|
||||||
{
|
{
|
||||||
public class ScoreFileInfo : INamedFileInfo, IHasPrimaryKey
|
public class ScoreFileInfo : INamedFileInfo, IHasPrimaryKey, INamedFileUsage
|
||||||
{
|
{
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
@ -17,5 +17,7 @@ namespace osu.Game.Scoring
|
|||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Filename { get; set; }
|
public string Filename { get; set; }
|
||||||
|
|
||||||
|
IFileInfo INamedFileUsage.File => FileInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -257,5 +257,7 @@ namespace osu.Game.Scoring
|
|||||||
bool IScoreInfo.HasReplay => Files.Any();
|
bool IScoreInfo.HasReplay => Files.Any();
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,7 +7,7 @@ using osu.Game.IO;
|
|||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
public class SkinFileInfo : INamedFileInfo, IHasPrimaryKey
|
public class SkinFileInfo : INamedFileInfo, IHasPrimaryKey, INamedFileUsage
|
||||||
{
|
{
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
@ -19,5 +19,7 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
[Required]
|
[Required]
|
||||||
public string Filename { get; set; }
|
public string Filename { get; set; }
|
||||||
|
|
||||||
|
IFileInfo INamedFileUsage.File => FileInfo;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ using osu.Game.IO;
|
|||||||
|
|
||||||
namespace osu.Game.Skinning
|
namespace osu.Game.Skinning
|
||||||
{
|
{
|
||||||
public class SkinInfo : IHasFiles<SkinFileInfo>, IEquatable<SkinInfo>, IHasPrimaryKey, ISoftDelete
|
public class SkinInfo : IHasFiles<SkinFileInfo>, IEquatable<SkinInfo>, IHasPrimaryKey, ISoftDelete, IHasNamedFiles
|
||||||
{
|
{
|
||||||
internal const int DEFAULT_SKIN = 0;
|
internal const int DEFAULT_SKIN = 0;
|
||||||
internal const int CLASSIC_SKIN = -1;
|
internal const int CLASSIC_SKIN = -1;
|
||||||
@ -55,5 +55,7 @@ namespace osu.Game.Skinning
|
|||||||
string author = Creator == null ? string.Empty : $"({Creator})";
|
string author = Creator == null ? string.Empty : $"({Creator})";
|
||||||
return $"{Name} {author}".Trim();
|
return $"{Name} {author}".Trim();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IEnumerable<INamedFileUsage> IHasNamedFiles.Files => Files;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user