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:
parent
099a7e90d6
commit
728487b7fb
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user