diff --git a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
index 078721ec77..540f9b97a7 100644
--- a/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
+++ b/osu.Game/Graphics/Containers/HoldToConfirmContainer.cs
@@ -14,15 +14,18 @@ public abstract class HoldToConfirmContainer : Container
{
public const double DANGEROUS_HOLD_ACTIVATION_DELAY = 500;
+ private const int fadeout_delay = 200;
+
///
/// Whether the associated action is considered dangerous, warranting a longer hold.
///
public bool IsDangerousAction { get; }
+ ///
+ /// The action to perform when a hold successfully completes.
+ ///
public Action Action;
- private const int fadeout_delay = 200;
-
///
/// Whether currently in a fired state (and the confirm has been sent).
///
@@ -30,19 +33,24 @@ public abstract class HoldToConfirmContainer : Container
private bool confirming;
+ ///
+ /// The current activation delay for this control.
+ ///
+ public IBindable HoldActivationDelay => holdActivationDelay;
+
+ ///
+ /// The progress of any ongoing hold operation. 0 means no hold has started; 1 means a hold has been completed.
+ ///
+ public IBindable Progress => progress;
+
///
/// Whether the overlay should be allowed to return from a fired state.
///
protected virtual bool AllowMultipleFires => false;
- ///
- /// The current activation delay for this control.
- ///
- protected IBindable HoldActivationDelay => holdActivationDelay;
+ private readonly Bindable progress = new BindableDouble();
- public Bindable Progress = new BindableDouble();
-
- private Bindable holdActivationDelay;
+ private readonly Bindable holdActivationDelay = new Bindable();
[Resolved]
private OsuConfigManager config { get; set; }
@@ -57,15 +65,9 @@ protected override void LoadComplete()
base.LoadComplete();
if (IsDangerousAction)
- {
holdActivationDelay.Value = DANGEROUS_HOLD_ACTIVATION_DELAY;
- }
else
- {
- holdActivationDelay = HoldActivationDelay != null
- ? new Bindable(HoldActivationDelay.Value)
- : config.GetBindable(OsuSetting.UIHoldActivationDelay);
- }
+ config.BindWith(OsuSetting.UIHoldActivationDelay, holdActivationDelay);
}
protected void BeginConfirm()
@@ -74,7 +76,7 @@ protected void BeginConfirm()
confirming = true;
- this.TransformBindableTo(Progress, 1, holdActivationDelay.Value * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm());
+ this.TransformBindableTo(progress, 1, holdActivationDelay.Value * (1 - progress.Value), Easing.Out).OnComplete(_ => Confirm());
}
protected virtual void Confirm()
@@ -91,9 +93,9 @@ protected void AbortConfirm()
Fired = false;
this
- .TransformBindableTo(Progress, Progress.Value)
+ .TransformBindableTo(progress, progress.Value)
.Delay(200)
- .TransformBindableTo(Progress, 0, fadeout_delay, Easing.InSine);
+ .TransformBindableTo(progress, 0, fadeout_delay, Easing.InSine);
}
}
}
diff --git a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs
index 9d280a1737..678c4256b4 100644
--- a/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs
+++ b/osu.Game/Screens/Play/HUD/HoldForMenuButton.cs
@@ -164,7 +164,7 @@ private void load(OsuColour colours)
private void bind()
{
- circularProgress.Current.BindTo(Progress);
+ ((IBindable)circularProgress.Current).BindTo(Progress);
Progress.ValueChanged += progress => icon.Scale = new Vector2(1 + (float)progress.NewValue * 0.2f);
}