1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00

Added new request for getting the beatmapset from only a difficulty map ID

This commit is contained in:
FreezyLemon 2017-12-02 09:47:20 +01:00
parent ade7311c15
commit d22a9df140
2 changed files with 35 additions and 0 deletions

View File

@ -0,0 +1,21 @@
using osu.Game.Beatmaps;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace osu.Game.Online.API.Requests
{
public class GetBeatmapRequest : APIRequest<BeatmapInfo>
{
private readonly int beatmapId;
public GetBeatmapRequest(int beatmapId)
{
this.beatmapId = beatmapId;
}
protected override string Target => $@"beatmaps/{beatmapId}";
}
}

View File

@ -139,6 +139,20 @@ namespace osu.Game.Overlays
return true;
}
public void ShowBeatmap(int beatmapId)
{
var req = new GetBeatmapRequest(beatmapId);
req.Success += res =>
{
if (!res.OnlineBeatmapSetID.HasValue)
return;
ShowBeatmapSet(res.OnlineBeatmapSetID.Value);
};
api.Queue(req);
}
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.