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:
parent
ade7311c15
commit
d22a9df140
21
osu.Game/Online/API/Requests/GetBeatmapRequest.cs
Normal file
21
osu.Game/Online/API/Requests/GetBeatmapRequest.cs
Normal 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}";
|
||||
}
|
||||
}
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user