1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 22:07:25 +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
{
private TeamScoreDisplay teamDisplay1;
private TeamScoreDisplay teamDisplay2;
public bool ShowScores
{
set
{
teamDisplay1.ShowScore = value;
teamDisplay2.ShowScore = value;
}
}
[BackgroundDependencyLoader]
private void load()
{
@ -43,13 +55,12 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
},
}
},
new TeamScoreDisplay(TeamColour.Red)
teamDisplay1 = new TeamScoreDisplay(TeamColour.Red)
{
Anchor = Anchor.TopLeft,
Origin = Anchor.TopLeft,
},
new TeamScoreDisplay(TeamColour.Blue)
teamDisplay2 = new TeamScoreDisplay(TeamColour.Blue)
{
Anchor = 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<int?> currentTeamScore = new Bindable<int?>();
private TeamDisplay teamDisplay;
public bool ShowScore { set => teamDisplay.ShowScore = value; }
public TeamScoreDisplay(TeamColour teamColour)
{
this.teamColour = teamColour;
@ -116,7 +131,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{
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
{
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)
: base(team)
{
@ -63,7 +67,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
Origin = anchor,
Anchor = anchor,
},
new TeamScore(currentTeamScore, colour, pointsToWin)
score = new TeamScore(currentTeamScore, colour, pointsToWin)
{
Origin = anchor,
Anchor = anchor,

View File

@ -48,7 +48,7 @@ namespace osu.Game.Tournament.Screens.Gameplay
Loop = true,
RelativeSizeAxes = Axes.Both,
},
new MatchHeader(),
header = new MatchHeader(),
new Container
{
RelativeSizeAxes = Axes.X,
@ -108,13 +108,18 @@ namespace osu.Game.Tournament.Screens.Gameplay
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 MatchScoreDisplay scoreDisplay;
private TourneyState lastState;
private MatchHeader header;
private void stateChanged(ValueChangedEvent<TourneyState> state)
{