2019-01-24 16:43:03 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using System;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
|
|
|
{
|
|
|
|
|
public class DownloadBeatmapSetRequest : APIDownloadRequest
|
|
|
|
|
{
|
|
|
|
|
public readonly BeatmapSetInfo BeatmapSet;
|
|
|
|
|
|
2019-01-31 18:08:45 +08:00
|
|
|
|
public float Progress;
|
|
|
|
|
|
2019-01-18 13:28:06 +08:00
|
|
|
|
public event Action<float> DownloadProgressed;
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
private readonly bool noVideo;
|
|
|
|
|
|
|
|
|
|
public DownloadBeatmapSetRequest(BeatmapSetInfo set, bool noVideo)
|
|
|
|
|
{
|
|
|
|
|
this.noVideo = noVideo;
|
|
|
|
|
BeatmapSet = set;
|
|
|
|
|
|
2019-01-31 18:08:45 +08:00
|
|
|
|
Progressed += (current, total) => DownloadProgressed?.Invoke(Progress = (float)current / total);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}";
|
|
|
|
|
}
|
|
|
|
|
}
|