mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 16:13:34 +08:00
Support displaying team seed in TeamDisplay
This commit is contained in:
parent
c5ff708c6f
commit
28e331deed
@ -21,6 +21,7 @@ namespace osu.Game.Tournament.Tests.Components
|
||||
{
|
||||
FlagName = { Value = "AU" },
|
||||
FullName = { Value = "Australia" },
|
||||
Seed = { Value = "#5" },
|
||||
Players =
|
||||
{
|
||||
new TournamentUser { Username = "ASecretBox" },
|
||||
@ -30,7 +31,7 @@ namespace osu.Game.Tournament.Tests.Components
|
||||
new TournamentUser { Username = "Parkes" },
|
||||
new TournamentUser { Username = "Shiroha" },
|
||||
new TournamentUser { Username = "Jordan The Bear" },
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
var match = new TournamentMatch { Team1 = { Value = team } };
|
||||
@ -100,7 +101,7 @@ namespace osu.Game.Tournament.Tests.Components
|
||||
Cell(i).AddRange(new Drawable[]
|
||||
{
|
||||
new TournamentSpriteText { Text = "TeamDisplay" },
|
||||
new TeamDisplay(team, TeamColour.Red, new Bindable<int?>(2), 6)
|
||||
new TeamDisplay(team, TeamColour.Red, new Bindable<int?>(2), 6, true)
|
||||
{
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
|
@ -67,7 +67,7 @@ namespace osu.Game.Tournament.Tests
|
||||
FlagName = { Value = "JP" },
|
||||
FullName = { Value = "Japan" },
|
||||
LastYearPlacing = { Value = 10 },
|
||||
Seed = { Value = "Low" },
|
||||
Seed = { Value = "#12" },
|
||||
SeedingResults =
|
||||
{
|
||||
new SeedingResult
|
||||
@ -140,6 +140,7 @@ namespace osu.Game.Tournament.Tests
|
||||
Acronym = { Value = "USA" },
|
||||
FlagName = { Value = "US" },
|
||||
FullName = { Value = "United States" },
|
||||
Seed = { Value = "#3" },
|
||||
Players =
|
||||
{
|
||||
new TournamentUser { Username = "Hello" },
|
||||
|
@ -14,9 +14,11 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
{
|
||||
private readonly TeamScore score;
|
||||
|
||||
private readonly TournamentSpriteTextWithBackground teamText;
|
||||
private readonly TournamentSpriteTextWithBackground teamNameText;
|
||||
private readonly TournamentSpriteTextWithBackground teamSeedText;
|
||||
|
||||
private readonly Bindable<string> teamName = new Bindable<string>("???");
|
||||
private readonly Bindable<string> teamSeed = new Bindable<string>();
|
||||
|
||||
private bool showScore;
|
||||
|
||||
@ -35,7 +37,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
}
|
||||
}
|
||||
|
||||
public TeamDisplay(TournamentTeam? team, TeamColour colour, Bindable<int?> currentTeamScore, int pointsToWin)
|
||||
public TeamDisplay(TournamentTeam? team, TeamColour colour, Bindable<int?> currentTeamScore, int pointsToWin, bool displaySeed)
|
||||
: base(team)
|
||||
{
|
||||
AutoSizeAxes = Axes.Both;
|
||||
@ -95,11 +97,29 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
}
|
||||
}
|
||||
},
|
||||
teamText = new TournamentSpriteTextWithBackground
|
||||
new FillFlowContainer
|
||||
{
|
||||
Scale = new Vector2(0.5f),
|
||||
AutoSizeAxes = Axes.Both,
|
||||
Direction = FillDirection.Horizontal,
|
||||
Spacing = new Vector2(5),
|
||||
Origin = anchor,
|
||||
Anchor = anchor,
|
||||
Children = new Drawable[]
|
||||
{
|
||||
teamNameText = new TournamentSpriteTextWithBackground
|
||||
{
|
||||
Scale = new Vector2(0.5f),
|
||||
Origin = anchor,
|
||||
Anchor = anchor,
|
||||
},
|
||||
teamSeedText = new TournamentSpriteTextWithBackground
|
||||
{
|
||||
Scale = new Vector2(0.5f),
|
||||
Origin = anchor,
|
||||
Anchor = anchor,
|
||||
Alpha = displaySeed ? 1 : 0,
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
@ -117,9 +137,13 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
FinishTransforms(true);
|
||||
|
||||
if (Team != null)
|
||||
{
|
||||
teamName.BindTo(Team.FullName);
|
||||
teamSeed.BindTo(Team.Seed);
|
||||
}
|
||||
|
||||
teamName.BindValueChanged(name => teamText.Text.Text = name.NewValue, true);
|
||||
teamName.BindValueChanged(name => teamNameText.Text.Text = name.NewValue, true);
|
||||
teamSeed.BindValueChanged(seed => teamSeedText.Text.Text = seed.NewValue, true);
|
||||
}
|
||||
|
||||
private void updateDisplay()
|
||||
|
@ -21,6 +21,8 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
private TeamDisplay? teamDisplay;
|
||||
|
||||
public readonly BindableBool DisplaySeed = new BindableBool();
|
||||
|
||||
public bool ShowScore
|
||||
{
|
||||
get => teamDisplay?.ShowScore ?? false;
|
||||
@ -48,6 +50,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
currentMatch.BindValueChanged(matchChanged);
|
||||
|
||||
currentTeam.BindValueChanged(teamChanged);
|
||||
DisplaySeed.BindValueChanged(_ => currentTeam.TriggerChange());
|
||||
|
||||
updateMatch();
|
||||
}
|
||||
@ -101,7 +104,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
|
||||
|
||||
InternalChildren = new Drawable[]
|
||||
{
|
||||
teamDisplay = new TeamDisplay(team.NewValue, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0),
|
||||
teamDisplay = new TeamDisplay(team.NewValue, teamColour, currentTeamScore, currentMatch.Value?.PointsToWin ?? 0, DisplaySeed.Value),
|
||||
};
|
||||
|
||||
teamDisplay.ShowScore = wasShowingScores;
|
||||
|
Loading…
Reference in New Issue
Block a user