1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 21:07:33 +08:00

Merge pull request #9210 from peppy/fix-tourney-beatmap-change-ooo

Fix tournament displayed beatmap potentially being out of order on quick changes
This commit is contained in:
Dan Balasescu 2020-06-09 19:15:59 +09:00 committed by GitHub
commit 0d83b0f50a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -34,6 +34,7 @@ namespace osu.Game.Tournament.IPC
private int lastBeatmapId;
private ScheduledDelegate scheduled;
private GetBeatmapRequest beatmapLookupRequest;
public Storage Storage { get; private set; }
@ -77,6 +78,8 @@ namespace osu.Game.Tournament.IPC
if (lastBeatmapId != beatmapId)
{
beatmapLookupRequest?.Cancel();
lastBeatmapId = beatmapId;
var existing = ladder.CurrentMatch.Value?.Round.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId && b.BeatmapInfo != null);
@ -85,9 +88,9 @@ namespace osu.Game.Tournament.IPC
Beatmap.Value = existing.BeatmapInfo;
else
{
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId });
req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets);
API.Queue(req);
beatmapLookupRequest = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId });
beatmapLookupRequest.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets);
API.Queue(beatmapLookupRequest);
}
}