1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Handle GetBeatmapSetRequest on test room requests handler

Required for `BeatmapSetOverlay` lookups to work under dummy API. Not
100% sure about it, but works for now.
This commit is contained in:
Salman Ahmed 2022-07-14 02:31:37 +03:00
parent 099a7e90d6
commit 728487b7fb

View File

@ -136,6 +136,7 @@ namespace osu.Game.Tests.Visual.OnlinePlay
return true;
case GetBeatmapsRequest getBeatmapsRequest:
{
var result = new List<APIBeatmap>();
foreach (int id in getBeatmapsRequest.BeatmapIds)
@ -154,6 +155,24 @@ namespace osu.Game.Tests.Visual.OnlinePlay
getBeatmapsRequest.TriggerSuccess(new GetBeatmapsResponse { Beatmaps = result });
return true;
}
case GetBeatmapSetRequest getBeatmapSetRequest:
{
var baseBeatmap = getBeatmapSetRequest.Type == BeatmapSetLookupType.BeatmapId
? beatmapManager.QueryBeatmap(b => b.OnlineID == getBeatmapSetRequest.ID)
: beatmapManager.QueryBeatmap(b => b.BeatmapSet.OnlineID == getBeatmapSetRequest.ID);
if (baseBeatmap == null)
{
baseBeatmap = new TestBeatmap(new RulesetInfo { OnlineID = 0 }).BeatmapInfo;
baseBeatmap.OnlineID = getBeatmapSetRequest.ID;
baseBeatmap.BeatmapSet!.OnlineID = getBeatmapSetRequest.ID;
}
getBeatmapSetRequest.TriggerSuccess(OsuTestScene.CreateAPIBeatmapSet(baseBeatmap));
return true;
}
}
return false;