diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs index 653b011f73..2560502173 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmap.cs @@ -81,34 +81,6 @@ namespace osu.Game.Online.API.Requests.Responses public double BPM { get; set; } - public virtual BeatmapInfo ToBeatmapInfo(RulesetStore rulesets) - { - var set = BeatmapSet?.ToBeatmapSet(rulesets); - - return new BeatmapInfo - { - Metadata = set?.Metadata ?? new BeatmapMetadata(), - Ruleset = rulesets.GetRuleset(RulesetID), - StarDifficulty = StarRating, - OnlineBeatmapID = OnlineID, - Version = DifficultyName, - // this is actually an incorrect mapping (Length is calculated as drain length in lazer's import process, see BeatmapManager.calculateLength). - Length = Length, - Status = Status, - MD5Hash = Checksum, - BeatmapSet = set, - MaxCombo = MaxCombo, - BaseDifficulty = new BeatmapDifficulty - { - DrainRate = DrainRate, - CircleSize = CircleSize, - ApproachRate = ApproachRate, - OverallDifficulty = OverallDifficulty, - }, - OnlineInfo = this, - }; - } - #region Implementation of IBeatmapInfo public IBeatmapMetadataInfo Metadata => (BeatmapSet as IBeatmapSetInfo)?.Metadata ?? new BeatmapMetadata(); diff --git a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs index c41271ad5c..47536879b2 100644 --- a/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs +++ b/osu.Game/Online/API/Requests/Responses/APIBeatmapSet.cs @@ -3,11 +3,9 @@ using System; using System.Collections.Generic; -using System.Linq; using Newtonsoft.Json; using osu.Game.Beatmaps; using osu.Game.Database; -using osu.Game.Rulesets; using osu.Game.Users; #nullable enable @@ -121,26 +119,6 @@ namespace osu.Game.Online.API.Requests.Responses [JsonProperty(@"beatmaps")] public APIBeatmap[] Beatmaps { get; set; } = Array.Empty(); - public virtual BeatmapSetInfo ToBeatmapSet(RulesetStore rulesets) - { - var beatmapSet = new BeatmapSetInfo - { - OnlineBeatmapSetID = OnlineID, - Metadata = metadata, - Status = Status, - }; - - beatmapSet.Beatmaps = Beatmaps.Select(b => - { - var beatmap = b.ToBeatmapInfo(rulesets); - beatmap.BeatmapSet = beatmapSet; - beatmap.Metadata = beatmapSet.Metadata; - return beatmap; - }).ToList(); - - return beatmapSet; - } - private BeatmapMetadata metadata => new BeatmapMetadata { Title = Title, diff --git a/osu.Game/Online/API/Requests/Responses/APIScoreInfo.cs b/osu.Game/Online/API/Requests/Responses/APIScoreInfo.cs index 5395fe0429..82f56d27fd 100644 --- a/osu.Game/Online/API/Requests/Responses/APIScoreInfo.cs +++ b/osu.Game/Online/API/Requests/Responses/APIScoreInfo.cs @@ -98,7 +98,7 @@ namespace osu.Game.Online.API.Requests.Responses { TotalScore = TotalScore, MaxCombo = MaxCombo, - BeatmapInfo = Beatmap?.ToBeatmapInfo(rulesets), + BeatmapInfo = beatmap, User = User, Accuracy = Accuracy, OnlineScoreID = OnlineID, @@ -111,9 +111,6 @@ namespace osu.Game.Online.API.Requests.Responses Mods = modInstances, }; - if (beatmap != null) - scoreInfo.BeatmapInfo = beatmap; - if (Statistics != null) { foreach (var kvp in Statistics) diff --git a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs index 4a00c8b4a0..69739b3352 100644 --- a/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs +++ b/osu.Game/Overlays/BeatmapSet/Scores/ScoresContainer.cs @@ -1,6 +1,7 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System.Diagnostics; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -66,7 +67,18 @@ namespace osu.Game.Overlays.BeatmapSet.Scores if (value?.Scores.Any() != true) return; - scoreManager.OrderByTotalScoreAsync(value.Scores.Select(s => s.CreateScoreInfo(rulesets, Beatmap.Value.ToBeatmapInfo(rulesets))).ToArray(), loadCancellationSource.Token) + var apiBeatmap = Beatmap.Value; + + Debug.Assert(apiBeatmap != null); + + // TODO: temporary. should be removed once `OrderByTotalScore` can accept `IScoreInfo`. + var beatmapInfo = new BeatmapInfo + { + MaxCombo = apiBeatmap.MaxCombo, + Status = apiBeatmap.Status + }; + + scoreManager.OrderByTotalScoreAsync(value.Scores.Select(s => s.CreateScoreInfo(rulesets, beatmapInfo)).ToArray(), loadCancellationSource.Token) .ContinueWith(ordered => Schedule(() => { if (loadCancellationSource.IsCancellationRequested) @@ -74,11 +86,11 @@ namespace osu.Game.Overlays.BeatmapSet.Scores var topScore = ordered.Result.First(); - scoreTable.DisplayScores(ordered.Result, topScore.BeatmapInfo?.Status.GrantsPerformancePoints() == true); + scoreTable.DisplayScores(ordered.Result, apiBeatmap.Status.GrantsPerformancePoints()); scoreTable.Show(); var userScore = value.UserScore; - var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets, Beatmap.Value.ToBeatmapInfo(rulesets)); + var userScoreInfo = userScore?.Score.CreateScoreInfo(rulesets, beatmapInfo); topScoresContainer.Add(new DrawableTopScore(topScore));