Skip to content
Open
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
20 changes: 20 additions & 0 deletions osu.Game/Configuration/GameplayLeaderboardVisibilityMode.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

using osu.Framework.Localisation;
using osu.Game.Localisation;

namespace osu.Game.Configuration
{
public enum GameplayLeaderboardVisibilityMode
{
[LocalisableDescription(typeof(GameplaySettingsStrings), nameof(GameplaySettingsStrings.ShowLeaderboardAlways))]
Always,

[LocalisableDescription(typeof(GameplaySettingsStrings), nameof(GameplaySettingsStrings.ShowLeaderboardMultiplayer))]
Multiplayer,

[LocalisableDescription(typeof(GameplaySettingsStrings), nameof(GameplaySettingsStrings.ShowLeaderboardNever))]
Never,
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.

namespace osu.Game.Configuration
{
public static class GameplayLeaderboardVisibilityModeExtensions
{
public static bool ShouldDisplay(this GameplayLeaderboardVisibilityMode mode, bool isMultiplayer)
{
return mode switch
{
GameplayLeaderboardVisibilityMode.Never => false,
GameplayLeaderboardVisibilityMode.Multiplayer => isMultiplayer,
GameplayLeaderboardVisibilityMode.Always => true,
_ => false,
};
}
}
}
17 changes: 10 additions & 7 deletions osu.Game/Configuration/OsuConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ protected override void InitialiseDefaults()
SetDefault(OsuSetting.KeyOverlay, false);
SetDefault(OsuSetting.ReplaySettingsOverlay, true);
SetDefault(OsuSetting.ReplayPlaybackControlsExpanded, true);
SetDefault(OsuSetting.GameplayLeaderboard, true);
SetDefault(OsuSetting.GameplayLeaderboard, true); // legacy migration only
SetDefault(OsuSetting.GameplayLeaderboardVisibilityMode, GameplayLeaderboardVisibilityMode.Always);
SetDefault(OsuSetting.AlwaysPlayFirstComboBreak, true);

SetDefault(OsuSetting.FloatingComments, false);
Expand Down Expand Up @@ -267,11 +268,11 @@ public override TrackedSettings CreateTrackedSettings()
value: disabledState ? CommonStrings.Disabled.ToLower() : CommonStrings.Enabled.ToLower(),
shortcut: LookupKeyBindings(GlobalAction.ToggleGameplayMouseButtons))
),
new TrackedSetting<bool>(OsuSetting.GameplayLeaderboard, state => new SettingDescription(
rawValue: state,
name: GlobalActionKeyBindingStrings.ToggleInGameLeaderboard,
value: state ? CommonStrings.Enabled.ToLower() : CommonStrings.Disabled.ToLower(),
shortcut: LookupKeyBindings(GlobalAction.ToggleInGameLeaderboard))
new TrackedSetting<GameplayLeaderboardVisibilityMode>(OsuSetting.GameplayLeaderboardVisibilityMode, visibilityMode => new SettingDescription(
rawValue: visibilityMode,
name: GlobalActionKeyBindingStrings.CycleInGameLeaderboardVisibilityMode,
value: visibilityMode.GetLocalisableDescription(),
shortcut: LookupKeyBindings(GlobalAction.CycleInGameLeaderboardVisibilityMode))
),
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, visibilityMode => new SettingDescription(
rawValue: visibilityMode,
Expand Down Expand Up @@ -338,7 +339,7 @@ public enum OsuSetting
LightenDuringBreaks,
ShowStoryboard,
KeyOverlay,
GameplayLeaderboard,
GameplayLeaderboard, // only used for migrating to `GameplayLeaderboardVisibilityMode`
PositionalHitsoundsLevel,
AlwaysPlayFirstComboBreak,
FloatingComments,
Expand Down Expand Up @@ -469,5 +470,7 @@ public enum OsuSetting

DashboardSortMode,
DashboardDisplayStyle,

GameplayLeaderboardVisibilityMode,
}
}
6 changes: 3 additions & 3 deletions osu.Game/Input/Bindings/GlobalActionContainer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public static IEnumerable<GlobalAction> GetGlobalActionsFor(GlobalActionCategory
new KeyBinding(new[] { InputKey.F3 }, GlobalAction.DecreaseScrollSpeed),
new KeyBinding(new[] { InputKey.F4 }, GlobalAction.IncreaseScrollSpeed),
new KeyBinding(new[] { InputKey.Shift, InputKey.Tab }, GlobalAction.ToggleInGameInterface),
new KeyBinding(InputKey.Tab, GlobalAction.ToggleInGameLeaderboard),
new KeyBinding(InputKey.Tab, GlobalAction.CycleInGameLeaderboardVisibilityMode),
new KeyBinding(InputKey.MouseMiddle, GlobalAction.PauseGameplay),
new KeyBinding(InputKey.Control, GlobalAction.HoldForHUD),
new KeyBinding(InputKey.Enter, GlobalAction.ToggleChatFocus),
Expand Down Expand Up @@ -442,8 +442,8 @@ public enum GlobalAction
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleReplaySettings))]
ToggleReplaySettings,

