mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 12:02:55 +08:00
Add placeholder download method with progress bar
This commit is contained in:
parent
36629f5207
commit
cacf256aad
@ -12,6 +12,7 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Framework.Input;
|
||||
|
||||
namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
@ -171,5 +172,11 @@ namespace osu.Game.Overlays.Direct
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
StartDownload();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -124,6 +124,7 @@ namespace osu.Game.Overlays.Direct
|
||||
Anchor = Anchor.TopRight,
|
||||
Origin = Anchor.TopRight,
|
||||
Size = new Vector2(height - vertical_padding * 2),
|
||||
Action = StartDownload
|
||||
},
|
||||
},
|
||||
},
|
||||
|
@ -17,6 +17,8 @@ using osu.Game.Graphics.Sprites;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Input;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using osu.Game.Online.API;
|
||||
|
||||
namespace osu.Game.Overlays.Direct
|
||||
{
|
||||
@ -30,6 +32,9 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
private Container content;
|
||||
|
||||
private APIAccess api;
|
||||
private ProgressBar progressBar;
|
||||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
protected DirectPanel(BeatmapSetInfo setInfo)
|
||||
@ -38,8 +43,10 @@ namespace osu.Game.Overlays.Direct
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load()
|
||||
private void load(APIAccess api, OsuColour colours)
|
||||
{
|
||||
this.api = api;
|
||||
|
||||
AddInternal(content = new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
@ -60,6 +67,16 @@ namespace osu.Game.Overlays.Direct
|
||||
Colour = Color4.Black,
|
||||
},
|
||||
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);
|
||||
}
|
||||
|
||||
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()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
Loading…
Reference in New Issue
Block a user