Fix many unnecessary requests being fired

This commit is contained in:
Dean Herbert
2018-11-10 08:37:21 +09:00
parent 1756ef95cb
commit 82d53e6f17

View File

@ -27,6 +27,8 @@ namespace osu.Game.Tournament.IPC
public readonly Bindable<LegacyMods> Mods = new Bindable<LegacyMods>(); public readonly Bindable<LegacyMods> Mods = new Bindable<LegacyMods>();
private int lastBeatmapId;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -45,8 +47,9 @@ namespace osu.Game.Tournament.IPC
var beatmapId = int.Parse(sr.ReadLine()); var beatmapId = int.Parse(sr.ReadLine());
var mods = int.Parse(sr.ReadLine()); var mods = int.Parse(sr.ReadLine());
if (Beatmap.Value?.OnlineBeatmapID != beatmapId) if (lastBeatmapId != beatmapId)
{ {
lastBeatmapId = beatmapId;
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId }); var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId });
req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets); req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets);
API.Queue(req); API.Queue(req);