[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.ToggleInGameLeaderboard))]
ToggleInGameLeaderboard,
[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.CycleInGameLeaderboardVisibilityMode))]
CycleInGameLeaderboardVisibilityMode,

[LocalisableDescription(typeof(GlobalActionKeyBindingStrings), nameof(GlobalActionKeyBindingStrings.EditorToggleRotateControl))]
EditorToggleRotateControl,
Expand Down
19 changes: 17 additions & 2 deletions osu.Game/Localisation/GameplaySettingsStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,24 @@ public static class GameplaySettingsStrings
public static LocalisableString AlwaysShowKeyOverlay => new TranslatableString(getKey(@"key_overlay"), @"Always show key overlay");

/// <summary>
/// "Always show gameplay leaderboard"
/// "Gameplay leaderboard visibility mode"
/// </summary>
public static LocalisableString AlwaysShowGameplayLeaderboard => new TranslatableString(getKey(@"gameplay_leaderboard"), @"Always show gameplay leaderboard");
public static LocalisableString GameplayLeaderboardVisibilityMode => new TranslatableString(getKey(@"gameplay_leaderboard_visibility_mode"), @"Gameplay leaderboard visibility mode");

/// <summary>
/// "Always"
/// </summary>
public static LocalisableString ShowLeaderboardAlways => new TranslatableString(getKey(@"show_leaderboard_always"), @"Always");

/// <summary>
/// "Multiplayer"
/// </summary>
public static LocalisableString ShowLeaderboardMultiplayer => new TranslatableString(getKey(@"show_leaderboard_multiplayer"), @"Multiplayer");

/// <summary>
/// "Disabled"
/// </summary>
public static LocalisableString ShowLeaderboardNever => new TranslatableString(getKey(@"show_leaderboard_never"), @"Disabled");

/// <summary>
/// "Always show hold for menu button"
Expand Down
4 changes: 2 additions & 2 deletions osu.Game/Localisation/GlobalActionKeyBindingStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ public static class GlobalActionKeyBindingStrings
public static LocalisableString ToggleInGameInterface => new TranslatableString(getKey(@"toggle_in_game_interface"), @"Toggle in-game interface");

/// <summary>
/// "Toggle in-game leaderboard"
/// "Cycle in-game leaderboard visibility mode"
/// </summary>
public static LocalisableString ToggleInGameLeaderboard => new TranslatableString(getKey(@"toggle_in_game_leaderboard"), @"Toggle in-game leaderboard");
public static LocalisableString CycleInGameLeaderboardVisibilityMode => new TranslatableString(getKey(@"cycle_in_game_leaderboard_visibility_mode"), @"Cycle in-game leaderboard visibility mode");

