2020-05-26 08:00:41 +00:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Linq;
|
|
|
|
using osu.Framework.Allocation;
|
2020-06-03 02:06:47 +00:00
|
|
|
using osu.Game.Beatmaps;
|
2020-05-26 08:00:41 +00:00
|
|
|
using osu.Game.Online.API;
|
|
|
|
using osu.Game.Online.API.Requests;
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
using osu.Game.Scoring;
|
|
|
|
|
|
|
|
namespace osu.Game.Screens.Ranking
|
|
|
|
{
|
|
|
|
public class SoloResultsScreen : ResultsScreen
|
|
|
|
{
|
2021-02-24 10:54:52 +00:00
|
|
|
private GetScoresRequest getScoreRequest;
|
|
|
|
|
2020-05-26 08:00:41 +00:00
|
|
|
[Resolved]
|
|
|
|
private RulesetStore rulesets { get; set; }
|
|
|
|
|
2020-11-20 05:35:44 +00:00
|
|
|
public SoloResultsScreen(ScoreInfo score, bool allowRetry)
|
2020-05-26 08:00:41 +00:00
|
|
|
: base(score, allowRetry)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override APIRequest FetchScores(Action<IEnumerable<ScoreInfo>> scoresCallback)
|
|
|
|
{
|
2021-12-14 10:47:11 +00:00
|
|
|
if (Score.BeatmapInfo.OnlineID <= 0 || Score.BeatmapInfo.Status <= BeatmapOnlineStatus.Pending)
|
2020-06-03 02:06:47 +00:00
|
|
|
return null;
|
|
|
|
|
2021-10-04 08:35:53 +00:00
|
|
|
getScoreRequest = new GetScoresRequest(Score.BeatmapInfo, Score.Ruleset);
|
2021-12-10 06:28:41 +00:00
|
|
|
getScoreRequest.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineID != Score.OnlineID).Select(s => s.CreateScoreInfo(rulesets, Beatmap.Value.BeatmapInfo)));
|
2021-02-24 10:54:52 +00:00
|
|
|
return getScoreRequest;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void Dispose(bool isDisposing)
|
|
|
|
{
|
|
|
|
base.Dispose(isDisposing);
|
|
|
|
|
|
|
|
getScoreRequest?.Cancel();
|
2020-05-26 08:00:41 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|