1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 20:22:55 +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
commit 07a486b78e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View File

@ -90,7 +90,7 @@ namespace osu.Game.Tests.Visual.Online
{ {
AddAssert("is visible", () => overlay.State.Value == Visibility.Visible); 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)); AddUntilStep("placeholder hidden", () => !overlay.ChildrenOfType<BeatmapListingOverlay.NotFoundDrawable>().Any(d => d.IsPresent));

View File

@ -54,10 +54,15 @@ namespace osu.Game.Online.API.Requests.Responses
[JsonProperty(@"accuracy")] [JsonProperty(@"accuracy")]
private float overallDifficulty { get; set; } private float overallDifficulty { get; set; }
public double Length => TimeSpan.FromSeconds(lengthInSeconds).TotalMilliseconds; [JsonIgnore]
public double Length { get; set; }
[JsonProperty(@"total_length")] [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")] [JsonProperty(@"count_circles")]
public int CircleCount { get; set; } public int CircleCount { get; set; }