/// <summary>
/// "Toggle mod select"
Expand Down
10 changes: 10 additions & 0 deletions osu.Game/OsuGame.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1376,6 +1376,16 @@ private void applyConfigMigrations()

dialogOverlay.Push(new MigrateNewAudioDialog(wasAlreadyUsing));
}

if (combined < 20260723)
{
bool oldValue = LocalConfig.Get<bool>(OsuSetting.GameplayLeaderboard);

LocalConfig.SetValue(
OsuSetting.GameplayLeaderboardVisibilityMode,
oldValue ? GameplayLeaderboardVisibilityMode.Always : GameplayLeaderboardVisibilityMode.Never
);
}
}

private void handleBackButton()
Expand Down
6 changes: 3 additions & 3 deletions osu.Game/Overlays/Settings/Sections/Gameplay/HUDSettings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ private void load(OsuConfigManager config)
{
Keywords = new[] { "counter" },
},
new SettingsItemV2(new FormCheckBox
new SettingsItemV2(new FormEnumDropdown<GameplayLeaderboardVisibilityMode>
{
Caption = GameplaySettingsStrings.AlwaysShowGameplayLeaderboard,
Current = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard),
Caption = GameplaySettingsStrings.GameplayLeaderboardVisibilityMode,
Current = config.GetBindable<GameplayLeaderboardVisibilityMode>(OsuSetting.GameplayLeaderboardVisibilityMode)
}),
new SettingsItemV2(new FormCheckBox
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public partial class MultiplayerPositionDisplay : VisibilityContainer
{
private readonly IBindable<APIUser> user = new Bindable<APIUser>();
private readonly IBindableList<GameplayLeaderboardScore> scores = new BindableList<GameplayLeaderboardScore>();
private readonly BindableBool showLeaderboard = new BindableBool();
private readonly Bindable<GameplayLeaderboardVisibilityMode> leaderboardVisibility = new Bindable<GameplayLeaderboardVisibilityMode>();
private readonly IBindable<LocalUserPlayingState> localUserPlayingState = new Bindable<LocalUserPlayingState>();

private readonly Bindable<int?> position = new Bindable<int?>();
Expand All @@ -52,7 +52,7 @@ private void load(IGameplayLeaderboardProvider leaderboardProvider, IAPIProvider
{
scores.BindTo(leaderboardProvider.Scores);
user.BindTo(api.LocalUser);
configManager.BindWith(OsuSetting.GameplayLeaderboard, showLeaderboard);
configManager.BindWith(OsuSetting.GameplayLeaderboardVisibilityMode, leaderboardVisibility);
localUserPlayingState.BindTo(gameplayState.PlayingState);

AutoSizeAxes = Axes.Y;
Expand Down Expand Up @@ -105,7 +105,7 @@ protected override void LoadComplete()
user.BindValueChanged(_ => updateScoreBindings());
scores.BindCollectionChanged((_, __) => updateScoreBindings(), true);

showLeaderboard.BindValueChanged(_ => updateVisibility());
leaderboardVisibility.BindValueChanged(_ => updateVisibility());
localUserPlayingState.BindValueChanged(_ => updateVisibility(), true);

State.BindValueChanged(_ => updatePosition());
Expand All @@ -126,7 +126,7 @@ protected override void PopOut()

private void updateVisibility()
{
bool shouldDisplay = userScore != null && (showLeaderboard.Value || localUserPlayingState.Value == LocalUserPlayingState.Break);
bool shouldDisplay = userScore != null && (leaderboardVisibility.Value.ShouldDisplay(isMultiplayer: true) || localUserPlayingState.Value == LocalUserPlayingState.Break);

State.Value = shouldDisplay ? Visibility.Visible : Visibility.Hidden;
}
Expand Down
7 changes: 4 additions & 3 deletions osu.Game/Screens/Play/HUD/DrawableGameplayLeaderboard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public partial class DrawableGameplayLeaderboard : CompositeDrawable, ISerialisa
private IGameplayLeaderboardProvider leaderboardProvider { get; set; } = null!;

private readonly IBindableList<GameplayLeaderboardScore> scores = new BindableList<GameplayLeaderboardScore>();
private readonly Bindable<bool> configVisibility = new Bindable<bool>();
private readonly Bindable<GameplayLeaderboardVisibilityMode> configVisibility = new Bindable<GameplayLeaderboardVisibilityMode>();
private readonly IBindable<LocalUserPlayingState> userPlayingState = new Bindable<LocalUserPlayingState>();
private readonly IBindable<bool> holdingForHUD = new Bindable<bool>();

Expand Down Expand Up @@ -81,7 +81,7 @@ public DrawableGameplayLeaderboard()
[BackgroundDependencyLoader]
private void load(OsuConfigManager config, GameplayState? gameplayState, HUDOverlay? hudOverlay)
{
config.BindWith(OsuSetting.GameplayLeaderboard, configVisibility);
config.BindWith(OsuSetting.GameplayLeaderboardVisibilityMode, configVisibility);

if (gameplayState != null)
userPlayingState.BindTo(gameplayState.PlayingState);
Expand Down Expand Up @@ -115,7 +115,8 @@ private void updateState()
if (Flow.Alpha < 1)
scroll.ScrollToStart(false);

Flow.FadeTo(player?.Configuration.ShowLeaderboard != false && (configVisibility.Value || AlwaysShown) ? 1 : 0, 100, Easing.OutQuint);
Flow.FadeTo(player?.Configuration.ShowLeaderboard != false && configVisibility.Value.ShouldDisplay(leaderboardProvider is MultiplayerLeaderboardProvider) ? 1 : 0, 100, Easing.OutQuint);

expanded.Value = !CollapseDuringGameplay.Value || userPlayingState.Value != LocalUserPlayingState.Playing || holdingForHUD.Value;
}

Expand Down
21 changes: 17 additions & 4 deletions osu.Game/Screens/Play/HUDOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ protected override bool ShouldBeConsideredForInput(Drawable child)
public Bindable<bool> ShowHud { get; } = new BindableBool();

private Bindable<HUDVisibilityMode> configVisibilityMode;
private Bindable<bool> configLeaderboardVisibility;
private Bindable<GameplayLeaderboardVisibilityMode> configLeaderboardVisibilityMode;

private readonly BindableBool replayLoaded = new BindableBool();

Expand Down Expand Up @@ -194,7 +194,7 @@ private void load(OsuConfigManager config, RealmKeyBindingStore keyBindingStore,
ModDisplay.Current.Value = mods;

configVisibilityMode = config.GetBindable<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode);
configLeaderboardVisibility = config.GetBindable<bool>(OsuSetting.GameplayLeaderboard);
configLeaderboardVisibilityMode = config.GetBindable<GameplayLeaderboardVisibilityMode>(OsuSetting.GameplayLeaderboardVisibilityMode);

if (configVisibilityMode.Value == HUDVisibilityMode.Never && !hasShownNotificationOnce)
{
Expand Down Expand Up @@ -415,8 +415,21 @@ public bool OnPressed(KeyBindingPressEvent<GlobalAction> e)

return true;

case GlobalAction.ToggleInGameLeaderboard:
configLeaderboardVisibility.Value = !configLeaderboardVisibility.Value;
case GlobalAction.CycleInGameLeaderboardVisibilityMode:
switch (configLeaderboardVisibilityMode.Value)
{
case GameplayLeaderboardVisibilityMode.Never:
configLeaderboardVisibilityMode.Value = GameplayLeaderboardVisibilityMode.Always;
break;

case GameplayLeaderboardVisibilityMode.Always:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
configLeaderboardVisibilityMode.Value = GameplayLeaderboardVisibilityMode.Multiplayer;
break;

case GameplayLeaderboardVisibilityMode.Multiplayer:
configLeaderboardVisibilityMode.Value = GameplayLeaderboardVisibilityMode.Never;
break;
}
return true;
}

Expand Down
Loading