diff --git a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs index f45e6326d1..d026afcd6d 100644 --- a/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs +++ b/osu.Game.Tests/Visual/Gameplay/TestSceneGameplayLeaderboard.cs @@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual.Gameplay AddStep("toggle expanded", () => { if (leaderboard.IsNotNull()) - leaderboard.ForceExpand.Value = !leaderboard.ForceExpand.Value; + leaderboard.CollapseDuringGameplay.Value = !leaderboard.CollapseDuringGameplay.Value; }); AddSliderStep("set player score", 50, 5000000, 1222333, v => playerScore.Value = v); diff --git a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs index 3008edf41f..955737578a 100644 --- a/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs +++ b/osu.Game.Tests/Visual/Multiplayer/MultiplayerGameplayLeaderboardTestScene.cs @@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Multiplayer public void TestScoreUpdates() { AddRepeatStep("update state", UpdateUserStatesRandomly, 100); - AddToggleStep("switch compact mode", expanded => Leaderboard!.ForceExpand.Value = expanded); + AddToggleStep("switch compact mode", collapsed => Leaderboard!.CollapseDuringGameplay.Value = collapsed); } [Test] diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs index 131b644dcb..c39708352e 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiSpectatorLeaderboard.cs @@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Multiplayer { Anchor = Anchor.Centre, Origin = Anchor.Centre, - ForceExpand = { Value = true } + CollapseDuringGameplay = { Value = false } } }); }); diff --git a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs index 40d8650c69..6141820cb7 100644 --- a/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs +++ b/osu.Game.Tests/Visual/Multiplayer/TestSceneMultiplayerGameplayLeaderboardTeams.cs @@ -44,14 +44,16 @@ namespace osu.Game.Tests.Visual.Multiplayer Team2Score = { BindTarget = LeaderboardProvider.TeamScores[1] } }, Add); - LoadComponentAsync(new GameplayMatchScoreDisplay + GameplayMatchScoreDisplay matchScoreDisplay; + LoadComponentAsync(matchScoreDisplay = new GameplayMatchScoreDisplay { Anchor = Anchor.BottomCentre, Origin = Anchor.BottomCentre, Team1Score = { BindTarget = LeaderboardProvider.TeamScores[0] }, Team2Score = { BindTarget = LeaderboardProvider.TeamScores[1] }, - Expanded = { BindTarget = Leaderboard!.ForceExpand }, }, Add); + + Leaderboard!.CollapseDuringGameplay.BindValueChanged(_ => matchScoreDisplay.Expanded.Value = !Leaderboard.CollapseDuringGameplay.Value); }); } } diff --git a/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs index b21446e18a..66abf2bfd5 100644 --- a/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs +++ b/osu.Game/Localisation/SkinComponents/SkinnableComponentStrings.cs @@ -84,6 +84,17 @@ namespace osu.Game.Localisation.SkinComponents /// public static LocalisableString UseRelativeSize => new TranslatableString(getKey(@"use_relative_size"), @"Use relative size"); + /// + /// "Collapse during gameplay" + /// + public static LocalisableString CollapseDuringGameplay => new TranslatableString(getKey(@"collapse_during_gameplay"), @"Collapse during gameplay"); + + /// + /// "If enabled, the leaderboard will become more compact during active gameplay." + /// + public static LocalisableString CollapseDuringGameplayDescription => + new TranslatableString(getKey(@"if_enabled_the_leaderboard_will"), @"If enabled, the leaderboard will become more compact during active gameplay."); + private static string getKey(string key) => $@"{prefix}:{key}"; } } diff --git a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs index 06efffbf6e..7ad8bdf454 100644 --- a/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs +++ b/osu.Game/Screens/OnlinePlay/Multiplayer/Spectate/MultiSpectatorScreen.cs @@ -154,7 +154,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate }); leaderboardFlow.Insert(0, Leaderboard = new DrawableGameplayLeaderboard { - ForceExpand = { Value = true } + CollapseDuringGameplay = { Value = false } }); LoadComponentAsync(new GameplayChatDisplay(room) diff --git a/osu.Game/Screens/Play/HUD/DrawableGameplayLeaderboard.cs b/osu.Game/Screens/Play/HUD/DrawableGameplayLeaderboard.cs index a7c4bc99b2..dd55e5f926 100644 --- a/osu.Game/Screens/Play/HUD/DrawableGameplayLeaderboard.cs +++ b/osu.Game/Screens/Play/HUD/DrawableGameplayLeaderboard.cs @@ -11,6 +11,7 @@ using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Game.Configuration; using osu.Game.Graphics.Containers; +using osu.Game.Localisation.SkinComponents; using osu.Game.Screens.Select.Leaderboards; using osu.Game.Skinning; using osuTK; @@ -20,8 +21,6 @@ namespace osu.Game.Screens.Play.HUD { public partial class DrawableGameplayLeaderboard : CompositeDrawable, ISerialisableDrawable { - public readonly Bindable ForceExpand = new Bindable(); - protected readonly FillFlowContainer Flow; private bool requiresScroll; @@ -29,6 +28,9 @@ namespace osu.Game.Screens.Play.HUD public DrawableGameplayLeaderboardScore? TrackedScore { get; private set; } + [SettingSource(typeof(SkinnableComponentStrings), nameof(SkinnableComponentStrings.CollapseDuringGameplay), nameof(SkinnableComponentStrings.CollapseDuringGameplayDescription))] + public Bindable CollapseDuringGameplay { get; } = new BindableBool(true); + [Resolved] private Player? player { get; set; } @@ -97,7 +99,7 @@ namespace osu.Game.Screens.Play.HUD configVisibility.BindValueChanged(_ => Scheduler.AddOnce(updateState)); userPlayingState.BindValueChanged(_ => Scheduler.AddOnce(updateState)); holdingForHUD.BindValueChanged(_ => Scheduler.AddOnce(updateState)); - ForceExpand.BindValueChanged(_ => Scheduler.AddOnce(updateState)); + CollapseDuringGameplay.BindValueChanged(_ => Scheduler.AddOnce(updateState)); updateState(); } @@ -108,7 +110,7 @@ namespace osu.Game.Screens.Play.HUD scroll.ScrollToStart(false); Flow.FadeTo(player?.Configuration.ShowLeaderboard != false && configVisibility.Value ? 1 : 0, 100, Easing.OutQuint); - expanded.Value = ForceExpand.Value || userPlayingState.Value != LocalUserPlayingState.Playing || holdingForHUD.Value; + expanded.Value = !CollapseDuringGameplay.Value || userPlayingState.Value != LocalUserPlayingState.Playing || holdingForHUD.Value; } ///