2019-03-04 04:24:19 +00:00
|
|
|
// 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.
|
2018-08-25 16:14:18 +00:00
|
|
|
|
2019-06-17 08:30:26 +00:00
|
|
|
using JetBrains.Annotations;
|
2018-08-25 16:14:18 +00:00
|
|
|
using osu.Framework.Allocation;
|
2019-06-17 08:30:26 +00:00
|
|
|
using osu.Framework.Bindables;
|
2018-08-25 16:14:18 +00:00
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Framework.Graphics.Textures;
|
2019-05-15 04:10:58 +00:00
|
|
|
using osu.Game.Graphics;
|
2018-08-25 16:14:18 +00:00
|
|
|
using osu.Game.Graphics.Sprites;
|
2019-06-18 05:51:48 +00:00
|
|
|
using osu.Game.Tournament.Models;
|
2018-08-25 16:14:18 +00:00
|
|
|
|
2018-08-25 16:24:19 +00:00
|
|
|
namespace osu.Game.Tournament.Components
|
2018-08-25 16:14:18 +00:00
|
|
|
{
|
|
|
|
public abstract class DrawableTournamentTeam : CompositeDrawable
|
|
|
|
{
|
|
|
|
public readonly TournamentTeam Team;
|
|
|
|
|
|
|
|
protected readonly Sprite Flag;
|
|
|
|
protected readonly OsuSpriteText AcronymText;
|
|
|
|
|
2019-06-17 08:30:26 +00:00
|
|
|
[UsedImplicitly]
|
|
|
|
private Bindable<string> acronym;
|
|
|
|
|
|
|
|
[UsedImplicitly]
|
|
|
|
private Bindable<string> flag;
|
|
|
|
|
2018-08-25 16:14:18 +00:00
|
|
|
protected DrawableTournamentTeam(TournamentTeam team)
|
|
|
|
{
|
|
|
|
Team = team;
|
|
|
|
|
|
|
|
Flag = new Sprite
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
|
|
|
FillMode = FillMode.Fit
|
|
|
|
};
|
|
|
|
|
|
|
|
AcronymText = new OsuSpriteText
|
|
|
|
{
|
2019-05-15 04:10:58 +00:00
|
|
|
Font = OsuFont.GetFont(weight: FontWeight.Regular),
|
2018-08-25 16:14:18 +00:00
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(TextureStore textures)
|
|
|
|
{
|
2019-06-17 08:30:26 +00:00
|
|
|
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);
|
2018-08-25 16:14:18 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|