1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-08 21:37:26 +08:00
osu-lazer/osu.Game/Beatmaps/Drawables/Cards/Buttons/DownloadButton.cs

74 lines
2.1 KiB
C#
Raw Normal View History

2021-10-18 03:34:31 +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.
2021-10-23 21:01:53 +08:00
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
2021-10-18 03:34:31 +08:00
using osu.Framework.Graphics.Sprites;
using osu.Game.Online.API.Requests.Responses;
2021-10-23 21:01:53 +08:00
using osu.Framework.Graphics.UserInterface;
using osu.Game.Online;
using osu.Game.Overlays;
using osuTK;
2021-10-18 03:34:31 +08:00
namespace osu.Game.Beatmaps.Drawables.Cards.Buttons
{
2021-10-23 21:01:53 +08:00
public class DownloadButton : CompositeDrawable
2021-10-18 03:34:31 +08:00
{
2021-10-23 21:01:53 +08:00
protected readonly DownloadIcon Download;
protected readonly PlayIcon Play;
protected readonly BeatmapDownloadTracker Tracker;
private readonly CircularProgress downloadProgress;
2021-10-18 03:34:31 +08:00
public DownloadButton(APIBeatmapSet beatmapSet)
{
2021-10-23 21:01:53 +08:00
Anchor = Anchor.Centre;
Origin = Anchor.Centre;
InternalChildren = new Drawable[]
{
Tracker = new BeatmapDownloadTracker(beatmapSet),
Download = new DownloadIcon(),
downloadProgress = new CircularProgress
{
Size = new Vector2(16),
InnerRadius = 0.1f,
},
Play = new PlayIcon()
};
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
downloadProgress.Colour = colourProvider.Highlight1;
}
protected override void LoadComplete()
{
base.LoadComplete();
((IBindable<double>)downloadProgress.Current).BindTo(Tracker.Progress);
}
protected class DownloadIcon : BeatmapCardIconButton
{
public DownloadIcon()
{
Icon.Icon = FontAwesome.Solid.Download;
}
}
protected class PlayIcon : BeatmapCardIconButton
{
public PlayIcon()
{
Icon.Icon = FontAwesome.Regular.PlayCircle;
}
2021-10-18 03:34:31 +08:00
}
// TODO: implement behaviour
}
}