diff --git a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs index 8fb166f129..704d5a47de 100644 --- a/osu.Game.Tournament/Components/DrawableTournamentTeam.cs +++ b/osu.Game.Tournament/Components/DrawableTournamentTeam.cs @@ -1,7 +1,9 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using JetBrains.Annotations; using osu.Framework.Allocation; +using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Sprites; @@ -18,6 +20,12 @@ public abstract class DrawableTournamentTeam : CompositeDrawable protected readonly Sprite Flag; protected readonly OsuSpriteText AcronymText; + [UsedImplicitly] + private Bindable acronym; + + [UsedImplicitly] + private Bindable flag; + protected DrawableTournamentTeam(TournamentTeam team) { Team = team; @@ -30,7 +38,6 @@ protected DrawableTournamentTeam(TournamentTeam team) AcronymText = new OsuSpriteText { - Text = team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty, Font = OsuFont.GetFont(weight: FontWeight.Regular), }; } @@ -38,8 +45,10 @@ protected DrawableTournamentTeam(TournamentTeam team) [BackgroundDependencyLoader] private void load(TextureStore textures) { - if (Team != null) - Flag.Texture = textures.Get($@"Flags/{Team.FlagName}"); + if (Team == null) return; + + (acronym = Team.Acronym.GetBoundCopy()).BindValueChanged(acronym => AcronymText.Text = Team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty, true); + (flag = Team.FlagName.GetBoundCopy()).BindValueChanged(acronym => Flag.Texture = textures.Get($@"Flags/{Team.FlagName}"), true); } } }