mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:57:39 +08:00
Bindable handling in DrawableTournamentTeam
This commit is contained in:
parent
93fc14426b
commit
58136360e0
@ -1,7 +1,9 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. 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 @@ namespace osu.Game.Tournament.Components
|
||||
protected readonly Sprite Flag;
|
||||
protected readonly OsuSpriteText AcronymText;
|
||||
|
||||
[UsedImplicitly]
|
||||
private Bindable<string> acronym;
|
||||
|
||||
[UsedImplicitly]
|
||||
private Bindable<string> flag;
|
||||
|
||||
protected DrawableTournamentTeam(TournamentTeam team)
|
||||
{
|
||||
Team = team;
|
||||
@ -30,7 +38,6 @@ namespace osu.Game.Tournament.Components
|
||||
|
||||
AcronymText = new OsuSpriteText
|
||||
{
|
||||
Text = team?.Acronym.Value?.ToUpperInvariant() ?? string.Empty,
|
||||
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
||||
};
|
||||
}
|
||||
@ -38,8 +45,10 @@ namespace osu.Game.Tournament.Components
|
||||
[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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user