mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Remove async calls from ScoreManager
This commit is contained in:
@ -8,10 +8,8 @@ using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Database;
|
||||
using osu.Game.Extensions;
|
||||
@ -150,17 +148,12 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
|
||||
var req = new GetScoresRequest(fetchBeatmapInfo, fetchRuleset, Scope, requestMods);
|
||||
|
||||
req.Success += r =>
|
||||
req.Success += r => Schedule(() =>
|
||||
{
|
||||
scoreManager.OrderByTotalScoreAsync(r.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo)).ToArray(), cancellationToken)
|
||||
.ContinueWith(task => Schedule(() =>
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
SetScores(task.GetResultSafely(), r.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo));
|
||||
}), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||
};
|
||||
SetScores(
|
||||
scoreManager.OrderByTotalScore(r.Scores.Select(s => s.ToScoreInfo(rulesets, fetchBeatmapInfo))),
|
||||
r.UserScore?.CreateScoreInfo(rulesets, fetchBeatmapInfo));
|
||||
});
|
||||
|
||||
return req;
|
||||
}
|
||||
@ -213,16 +206,9 @@ namespace osu.Game.Screens.Select.Leaderboards
|
||||
scores = scores.Where(s => s.Mods.Any(m => selectedMods.Contains(m.Acronym)));
|
||||
}
|
||||
|
||||
scores = scores.Detach();
|
||||
scores = scoreManager.OrderByTotalScore(scores.Detach());
|
||||
|
||||
scoreManager.OrderByTotalScoreAsync(scores.ToArray(), cancellationToken)
|
||||
.ContinueWith(ordered => Schedule(() =>
|
||||
{
|
||||
if (cancellationToken.IsCancellationRequested)
|
||||
return;
|
||||
|
||||
SetScores(ordered.GetResultSafely());
|
||||
}), TaskContinuationOptions.OnlyOnRanToCompletion);
|
||||
Schedule(() => SetScores(scores));
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user