1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Ensure gameplay leaderboard hides with rest of HUD when it should

This commit is contained in:
Dean Herbert 2022-09-13 18:12:49 +09:00
parent 6d167070f8
commit 5894d2f0bc
4 changed files with 19 additions and 4 deletions

View File

@ -60,7 +60,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
AllowPause = false,
AllowRestart = false,
AllowSkipping = room.AutoSkip.Value,
AutomaticallySkipIntro = room.AutoSkip.Value
AutomaticallySkipIntro = room.AutoSkip.Value,
AlwaysShowLeaderboard = true,
})
{
this.users = users;

View File

@ -9,7 +9,6 @@ using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Extensions.EnumExtensions;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Input.Bindings;
@ -80,7 +79,7 @@ namespace osu.Game.Screens.Play
private readonly SkinnableTargetContainer mainComponents;
private IEnumerable<Drawable> hideTargets => new Drawable[] { mainComponents, KeyCounter, topRightElements };
private readonly List<Drawable> hideTargets;
public HUDOverlay(DrawableRuleset drawableRuleset, IReadOnlyList<Mod> mods)
{
@ -129,6 +128,8 @@ namespace osu.Game.Screens.Play
},
clicksPerSecondCalculator = new ClicksPerSecondCalculator()
};
hideTargets = new List<Drawable> { mainComponents, KeyCounter, topRightElements };
}
[BackgroundDependencyLoader(true)]
@ -173,6 +174,13 @@ namespace osu.Game.Screens.Play
replayLoaded.BindValueChanged(replayLoadedValueChanged, true);
}
public void Add(Drawable drawable, bool hideWithHUD)
{
base.Add(drawable);
if (hideWithHUD)
hideTargets.Add(drawable);
}
protected override void Update()
{
base.Update();

View File

@ -838,6 +838,7 @@ namespace osu.Game.Screens.Play
return;
leaderboard.Expanded.BindTo(LeaderboardExpandedState);
AddLeaderboardToHUD(leaderboard);
});
}
@ -849,7 +850,7 @@ namespace osu.Game.Screens.Play
Margin = new MarginPadding { Bottom = 75, Left = 20 },
};
protected virtual void AddLeaderboardToHUD(GameplayLeaderboard leaderboard) => HUDOverlay.Add(leaderboard);
protected virtual void AddLeaderboardToHUD(GameplayLeaderboard leaderboard) => HUDOverlay.Add(leaderboard, !Configuration.AlwaysShowLeaderboard);
private void updateLeaderboardExpandedState() =>
LeaderboardExpandedState.Value = !LocalUserPlaying.Value || HUDOverlay.HoldingForHUD.Value;

View File

@ -36,5 +36,10 @@ namespace osu.Game.Screens.Play
/// Whether the intro should be skipped by default.
/// </summary>
public bool AutomaticallySkipIntro { get; set; }
/// <summary>
/// Whether the gameplay leaderboard should always be shown (usually in a contracted state).
/// </summary>
public bool AlwaysShowLeaderboard { get; set; }
}
}