1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 23:50:42 +08:00

Merge pull request #15318 from peppy/beatmap-refactor/api-beatmap-serialisation-mutation

Allow setting of `APIBeatmap.Length` (and don't serialise twice)
This commit is contained in:
Dan Balasescu
2021-10-27 19:08:50 +09:00
committed by GitHub
Unverified
2 changed files with 8 additions and 3 deletions
@@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Online
{
AddAssert("is visible", () => overlay.State.Value == Visibility.Visible);
AddStep("show many results", () => fetchFor(Enumerable.Repeat(CreateAPIBeatmapSet(Ruleset.Value), 10).ToArray()));
AddStep("show many results", () => fetchFor(Enumerable.Repeat(CreateAPIBeatmapSet(Ruleset.Value), 100).ToArray()));
AddUntilStep("placeholder hidden", () => !overlay.ChildrenOfType<BeatmapListingOverlay.NotFoundDrawable>().Any(d => d.IsPresent));
@@ -54,10 +54,15 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"accuracy")]
private float overallDifficulty { get; set; }
public double Length => TimeSpan.FromSeconds(lengthInSeconds).TotalMilliseconds;
[JsonIgnore]
public double Length { get; set; }
[JsonProperty(@"total_length")]
private double lengthInSeconds { get; set; }
private double lengthInSeconds
{
get => TimeSpan.FromMilliseconds(Length).TotalSeconds;
set => Length = TimeSpan.FromSeconds(value).TotalMilliseconds;
}
[JsonProperty(@"count_circles")]
public int CircleCount { get; set; }