Change multiplayer leaderboard to always hide during gameplay unless holding-for-HUD

This commit is contained in:
Dean Herbert 2022-05-11 16:12:54 +09:00
parent 1c36995606
commit d05cd69087
1 changed files with 10 additions and 2 deletions

View File

@ -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;
@ -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);
@ -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 });
@ -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))