Use same logic as KeyCounterDisplay

This commit is contained in:
Dean Herbert
2022-09-27 14:43:08 +09:00
parent bac3108aea
commit 320f134634
3 changed files with 10 additions and 1 deletions

View File

@ -31,6 +31,12 @@ namespace osu.Game.Screens.Play.HUD
[Resolved] [Resolved]
private ScoreManager scoreManager { get; set; } = null!; private ScoreManager scoreManager { get; set; } = null!;
/// <summary>
/// Whether the leaderboard should be visible regardless of the configuration value.
/// This is true by default, but can be changed.
/// </summary>
public readonly Bindable<bool> AlwaysVisible = new Bindable<bool>(true);
public SoloGameplayLeaderboard(IUser trackingUser) public SoloGameplayLeaderboard(IUser trackingUser)
{ {
this.trackingUser = trackingUser; this.trackingUser = trackingUser;
@ -47,6 +53,7 @@ namespace osu.Game.Screens.Play.HUD
base.LoadComplete(); base.LoadComplete();
Scores.BindCollectionChanged((_, _) => Scheduler.AddOnce(showScores), true); Scores.BindCollectionChanged((_, _) => Scheduler.AddOnce(showScores), true);
AlwaysVisible.BindValueChanged(_ => updateVisibility());
configVisibility.BindValueChanged(_ => updateVisibility(), true); configVisibility.BindValueChanged(_ => updateVisibility(), true);
} }
@ -84,6 +91,6 @@ namespace osu.Game.Screens.Play.HUD
} }
private void updateVisibility() => private void updateVisibility() =>
Flow.FadeTo(configVisibility.Value ? 1 : 0, duration); this.FadeTo(AlwaysVisible.Value || configVisibility.Value ? 1 : 0, duration);
} }
} }

View File

@ -62,6 +62,7 @@ namespace osu.Game.Screens.Play
protected override GameplayLeaderboard CreateGameplayLeaderboard() => protected override GameplayLeaderboard CreateGameplayLeaderboard() =>
new SoloGameplayLeaderboard(Score.ScoreInfo.User) new SoloGameplayLeaderboard(Score.ScoreInfo.User)
{ {
AlwaysVisible = { Value = true },
Scores = { BindTarget = LeaderboardScores } Scores = { BindTarget = LeaderboardScores }
}; };

View File

@ -48,6 +48,7 @@ namespace osu.Game.Screens.Play
protected override GameplayLeaderboard CreateGameplayLeaderboard() => protected override GameplayLeaderboard CreateGameplayLeaderboard() =>
new SoloGameplayLeaderboard(Score.ScoreInfo.User) new SoloGameplayLeaderboard(Score.ScoreInfo.User)
{ {
AlwaysVisible = { Value = false },
Scores = { BindTarget = LeaderboardScores } Scores = { BindTarget = LeaderboardScores }
}; };