mirror of https://github.com/ppy/osu
Hide score displays during warmup
This commit is contained in:
parent
86b12a384b
commit
e25206728f
|
@ -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 @@ private void load()
|
|||
},
|
||||
}
|
||||
},
|
||||
|
||||
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 @@ public class TeamScoreDisplay : CompositeDrawable
|
|||
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 @@ private void teamChanged(TournamentTeam team)
|
|||
{
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value.PointsToWin),
|
||||
teamDisplay = new TeamDisplay(team, teamColour, currentTeamScore, currentMatch.Value.PointsToWin),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 @@ public TeamDisplay(TournamentTeam team, TeamColour colour, Bindable<int?> curren
|
|||
Origin = anchor,
|
||||
Anchor = anchor,
|
||||
},
|
||||
new TeamScore(currentTeamScore, colour, pointsToWin)
|
||||
score = new TeamScore(currentTeamScore, colour, pointsToWin)
|
||||
{
|
||||
Origin = anchor,
|
||||
Anchor = anchor,
|
||||
|
|
|
@ -48,7 +48,7 @@ private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
|
|||
Loop = true,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
},
|
||||
new MatchHeader(),
|
||||
header = new MatchHeader(),
|
||||
new Container
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
|
@ -108,13 +108,18 @@ private void load(LadderInfo ladder, MatchIPCInfo ipc, Storage storage)
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue