osu/osu.Game/Overlays/HoldToConfirmOverlay.cs

40 lines
1.2 KiB
C#
Raw Normal View History

// 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.
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics.Containers;
2018-11-20 07:51:59 +00:00
using osuTK.Graphics;
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 07:04:36 +00:00
public abstract class HoldToConfirmOverlay : HoldToConfirmContainer
{
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,
}
};
2019-02-21 09:56:34 +00:00
Progress.ValueChanged += e => overlay.Alpha = (float)e.NewValue;
}
}
}