mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 16:43:00 +08:00
Change TeamFlag from sprite to a container with a sprite
This commit is contained in:
parent
a4ba2181ec
commit
d9ba677773
@ -4,19 +4,24 @@
|
||||
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;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Tournament.Models;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Tournament.Components
|
||||
{
|
||||
public class DrawableTeamFlag : Sprite
|
||||
public class DrawableTeamFlag : Container
|
||||
{
|
||||
private readonly TournamentTeam team;
|
||||
|
||||
[UsedImplicitly]
|
||||
private Bindable<string> flag;
|
||||
|
||||
private Sprite flagSprite;
|
||||
|
||||
public DrawableTeamFlag(TournamentTeam team)
|
||||
{
|
||||
this.team = team;
|
||||
@ -27,7 +32,18 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
if (team == null) return;
|
||||
|
||||
(flag = team.FlagName.GetBoundCopy()).BindValueChanged(acronym => Texture = textures.Get($@"Flags/{team.FlagName}"), true);
|
||||
Size = new Vector2(70, 47);
|
||||
Masking = true;
|
||||
CornerRadius = 5;
|
||||
Child = flagSprite = new Sprite
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Anchor = Anchor.Centre,
|
||||
Origin = Anchor.Centre,
|
||||
FillMode = FillMode.Fill
|
||||
};
|
||||
|
||||
(flag = team.FlagName.GetBoundCopy()).BindValueChanged(acronym => flagSprite.Texture = textures.Get($@"Flags/{team.FlagName}"), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,7 @@
|
||||
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;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Tournament.Models;
|
||||
@ -17,7 +15,7 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
public readonly TournamentTeam Team;
|
||||
|
||||
protected readonly Sprite Flag;
|
||||
protected readonly Container Flag;
|
||||
protected readonly TournamentSpriteText AcronymText;
|
||||
|
||||
[UsedImplicitly]
|
||||
@ -27,12 +25,7 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
Team = team;
|
||||
|
||||
Flag = new DrawableTeamFlag(team)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fit
|
||||
};
|
||||
|
||||
Flag = new DrawableTeamFlag(team);
|
||||
AcronymText = new TournamentSpriteText
|
||||
{
|
||||
Font = OsuFont.Torus.With(weight: FontWeight.Regular),
|
||||
|
@ -63,7 +63,7 @@ namespace osu.Game.Tournament.Screens.Ladder.Components
|
||||
this.losers = losers;
|
||||
Size = new Vector2(150, 40);
|
||||
|
||||
Flag.Scale = new Vector2(0.9f);
|
||||
Flag.Scale = new Vector2(0.6f);
|
||||
Flag.Anchor = Flag.Origin = Anchor.CentreLeft;
|
||||
|
||||
AcronymText.Anchor = AcronymText.Origin = Anchor.CentreLeft;
|
||||
|
Loading…
Reference in New Issue
Block a user