Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add setting to allow hold-for-pause to still exist #30878

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions osu.Game/Configuration/OsuConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ protected override void InitialiseDefaults()
SetDefault(OsuSetting.EditorContractSidebars, false);

SetDefault(OsuSetting.AlwaysShowHoldForMenuButton, false);
SetDefault(OsuSetting.AlwaysRequireHoldingForPause, false);
}

protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup)
Expand Down Expand Up @@ -444,5 +445,6 @@ public enum OsuSetting
EditorRotationOrigin,
EditorTimelineShowBreaks,
EditorAdjustExistingObjectsOnTimingChanges,
AlwaysRequireHoldingForPause
}
}
5 changes: 5 additions & 0 deletions osu.Game/Localisation/GameplaySettingsStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ public static class GameplaySettingsStrings
/// </summary>
public static LocalisableString AlwaysShowHoldForMenuButton => new TranslatableString(getKey(@"always_show_hold_for_menu_button"), @"Always show hold for menu button");

/// <summary>
/// "Require holding key to pause gameplay"
/// </summary>
public static LocalisableString AlwaysRequireHoldForMenu => new TranslatableString(getKey(@"require_holding_key_to_pause_gameplay"), @"Require holding key to pause gameplay");

/// <summary>
/// "Always play first combo break sound"
/// </summary>
Expand Down
5 changes: 5 additions & 0 deletions osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ private void load(OsuConfigManager config)
Current = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard),
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.AlwaysRequireHoldForMenu,
Current = config.GetBindable<bool>(OsuSetting.AlwaysRequireHoldingForPause),
},
new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.AlwaysShowHoldForMenuButton,
Current = config.GetBindable<bool>(OsuSetting.AlwaysShowHoldForMenuButton),
Expand Down
10 changes: 7 additions & 3 deletions osu.Game/Screens/Play/HUD/HoldForMenuButton.cs
Original file line number Diff line number Diff line change
Expand Up @@ -162,14 +162,18 @@ private partial class HoldButton : HoldToConfirmContainer, IKeyBindingHandler<Gl
private bool pendingAnimation;
private ScheduledDelegate shakeOperation;

private Bindable<bool> alwaysRequireHold;

public HoldButton(bool isDangerousAction)
: base(isDangerousAction)
{
}

[BackgroundDependencyLoader]
private void load(OsuColour colours)
private void load(OsuColour colours, OsuConfigManager config)
{
alwaysRequireHold = config.GetBindable<bool>(OsuSetting.AlwaysRequireHoldingForPause);

Size = new Vector2(60);

Child = new CircularContainer
Expand Down Expand Up @@ -300,7 +304,7 @@ public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)
case GlobalAction.Back:
if (!pendingAnimation)
{
if (IsDangerousAction)
if (IsDangerousAction || alwaysRequireHold.Value)
BeginConfirm();
else
Confirm();
Expand All @@ -314,7 +318,7 @@ public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)

if (!pendingAnimation)
{
if (IsDangerousAction)
if (IsDangerousAction || alwaysRequireHold.Value)
BeginConfirm();
else
Confirm();
Expand Down
Loading