1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-08 01:23:05 +08:00

Hide score displays during warmup

This commit is contained in:
Dean Herbert 2020-03-07 14:46:40 +09:00
parent 86b12a384b
commit e25206728f
3 changed files with 31 additions and 7 deletions

View File

@ -15,6 +15,18 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{ {
public class MatchHeader : Container public class MatchHeader : Container
{ {
private TeamScoreDisplay teamDisplay1;
private TeamScoreDisplay teamDisplay2;
public bool ShowScores
{
set
{
teamDisplay1.ShowScore = value;
teamDisplay2.ShowScore = value;
}
}
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -43,13 +55,12 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
}, },
} }
}, },
teamDisplay1 = new TeamScoreDisplay(TeamColour.Red)
new TeamScoreDisplay(TeamColour.Red)
{ {
Anchor = Anchor.TopLeft, Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft, Origin = Anchor.TopLeft,
}, },
new TeamScoreDisplay(TeamColour.Blue) teamDisplay2 = new TeamScoreDisplay(TeamColour.Blue)
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
@ -66,6 +77,10 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>(); private readonly Bindable<TournamentTeam> currentTeam = new Bindable<TournamentTeam>();
private readonly Bindable<int?> currentTeamScore = new Bindable<int?>(); private readonly Bindable<int?> currentTeamScore = new Bindable<int?>();
private TeamDisplay teamDisplay;
public bool ShowScore { set => teamDisplay.ShowScore = value; }
public TeamScoreDisplay(TeamColour teamColour) public TeamScoreDisplay(TeamColour teamColour)
{ {
this.teamColour = teamColour; this.teamColour = teamColour;
@ -116,7 +131,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{ {
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value.PointsToWin), teamDisplay = new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value.PointsToWin),
}; };
} }
} }

View File

@ -12,6 +12,10 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{ {
public class TeamDisplay : DrawableTournamentTeam public class TeamDisplay : DrawableTournamentTeam
{ {
private readonly TeamScore score;
public bool ShowScore { set => score.FadeTo(value ? 1 : 0, 200); }
public TeamDisplay(TournamentTeam team, TeamColour colour, Bindable<int?> currentTeamScore, int pointsToWin) public TeamDisplay(TournamentTeam team, TeamColour colour, Bindable<int?> currentTeamScore, int pointsToWin)
: base(team) : base(team)
{ {
@ -63,7 +67,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
Origin = anchor, Origin = anchor,
Anchor = anchor, Anchor = anchor,
}, },
new TeamScore(currentTeamScore, colour, pointsToWin) score = new TeamScore(currentTeamScore, colour, pointsToWin)
{ {
Origin = anchor, Origin = anchor,
Anchor = anchor, Anchor = anchor,

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
Loop = true, Loop = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
new MatchHeader(), header = new MatchHeader(),
new Container new Container
{ {
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
@ -108,13 +108,18 @@ namespace osu.Game.Tournament.Screens.Gameplay
currentMatch.BindTo(ladder.CurrentMatch); currentMatch.BindTo(ladder.CurrentMatch);
warmup.BindValueChanged(w => warmupButton.Alpha = !w.NewValue ? 0.5f : 1, true); warmup.BindValueChanged(w =>
{
warmupButton.Alpha = !w.NewValue ? 0.5f : 1;
header.ShowScores = !w.NewValue;
}, true);
} }
private ScheduledDelegate scheduledOperation; private ScheduledDelegate scheduledOperation;
private MatchScoreDisplay scoreDisplay; private MatchScoreDisplay scoreDisplay;
private TourneyState lastState; private TourneyState lastState;
private MatchHeader header;
private void stateChanged(ValueChangedEvent<TourneyState> state) private void stateChanged(ValueChangedEvent<TourneyState> state)
{ {