mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 00:42:55 +08:00
Merge pull request #18221 from peppy/multiplayer-leaderboard-hiding
Change multiplayer leaderboard to always hide during gameplay unless holding-for-HUD
This commit is contained in:
commit
52c8382138
@ -43,6 +43,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
|
||||
private readonly MultiplayerRoomUser[] users;
|
||||
|
||||
private readonly Bindable<bool> leaderboardExpanded = new BindableBool();
|
||||
|
||||
private LoadingLayer loadingDisplay;
|
||||
private FillFlowContainer leaderboardFlow;
|
||||
|
||||
@ -76,13 +78,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
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 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
|
||||
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 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
||||
}
|
||||
}
|
||||
|
||||
private void updateLeaderboardExpandedState() =>
|
||||
leaderboardExpanded.Value = !LocalUserPlaying.Value || HUDOverlay.HoldingForHUD.Value;
|
||||
|
||||
private void failAndBail(string message = null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(message))
|
||||
|
@ -68,7 +68,9 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
internal readonly IBindable<bool> IsPlaying = new Bindable<bool>();
|
||||
|
||||
private bool holdingForHUD;
|
||||
public IBindable<bool> HoldingForHUD => holdingForHUD;
|
||||
|
||||
private readonly BindableBool holdingForHUD = new BindableBool();
|
||||
|
||||
private readonly SkinnableTargetContainer mainComponents;
|
||||
|
||||
@ -144,7 +146,8 @@ namespace osu.Game.Screens.Play
|
||||
hideTargets.ForEach(d => d.Hide());
|
||||
}
|
||||
|
||||
public override void Hide() => throw new InvalidOperationException($"{nameof(HUDOverlay)} should not be hidden as it will remove the ability of a user to quit. Use {nameof(ShowHud)} instead.");
|
||||
public override void Hide() =>
|
||||
throw new InvalidOperationException($"{nameof(HUDOverlay)} should not be hidden as it will remove the ability of a user to quit. Use {nameof(ShowHud)} instead.");
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
@ -152,6 +155,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
ShowHud.BindValueChanged(visible => hideTargets.ForEach(d => d.FadeTo(visible.NewValue ? 1 : 0, FADE_DURATION, FADE_EASING)));
|
||||
|
||||
holdingForHUD.BindValueChanged(_ => updateVisibility());
|
||||
IsPlaying.BindValueChanged(_ => updateVisibility());
|
||||
configVisibilityMode.BindValueChanged(_ => updateVisibility(), true);
|
||||
|
||||
@ -204,7 +208,7 @@ namespace osu.Game.Screens.Play
|
||||
if (ShowHud.Disabled)
|
||||
return;
|
||||
|
||||
if (holdingForHUD)
|
||||
if (holdingForHUD.Value)
|
||||
{
|
||||
ShowHud.Value = true;
|
||||
return;
|
||||
@ -287,8 +291,7 @@ namespace osu.Game.Screens.Play
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.HoldForHUD:
|
||||
holdingForHUD = true;
|
||||
updateVisibility();
|
||||
holdingForHUD.Value = true;
|
||||
return true;
|
||||
|
||||
case GlobalAction.ToggleInGameInterface:
|
||||
@ -318,8 +321,7 @@ namespace osu.Game.Screens.Play
|
||||
switch (e.Action)
|
||||
{
|
||||
case GlobalAction.HoldForHUD:
|
||||
holdingForHUD = false;
|
||||
updateVisibility();
|
||||
holdingForHUD.Value = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user