Fix team name not updating on TeamDisplay immediately

This commit is contained in:
Dean Herbert 2022-07-13 18:10:27 +09:00
parent 4dff999ce6
commit 1516756d8b
2 changed files with 12 additions and 2 deletions

View File

@ -12,7 +12,8 @@ namespace osu.Game.Tournament.Components
{ {
public class TournamentSpriteTextWithBackground : CompositeDrawable public class TournamentSpriteTextWithBackground : CompositeDrawable
{ {
protected readonly TournamentSpriteText Text; public readonly TournamentSpriteText Text;
protected readonly Box Background; protected readonly Box Background;
public TournamentSpriteTextWithBackground(string text = "") public TournamentSpriteTextWithBackground(string text = "")

View File

@ -16,6 +16,10 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
{ {
private readonly TeamScore score; private readonly TeamScore score;
private readonly TournamentSpriteTextWithBackground teamText;
private readonly Bindable<string> teamName = new Bindable<string>("???");
private bool showScore; private bool showScore;
public bool ShowScore public bool ShowScore
@ -93,7 +97,7 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
} }
} }
}, },
new TournamentSpriteTextWithBackground(team?.FullName.Value ?? "???") teamText = new TournamentSpriteTextWithBackground
{ {
Scale = new Vector2(0.5f), Scale = new Vector2(0.5f),
Origin = anchor, Origin = anchor,
@ -113,6 +117,11 @@ namespace osu.Game.Tournament.Screens.Gameplay.Components
updateDisplay(); updateDisplay();
FinishTransforms(true); FinishTransforms(true);
if (Team != null)
teamName.BindTo(Team.FullName);
teamName.BindValueChanged(name => teamText.Text.Text = name.NewValue, true);
} }
private void updateDisplay() private void updateDisplay()