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

Avoid constructor overhead for realm BeatmapMetadata parameterless constructor

This commit is contained in:
Dean Herbert 2022-01-20 17:14:51 +09:00
parent deb108816c
commit 6c10531df2

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using JetBrains.Annotations;
using Newtonsoft.Json;
using osu.Framework.Testing;
using osu.Game.Models;
@ -27,7 +28,7 @@ namespace osu.Game.Beatmaps
[JsonProperty("artist_unicode")]
public string ArtistUnicode { get; set; } = string.Empty;
public RealmUser Author { get; set; } = new RealmUser(); // TODO: not sure we want to initialise this only to have it overwritten by retrieval.
public RealmUser Author { get; set; } = null!;
public string Source { get; set; } = string.Empty;
@ -43,6 +44,16 @@ namespace osu.Game.Beatmaps
public string AudioFile { get; set; } = string.Empty;
public string BackgroundFile { get; set; } = string.Empty;
public BeatmapMetadata(RealmUser? user = null)
{
Author = new RealmUser();
}
[UsedImplicitly] // Realm
private BeatmapMetadata()
{
}
IUser IBeatmapMetadataInfo.Author => Author;
public override string ToString() => this.GetDisplayTitle();