1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +08:00

Cancel request on leaving results screen

This commit is contained in:
Dean Herbert 2021-02-24 19:54:52 +09:00
parent 6a515391f0
commit 5dc0aefb2b

View File

@ -15,6 +15,8 @@ namespace osu.Game.Screens.Ranking
{
public class SoloResultsScreen : ResultsScreen
{
private GetScoresRequest getScoreRequest;
[Resolved]
private RulesetStore rulesets { get; set; }
@ -28,9 +30,16 @@ namespace osu.Game.Screens.Ranking
if (Score.Beatmap.OnlineBeatmapID == null || Score.Beatmap.Status <= BeatmapSetOnlineStatus.Pending)
return null;
var req = new GetScoresRequest(Score.Beatmap, Score.Ruleset);
req.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineScoreID != Score.OnlineScoreID).Select(s => s.CreateScoreInfo(rulesets)));
return req;
getScoreRequest = new GetScoresRequest(Score.Beatmap, Score.Ruleset);
getScoreRequest.Success += r => scoresCallback?.Invoke(r.Scores.Where(s => s.OnlineScoreID != this.Score.OnlineScoreID).Select(s => s.CreateScoreInfo(rulesets)));
return getScoreRequest;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
getScoreRequest?.Cancel();
}
}
}