1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-19 01:49:53 +08:00

Combine two similar flags into one

This commit is contained in:
Dean Herbert
2025-06-12 17:27:23 +09:00
Unverified
parent 04871fe55a
commit ebfc3c9ccf
6 changed files with 9 additions and 10 deletions
@@ -36,7 +36,7 @@ namespace osu.Game.Tests.Visual.Gameplay
AddStep("toggle expanded", () =>
{
if (leaderboard.IsNotNull())
leaderboard.ForceExpand.Value = !leaderboard.ForceExpand.Value;
leaderboard.CollapseDuringGameplay.Value = !leaderboard.CollapseDuringGameplay.Value;
});
AddSliderStep("set player score", 50, 5000000, 1222333, v => playerScore.Value = v);
@@ -167,7 +167,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
public void TestScoreUpdates()
{
AddRepeatStep("update state", UpdateUserStatesRandomly, 100);
AddToggleStep("switch compact mode", expanded => Leaderboard!.ForceExpand.Value = expanded);
AddToggleStep("switch compact mode", collapsed => Leaderboard!.CollapseDuringGameplay.Value = collapsed);
}
[Test]
@@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
ForceExpand = { Value = true }
CollapseDuringGameplay = { Value = false }
}
});
});
@@ -44,14 +44,16 @@ namespace osu.Game.Tests.Visual.Multiplayer
Team2Score = { BindTarget = LeaderboardProvider.TeamScores[1] }
}, Add);
LoadComponentAsync(new GameplayMatchScoreDisplay
GameplayMatchScoreDisplay matchScoreDisplay;
LoadComponentAsync(matchScoreDisplay = new GameplayMatchScoreDisplay
{
Anchor = Anchor.BottomCentre,
Origin = Anchor.BottomCentre,
Team1Score = { BindTarget = LeaderboardProvider.TeamScores[0] },
Team2Score = { BindTarget = LeaderboardProvider.TeamScores[1] },
Expanded = { BindTarget = Leaderboard!.ForceExpand },
}, Add);
Leaderboard!.CollapseDuringGameplay.BindValueChanged(_ => matchScoreDisplay.Expanded.Value = !Leaderboard.CollapseDuringGameplay.Value);
});
}
}
@@ -154,7 +154,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
});
leaderboardFlow.Insert(0, Leaderboard = new DrawableGameplayLeaderboard
{
ForceExpand = { Value = true }
CollapseDuringGameplay = { Value = false }
});
LoadComponentAsync(new GameplayChatDisplay(room)
@@ -20,8 +20,6 @@ namespace osu.Game.Screens.Play.HUD
{
public partial class DrawableGameplayLeaderboard : CompositeDrawable, ISerialisableDrawable
{
public readonly Bindable<bool> ForceExpand = new Bindable<bool>();
protected readonly FillFlowContainer<DrawableGameplayLeaderboardScore> Flow;
private bool requiresScroll;
@@ -100,7 +98,6 @@ namespace osu.Game.Screens.Play.HUD
configVisibility.BindValueChanged(_ => Scheduler.AddOnce(updateState));
userPlayingState.BindValueChanged(_ => Scheduler.AddOnce(updateState));
holdingForHUD.BindValueChanged(_ => Scheduler.AddOnce(updateState));
ForceExpand.BindValueChanged(_ => Scheduler.AddOnce(updateState));
CollapseDuringGameplay.BindValueChanged(_ => Scheduler.AddOnce(updateState));
updateState();
}
@@ -112,7 +109,7 @@ namespace osu.Game.Screens.Play.HUD
scroll.ScrollToStart(false);
Flow.FadeTo(player?.Configuration.ShowLeaderboard != false && configVisibility.Value ? 1 : 0, 100, Easing.OutQuint);
expanded.Value = !CollapseDuringGameplay.Value || ForceExpand.Value || userPlayingState.Value != LocalUserPlayingState.Playing || holdingForHUD.Value;
expanded.Value = !CollapseDuringGameplay.Value || userPlayingState.Value != LocalUserPlayingState.Playing || holdingForHUD.Value;
}
/// <summary>