Add the ability to override the user setting for hold-to-confirm containers

Sometimes the user is not right.
This commit is contained in:
Dean Herbert 2022-03-21 16:07:26 +09:00
parent d811a70f4b
commit 36868dbdb4

View File

@ -28,6 +28,14 @@ namespace osu.Game.Graphics.Containers
/// </summary> /// </summary>
protected virtual bool AllowMultipleFires => false; protected virtual bool AllowMultipleFires => false;
/// <summary>
/// Specify a custom activation delay, overriding the game-wide user setting.
/// </summary>
/// <remarks>
/// This should be used in special cases where we want to be extra sure the user knows what they are doing. An example is when changes would be lost.
/// </remarks>
protected virtual double? HoldActivationDelay => null;
public Bindable<double> Progress = new BindableDouble(); public Bindable<double> Progress = new BindableDouble();
private Bindable<double> holdActivationDelay; private Bindable<double> holdActivationDelay;
@ -35,7 +43,9 @@ namespace osu.Game.Graphics.Containers
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuConfigManager config) private void load(OsuConfigManager config)
{ {
holdActivationDelay = config.GetBindable<double>(OsuSetting.UIHoldActivationDelay); holdActivationDelay = HoldActivationDelay != null
? new Bindable<double>(HoldActivationDelay.Value)
: config.GetBindable<double>(OsuSetting.UIHoldActivationDelay);
} }
protected void BeginConfirm() protected void BeginConfirm()