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-05-10 16:07:19 +08:00
|
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
2018-05-22 00:44:06 +08:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
2018-11-20 15:51:59 +08:00
|
|
|
|
using osuTK.Graphics;
|
2018-05-10 16:07:19 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// An overlay which will display a black screen that dims over a period before confirming an exit action.
|
|
|
|
|
/// Action is BYO (derived class will need to call <see cref="BeginConfirm"/> and <see cref="AbortConfirm"/> from a user event).
|
|
|
|
|
/// </summary>
|
2018-05-22 15:04:36 +08:00
|
|
|
|
public abstract class HoldToConfirmOverlay : HoldToConfirmContainer
|
2018-05-10 16:07:19 +08:00
|
|
|
|
{
|
|
|
|
|
private Box overlay;
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
|
private void load()
|
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.Both;
|
|
|
|
|
AlwaysPresent = true;
|
|
|
|
|
|
|
|
|
|
Children = new Drawable[]
|
|
|
|
|
{
|
|
|
|
|
overlay = new Box
|
|
|
|
|
{
|
|
|
|
|
Alpha = 0,
|
|
|
|
|
Colour = Color4.Black,
|
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2018-05-22 00:44:06 +08:00
|
|
|
|
Progress.ValueChanged += v => overlay.Alpha = (float)v;
|
2018-05-10 16:07:19 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|