mirror of
https://github.com/ppy/osu.git
synced 2025-02-21 20:12:57 +08:00
Use already populated beatmap values if available
This commit is contained in:
parent
5659ba6ef8
commit
aebece3d89
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Framework.Platform.Windows;
|
using osu.Framework.Platform.Windows;
|
||||||
@ -25,9 +26,8 @@ namespace osu.Game.Tournament.IPC
|
|||||||
private int lastBeatmapId;
|
private int lastBeatmapId;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load(LadderInfo ladder)
|
||||||
{
|
{
|
||||||
|
|
||||||
StableStorage stable;
|
StableStorage stable;
|
||||||
|
|
||||||
try
|
try
|
||||||
@ -58,9 +58,17 @@ namespace osu.Game.Tournament.IPC
|
|||||||
if (lastBeatmapId != beatmapId)
|
if (lastBeatmapId != beatmapId)
|
||||||
{
|
{
|
||||||
lastBeatmapId = beatmapId;
|
lastBeatmapId = beatmapId;
|
||||||
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId });
|
|
||||||
req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets);
|
var existing = ladder.CurrentMatch.Value?.Grouping.Value?.Beatmaps.FirstOrDefault(b => b.ID == beatmapId && b.BeatmapInfo != null);
|
||||||
API.Queue(req);
|
|
||||||
|
if (existing != null)
|
||||||
|
Beatmap.Value = existing.BeatmapInfo;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
var req = new GetBeatmapRequest(new BeatmapInfo { OnlineBeatmapID = beatmapId });
|
||||||
|
req.Success += b => Beatmap.Value = b.ToBeatmap(Rulesets);
|
||||||
|
API.Queue(req);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Mods.Value = (LegacyMods)mods;
|
Mods.Value = (LegacyMods)mods;
|
||||||
|
Loading…
Reference in New Issue
Block a user