1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-17 06:02:55 +08:00

Change "hold for menu" button to only show for touch by default

This commit is contained in:
Dean Herbert 2024-08-19 20:23:25 +09:00
parent 24a0a3c47f
commit 005b1038a3
No known key found for this signature in database
4 changed files with 27 additions and 2 deletions

View File

@ -205,6 +205,8 @@ namespace osu.Game.Configuration
SetDefault(OsuSetting.EditorTimelineShowTimingChanges, true); SetDefault(OsuSetting.EditorTimelineShowTimingChanges, true);
SetDefault(OsuSetting.EditorTimelineShowTicks, true); SetDefault(OsuSetting.EditorTimelineShowTicks, true);
SetDefault(OsuSetting.AlwaysShowHoldForMenuButton, false);
} }
protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup) protected override bool CheckLookupContainsPrivateInformation(OsuSetting lookup)
@ -429,5 +431,6 @@ namespace osu.Game.Configuration
HideCountryFlags, HideCountryFlags,
EditorTimelineShowTimingChanges, EditorTimelineShowTimingChanges,
EditorTimelineShowTicks, EditorTimelineShowTicks,
AlwaysShowHoldForMenuButton
} }
} }

View File

@ -84,6 +84,11 @@ namespace osu.Game.Localisation
/// </summary> /// </summary>
public static LocalisableString AlwaysShowGameplayLeaderboard => new TranslatableString(getKey(@"gameplay_leaderboard"), @"Always show gameplay leaderboard"); public static LocalisableString AlwaysShowGameplayLeaderboard => new TranslatableString(getKey(@"gameplay_leaderboard"), @"Always show gameplay leaderboard");
/// <summary>
/// "Always show hold for menu button"
/// </summary>
public static LocalisableString AlwaysShowHoldForMenuButton => new TranslatableString(getKey(@"always_show_hold_for_menu_button"), @"Always show hold for menu button");
/// <summary> /// <summary>
/// "Always play first combo break sound" /// "Always play first combo break sound"
/// </summary> /// </summary>

View File

@ -41,6 +41,11 @@ namespace osu.Game.Overlays.Settings.Sections.Gameplay
Current = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard), Current = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard),
}, },
new SettingsCheckbox new SettingsCheckbox
{
LabelText = GameplaySettingsStrings.AlwaysShowHoldForMenuButton,
Current = config.GetBindable<bool>(OsuSetting.AlwaysShowHoldForMenuButton),
},
new SettingsCheckbox
{ {
ClassicDefault = false, ClassicDefault = false,
LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail, LabelText = GameplaySettingsStrings.ShowHealthDisplayWhenCantFail,

View File

@ -40,6 +40,10 @@ namespace osu.Game.Screens.Play.HUD
private OsuSpriteText text; private OsuSpriteText text;
private Bindable<bool> alwaysShow;
public override bool PropagatePositionalInputSubTree => alwaysShow.Value || touchActive.Value;
public HoldForMenuButton() public HoldForMenuButton()
{ {
Direction = FillDirection.Horizontal; Direction = FillDirection.Horizontal;
@ -50,7 +54,7 @@ namespace osu.Game.Screens.Play.HUD
} }
[BackgroundDependencyLoader(true)] [BackgroundDependencyLoader(true)]
private void load(Player player) private void load(Player player, OsuConfigManager config)
{ {
Children = new Drawable[] Children = new Drawable[]
{ {
@ -71,6 +75,8 @@ namespace osu.Game.Screens.Play.HUD
}; };
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
alwaysShow = config.GetBindable<bool>(OsuSetting.AlwaysShowHoldForMenuButton);
} }
[Resolved] [Resolved]
@ -119,7 +125,9 @@ namespace osu.Game.Screens.Play.HUD
if (text.Alpha > 0 || button.Progress.Value > 0 || button.IsHovered) if (text.Alpha > 0 || button.Progress.Value > 0 || button.IsHovered)
Alpha = 1; Alpha = 1;
else else if (touchActive.Value)
Alpha = 0.08f;
else if (alwaysShow.Value)
{ {
float minAlpha = touchActive.Value ? .08f : 0; float minAlpha = touchActive.Value ? .08f : 0;
@ -127,6 +135,10 @@ namespace osu.Game.Screens.Play.HUD
Math.Clamp(Clock.ElapsedFrameTime, 0, 200), Math.Clamp(Clock.ElapsedFrameTime, 0, 200),
Alpha, Math.Clamp(1 - positionalAdjust, minAlpha, 1), 0, 200, Easing.OutQuint); Alpha, Math.Clamp(1 - positionalAdjust, minAlpha, 1), 0, 200, Easing.OutQuint);
} }
else
{
Alpha = 0;
}
} }
private partial class HoldButton : HoldToConfirmContainer, IKeyBindingHandler<GlobalAction> private partial class HoldButton : HoldToConfirmContainer, IKeyBindingHandler<GlobalAction>