diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index f92990fc5d..1df07070a1 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -7,8 +7,8 @@ using osu.Framework.Graphics.Containers; using osu.Game.Online.API.Requests; using osu.Game.Users; using System; +using System.Collections.Generic; using System.Linq; -using osu.Game.Online.API.Requests.Responses; namespace osu.Game.Overlays.Profile.Sections.Ranks { @@ -39,33 +39,34 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks foreach (var s in scores) s.Ruleset = Rulesets.GetRuleset(s.RulesetID); - ShowMoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0); - ShowMoreLoading.Hide(); - if (!scores.Any() && VisiblePages == 1) { + ShowMoreButton.Hide(); + ShowMoreLoading.Hide(); MissingText.Show(); return; } - MissingText.Hide(); + IEnumerable drawableScores; - foreach (APIScoreInfo score in scores) + switch (type) { - DrawableProfileScore drawableScore; - - switch (type) - { - default: - drawableScore = new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null); - break; - case ScoreType.Recent: - drawableScore = new DrawableTotalScore(score); - break; - } - - ItemsContainer.Add(drawableScore); + default: + drawableScores = scores.Select(score => new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null)); + break; + case ScoreType.Recent: + drawableScores = scores.Select(score => new DrawableTotalScore(score)); + break; } + + LoadComponentsAsync(drawableScores, s => + { + MissingText.Hide(); + ShowMoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0); + ShowMoreLoading.Hide(); + + ItemsContainer.AddRange(s); + }); }); Api.Queue(request);