Skip to content

Commit

Permalink
Change multiplayer leaderboard to always hide during gameplay unless …
Browse files Browse the repository at this point in the history
…holding-for-HUD
  • Loading branch information
peppy committed May 11, 2022
1 parent 1c36995 commit d05cd69
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions osu.Game/Screens/OnlinePlay/Multiplayer/MultiplayerPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public class MultiplayerPlayer : RoomSubmittingPlayer

private readonly MultiplayerRoomUser[] users;

private readonly Bindable<bool> leaderboardExpanded = new BindableBool();

private LoadingLayer loadingDisplay;
private FillFlowContainer leaderboardFlow;

Expand Down Expand Up @@ -76,13 +78,16 @@ private void load()
Spacing = new Vector2(5)
});

HUDOverlay.HoldingForHUD.BindValueChanged(_ => updateLeaderboardExpandedState());
LocalUserPlaying.BindValueChanged(_ => updateLeaderboardExpandedState(), true);

// todo: this should be implemented via a custom HUD implementation, and correctly masked to the main content area.
LoadComponentAsync(leaderboard = new MultiplayerGameplayLeaderboard(GameplayState.Ruleset.RulesetInfo, ScoreProcessor, users), l =>
{
if (!LoadedBeatmapSuccessfully)
return;

((IBindable<bool>)leaderboard.Expanded).BindTo(HUDOverlay.ShowHud);
leaderboard.Expanded.BindTo(leaderboardExpanded);

leaderboardFlow.Insert(0, l);

Expand All @@ -99,7 +104,7 @@ private void load()

LoadComponentAsync(new GameplayChatDisplay(Room)
{
Expanded = { BindTarget = HUDOverlay.ShowHud },
Expanded = { BindTarget = leaderboardExpanded },
}, chat => leaderboardFlow.Insert(2, chat));

HUDOverlay.Add(loadingDisplay = new LoadingLayer(true) { Depth = float.MaxValue });
Expand Down Expand Up @@ -152,6 +157,9 @@ protected override void StartGameplay()
}
}

private void updateLeaderboardExpandedState() =>
leaderboardExpanded.Value = !LocalUserPlaying.Value || HUDOverlay.HoldingForHUD.Value;

private void failAndBail(string message = null)
{
if (!string.IsNullOrEmpty(message))
Expand Down

0 comments on commit d05cd69

Please sign in to comment.