diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
index 540f9b97a7..28afd082c3 100644
--- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
+++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
@@ -10,6 +10,16 @@ using osu.Game.Configuration;
namespace osu.Game.Graphics.Containers
{
+ ///
+ /// A container which adds a common "hold-to-perform" pattern to a container.
+ ///
+ ///
+ /// This container does not handle triggering the hold/abort operations.
+ /// To use this class, please call and when necessary.
+ ///
+ /// The is exposed as a transforming bindable which smoothly tracks the progress of a hold operation.
+ /// It can be used for animating and displaying progress directly.
+ ///
public abstract class HoldToConfirmContainer : Container
{
public const double DANGEROUS_HOLD_ACTIVATION_DELAY = 500;
@@ -70,6 +80,12 @@ namespace osu.Game.Graphics.Containers
config.BindWith(OsuSetting.UIHoldActivationDelay, holdActivationDelay);
}
+ ///
+ /// Begin a new confirmation. Should be called when the container is interacted with (ie. the user presses a key).
+ ///
+ ///
+ /// Calling this method when already in the process of confirming has no effect.
+ ///
protected void BeginConfirm()
{
if (confirming || (!AllowMultipleFires && Fired)) return;
@@ -79,12 +95,9 @@ namespace osu.Game.Graphics.Containers
this.TransformBindableTo(progress, 1, holdActivationDelay.Value * (1 - progress.Value), Easing.Out).OnComplete(_ => Confirm());
}
- protected virtual void Confirm()
- {
- Action?.Invoke();
- Fired = true;
- }
-
+ ///
+ /// Abort any ongoing confirmation. Should be called when the container's interaction is no longer valid (ie. the user releases a key).
+ ///
protected void AbortConfirm()
{
if (!AllowMultipleFires && Fired) return;
@@ -97,5 +110,15 @@ namespace osu.Game.Graphics.Containers
.Delay(200)
.TransformBindableTo(progress, 0, fadeout_delay, Easing.InSine);
}
+
+ ///
+ /// A method which is invoked when the confirmation sequence completes successfully.
+ /// By default, will fire the associated .
+ ///
+ protected virtual void Confirm()
+ {
+ Action?.Invoke();
+ Fired = true;
+ }
}
}