1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 16:42:57 +08:00

Add placeholder download method with progress bar

This commit is contained in:
Dean Herbert 2017-08-24 18:51:50 +09:00
parent 36629f5207
commit cacf256aad
3 changed files with 36 additions and 1 deletions

View File

@ -12,6 +12,7 @@ using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Framework.Input;
namespace osu.Game.Overlays.Direct namespace osu.Game.Overlays.Direct
{ {
@ -171,5 +172,11 @@ namespace osu.Game.Overlays.Direct
}, },
}); });
} }
protected override bool OnClick(InputState state)
{
StartDownload();
return true;
}
} }
} }

View File

@ -124,6 +124,7 @@ namespace osu.Game.Overlays.Direct
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Size = new Vector2(height - vertical_padding * 2), Size = new Vector2(height - vertical_padding * 2),
Action = StartDownload
}, },
}, },
}, },

View File

@ -17,6 +17,8 @@ using osu.Game.Graphics.Sprites;
using OpenTK.Graphics; using OpenTK.Graphics;
using osu.Framework.Input; using osu.Framework.Input;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
namespace osu.Game.Overlays.Direct namespace osu.Game.Overlays.Direct
{ {
@ -30,6 +32,9 @@ namespace osu.Game.Overlays.Direct
private Container content; private Container content;
private APIAccess api;
private ProgressBar progressBar;
protected override Container<Drawable> Content => content; protected override Container<Drawable> Content => content;
protected DirectPanel(BeatmapSetInfo setInfo) protected DirectPanel(BeatmapSetInfo setInfo)
@ -38,8 +43,10 @@ namespace osu.Game.Overlays.Direct
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load(APIAccess api, OsuColour colours)
{ {
this.api = api;
AddInternal(content = new Container AddInternal(content = new Container
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
@ -60,6 +67,16 @@ namespace osu.Game.Overlays.Direct
Colour = Color4.Black, Colour = Color4.Black,
}, },
CreateBackground(), CreateBackground(),
progressBar = new ProgressBar
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
Height = 0,
Alpha = 0,
BackgroundColour = Color4.Black.Opacity(0.7f),
FillColour = colours.Blue,
Depth = -1,
},
} }
}); });
} }
@ -82,6 +99,16 @@ namespace osu.Game.Overlays.Direct
base.OnHoverLost(state); base.OnHoverLost(state);
} }
protected void StartDownload()
{
progressBar.FadeIn(400, Easing.OutQuint);
progressBar.ResizeHeightTo(4, 400, Easing.OutQuint);
progressBar.Current.Value = 0.5f;
api.Queue(new APIRequest());
}
protected override void LoadComplete() protected override void LoadComplete()
{ {
base.LoadComplete(); base.LoadComplete();