Skip to content

Commit

Permalink
Add setting to allow hold-for-pause to still exist
Browse files Browse the repository at this point in the history
Users have asked for this multiple times since last release.

Not sure on the best default value, but I'm going with the
stable/classic one, at least for the initial release to avoid needing
migrations.

In the future we may reconsider this for new users.
  • Loading branch information
peppy committed Nov 26, 2024
1 parent 2859599 commit 4fcae53
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 2 deletions.
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
8 changes: 6 additions & 2 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 Down

0 comments on commit 4fcae53

Please sign in to comment.