mirror of
https://github.com/ppy/osu.git
synced 2024-11-12 10:57:27 +08:00
16e48ed187
- Add noVideo option to DownloadBeatmapSetRequest - Make Download fire an event with new download instead of returning it
28 lines
875 B
C#
28 lines
875 B
C#
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
using osu.Game.Beatmaps;
|
|
using System;
|
|
|
|
namespace osu.Game.Online.API.Requests
|
|
{
|
|
public class DownloadBeatmapSetRequest : APIDownloadRequest
|
|
{
|
|
public readonly BeatmapSetInfo BeatmapSet;
|
|
|
|
public Action<float> DownloadProgressed;
|
|
|
|
private readonly bool noVideo;
|
|
|
|
public DownloadBeatmapSetRequest(BeatmapSetInfo set, bool noVideo)
|
|
{
|
|
this.noVideo = noVideo;
|
|
BeatmapSet = set;
|
|
|
|
Progress += (current, total) => DownloadProgressed?.Invoke((float) current / total);
|
|
}
|
|
|
|
protected override string Target => $@"beatmapsets/{BeatmapSet.OnlineBeatmapSetID}/download{(noVideo ? "?noVideo=1" : "")}";
|
|
}
|
|
}
|