mirror of
https://github.com/osukey/osukey.git
synced 2025-05-08 23:27:38 +09:00
Merge pull request #3811 from peppy/fix-async-profile-logic
Fix loading scores on profile pages potentially causing long blocking operations
This commit is contained in:
commit
b0adab5f96
@ -7,8 +7,8 @@ using osu.Framework.Graphics.Containers;
|
|||||||
using osu.Game.Online.API.Requests;
|
using osu.Game.Online.API.Requests;
|
||||||
using osu.Game.Users;
|
using osu.Game.Users;
|
||||||
using System;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Online.API.Requests.Responses;
|
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
namespace osu.Game.Overlays.Profile.Sections.Ranks
|
||||||
{
|
{
|
||||||
@ -39,33 +39,34 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
|
|||||||
foreach (var s in scores)
|
foreach (var s in scores)
|
||||||
s.Ruleset = Rulesets.GetRuleset(s.RulesetID);
|
s.Ruleset = Rulesets.GetRuleset(s.RulesetID);
|
||||||
|
|
||||||
ShowMoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0);
|
|
||||||
ShowMoreLoading.Hide();
|
|
||||||
|
|
||||||
if (!scores.Any() && VisiblePages == 1)
|
if (!scores.Any() && VisiblePages == 1)
|
||||||
{
|
{
|
||||||
|
ShowMoreButton.Hide();
|
||||||
|
ShowMoreLoading.Hide();
|
||||||
MissingText.Show();
|
MissingText.Show();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MissingText.Hide();
|
IEnumerable<DrawableProfileScore> drawableScores;
|
||||||
|
|
||||||
foreach (APIScoreInfo score in scores)
|
switch (type)
|
||||||
{
|
{
|
||||||
DrawableProfileScore drawableScore;
|
default:
|
||||||
|
drawableScores = scores.Select(score => new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null));
|
||||||
switch (type)
|
break;
|
||||||
{
|
case ScoreType.Recent:
|
||||||
default:
|
drawableScores = scores.Select(score => new DrawableTotalScore(score));
|
||||||
drawableScore = new DrawablePerformanceScore(score, includeWeight ? Math.Pow(0.95, ItemsContainer.Count) : (double?)null);
|
break;
|
||||||
break;
|
|
||||||
case ScoreType.Recent:
|
|
||||||
drawableScore = new DrawableTotalScore(score);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemsContainer.Add(drawableScore);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LoadComponentsAsync(drawableScores, s =>
|
||||||
|
{
|
||||||
|
MissingText.Hide();
|
||||||
|
ShowMoreButton.FadeTo(scores.Count == ItemsPerPage ? 1 : 0);
|
||||||
|
ShowMoreLoading.Hide();
|
||||||
|
|
||||||
|
ItemsContainer.AddRange(s);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
Api.Queue(request);
|
Api.Queue(request);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user