mirror of
https://github.com/ppy/osu.git
synced 2025-02-05 08:12:53 +08:00
Add setting to adjust hold-to-confirm activation time
This commit is contained in:
parent
3710c7bdc4
commit
177a789d79
@ -112,6 +112,8 @@ namespace osu.Game.Configuration
|
|||||||
|
|
||||||
Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f);
|
Set(OsuSetting.UIScale, 1f, 0.8f, 1.6f, 0.01f);
|
||||||
|
|
||||||
|
Set(OsuSetting.UIHoldActivationDelay, 200, 0, 500);
|
||||||
|
|
||||||
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
|
Set(OsuSetting.IntroSequence, IntroSequence.Triangles);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -180,6 +182,7 @@ namespace osu.Game.Configuration
|
|||||||
ScalingSizeX,
|
ScalingSizeX,
|
||||||
ScalingSizeY,
|
ScalingSizeY,
|
||||||
UIScale,
|
UIScale,
|
||||||
IntroSequence
|
IntroSequence,
|
||||||
|
UIHoldActivationDelay
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,11 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Game.Configuration;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
@ -12,11 +14,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
public Action Action;
|
public Action Action;
|
||||||
|
|
||||||
private const int default_activation_delay = 200;
|
|
||||||
private const int fadeout_delay = 200;
|
private const int fadeout_delay = 200;
|
||||||
|
|
||||||
private readonly double activationDelay;
|
|
||||||
|
|
||||||
private bool fired;
|
private bool fired;
|
||||||
private bool confirming;
|
private bool confirming;
|
||||||
|
|
||||||
@ -27,13 +26,12 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
public Bindable<double> Progress = new BindableDouble();
|
public Bindable<double> Progress = new BindableDouble();
|
||||||
|
|
||||||
/// <summary>
|
private Bindable<int> holdActivationDelay;
|
||||||
/// Create a new instance.
|
|
||||||
/// </summary>
|
[BackgroundDependencyLoader]
|
||||||
/// <param name="activationDelay">The time requried before an action is confirmed.</param>
|
private void load(OsuConfigManager config)
|
||||||
protected HoldToConfirmContainer(double activationDelay = default_activation_delay)
|
|
||||||
{
|
{
|
||||||
this.activationDelay = activationDelay;
|
holdActivationDelay = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void BeginConfirm()
|
protected void BeginConfirm()
|
||||||
@ -42,7 +40,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
confirming = true;
|
confirming = true;
|
||||||
|
|
||||||
this.TransformBindableTo(Progress, 1, activationDelay * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm());
|
this.TransformBindableTo(Progress, 1, holdActivationDelay.Value * (1 - Progress.Value), Easing.Out).OnComplete(_ => Confirm());
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual void Confirm()
|
protected virtual void Confirm()
|
||||||
|
@ -51,7 +51,7 @@ namespace osu.Game.Overlays
|
|||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
audio.Tracks.RemoveAdjustment(AdjustableProperty.Volume, audioVolume);
|
audio?.Tracks.RemoveAdjustment(AdjustableProperty.Volume, audioVolume);
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,9 @@
|
|||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Settings.Sections.Graphics
|
namespace osu.Game.Overlays.Settings.Sections.Graphics
|
||||||
{
|
{
|
||||||
@ -13,7 +15,7 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
Children = new[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new SettingsCheckbox
|
new SettingsCheckbox
|
||||||
{
|
{
|
||||||
@ -25,7 +27,18 @@ namespace osu.Game.Overlays.Settings.Sections.Graphics
|
|||||||
LabelText = "Parallax",
|
LabelText = "Parallax",
|
||||||
Bindable = config.GetBindable<bool>(OsuSetting.MenuParallax)
|
Bindable = config.GetBindable<bool>(OsuSetting.MenuParallax)
|
||||||
},
|
},
|
||||||
|
new SettingsSlider<int, TimeSlider>
|
||||||
|
{
|
||||||
|
LabelText = "Hold-to-confirm activation time",
|
||||||
|
Bindable = config.GetBindable<int>(OsuSetting.UIHoldActivationDelay),
|
||||||
|
KeyboardStep = 50
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TimeSlider : OsuSliderBar<int>
|
||||||
|
{
|
||||||
|
public override string TooltipText => Current.Value.ToString("N0") + "ms";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user