Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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,
};
}
}
}
13 changes: 8 additions & 5 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,10 +268,10 @@ 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,
new TrackedSetting<GameplayLeaderboardVisibilityMode>(OsuSetting.GameplayLeaderboardVisibilityMode, visibilityMode => new SettingDescription(
rawValue: visibilityMode,
name: GlobalActionKeyBindingStrings.ToggleInGameLeaderboard,
value: state ? CommonStrings.Enabled.ToLower() : CommonStrings.Disabled.ToLower(),
value: visibilityMode.GetLocalisableDescription(),
shortcut: LookupKeyBindings(GlobalAction.ToggleInGameLeaderboard))
),
new TrackedSetting<HUDVisibilityMode>(OsuSetting.HUDVisibilityMode, visibilityMode => new SettingDescription(
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,
}
}
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
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 @@
{
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();
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
private readonly IBindable<LocalUserPlayingState> localUserPlayingState = new Bindable<LocalUserPlayingState>();

private readonly Bindable<int?> position = new Bindable<int?>();
Expand All @@ -52,7 +52,7 @@
{
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 @@
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 @@

private void updateVisibility()
{
bool shouldDisplay = userScore != null && (showLeaderboard.Value || localUserPlayingState.Value == LocalUserPlayingState.Break);
bool shouldDisplay = userScore != null && (leaderboardVisibility.Value.ShouldDisplay(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(configVisibility.Value.ShouldDisplay(leaderboardProvider is MultiplayerLeaderboardProvider) ? 1 : 0, 100, Easing.OutQuint);

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

Expand Down
17 changes: 14 additions & 3 deletions osu.Game/Screens/Play/HUDOverlay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
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 @@
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 @@ -416,7 +416,18 @@
return true;

case GlobalAction.ToggleInGameLeaderboard:
configLeaderboardVisibility.Value = !configLeaderboardVisibility.Value;
switch (configLeaderboardVisibilityMode.Value)
{
case GameplayLeaderboardVisibilityMode.Never:
configLeaderboardVisibilityMode.Value = GameplayLeaderboardVisibilityMode.Multiplayer;
break;
case GameplayLeaderboardVisibilityMode.Multiplayer:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
configLeaderboardVisibilityMode.Value = GameplayLeaderboardVisibilityMode.Always;
break;
case GameplayLeaderboardVisibilityMode.Always:
Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
configLeaderboardVisibilityMode.Value = GameplayLeaderboardVisibilityMode.Never;
break;
}
return true;
}

Expand Down
Loading