Make LinkFlowContainer handle beatmap id lookup in game.

This commit is contained in:
naoey
2018-03-09 19:46:16 +05:30
parent 25524bf24f
commit c304c1eecf
4 changed files with 39 additions and 7 deletions

View File

@ -17,6 +17,7 @@ using osu.Game.Online.API.Requests;
using osu.Game.Overlays.BeatmapSet;
using osu.Game.Rulesets;
using osu.Game.Overlays.BeatmapSet.Scores;
using System.Linq;
namespace osu.Game.Overlays
{
@ -139,6 +140,23 @@ namespace osu.Game.Overlays
return true;
}
public void ShowBeatmap(int beatmapId)
{
var req = new GetBeatmapSetRequest(beatmapId, BeatmapSetLookupType.BeatmapId);
req.Success += res =>
{
ShowBeatmapSet(res.ToBeatmapSet(rulesets));
header.Picker.Beatmap.Value = header.BeatmapSet.Beatmaps.First(b => b.OnlineBeatmapID == beatmapId);
};
api.Queue(req);
}
public void ShowBeatmap(BeatmapInfo beatmap)
{
ShowBeatmapSet(beatmap.BeatmapSet);
header.Picker.Beatmap.Value = beatmap;
}
public void ShowBeatmapSet(int beatmapSetId)
{
// todo: display the overlay while we are loading here. we need to support setting BeatmapSet to null for this to work.