mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 08:32:57 +08:00
Avoid constructor overhead for realm BeatmapInfo
parameterless constructor
This commit is contained in:
parent
64fe7d8dd3
commit
3faf980fed
@ -26,37 +26,35 @@ namespace osu.Game.Beatmaps
|
||||
public class BeatmapInfo : RealmObject, IHasGuidPrimaryKey, IBeatmapInfo, IEquatable<BeatmapInfo>
|
||||
{
|
||||
[PrimaryKey]
|
||||
public Guid ID { get; set; } = Guid.NewGuid();
|
||||
public Guid ID { get; set; }
|
||||
|
||||
public string DifficultyName { get; set; } = string.Empty;
|
||||
|
||||
public RulesetInfo Ruleset { get; set; }
|
||||
public RulesetInfo Ruleset { get; set; } = null!;
|
||||
|
||||
public BeatmapDifficulty Difficulty { get; set; }
|
||||
public BeatmapDifficulty Difficulty { get; set; } = null!;
|
||||
|
||||
public BeatmapMetadata Metadata { get; set; }
|
||||
public BeatmapMetadata Metadata { get; set; } = null!;
|
||||
|
||||
[Backlink(nameof(ScoreInfo.BeatmapInfo))]
|
||||
public IQueryable<ScoreInfo> Scores { get; } = null!;
|
||||
|
||||
public BeatmapInfo(RulesetInfo ruleset, BeatmapDifficulty difficulty, BeatmapMetadata metadata)
|
||||
public BeatmapInfo(RulesetInfo? ruleset = null, BeatmapDifficulty? difficulty = null, BeatmapMetadata? metadata = null)
|
||||
{
|
||||
Ruleset = ruleset;
|
||||
Difficulty = difficulty;
|
||||
Metadata = metadata;
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
public BeatmapInfo() // TODO: consider removing this and migrating all usages to ctor with parameters.
|
||||
{
|
||||
Ruleset = new RulesetInfo
|
||||
ID = Guid.NewGuid();
|
||||
Ruleset = ruleset ?? new RulesetInfo
|
||||
{
|
||||
OnlineID = 0,
|
||||
ShortName = @"osu",
|
||||
Name = @"null placeholder ruleset"
|
||||
};
|
||||
Difficulty = new BeatmapDifficulty();
|
||||
Metadata = new BeatmapMetadata();
|
||||
Difficulty = difficulty ?? new BeatmapDifficulty();
|
||||
Metadata = metadata ?? new BeatmapMetadata();
|
||||
}
|
||||
|
||||
[UsedImplicitly]
|
||||
private BeatmapInfo()
|
||||
{
|
||||
}
|
||||
|
||||
public BeatmapSetInfo? BeatmapSet { get; set; }
|
||||
|
Loading…
Reference in New Issue
Block a user