1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-23 14:53:21 +08:00

Adjust handling of team flags with non-matching aspect ratio to match web

This commit is contained in:
Bartłomiej Dach 2025-02-20 15:44:30 +01:00
parent 7566da8663
commit 7dc5ad2f0e
No known key found for this signature in database
2 changed files with 24 additions and 6 deletions

View File

@ -6,6 +6,7 @@ using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Game.Tournament.Models; using osu.Game.Tournament.Models;
@ -35,12 +36,20 @@ namespace osu.Game.Tournament.Components
Size = new Vector2(75, 54); Size = new Vector2(75, 54);
Masking = true; Masking = true;
CornerRadius = 5; CornerRadius = 5;
Child = flagSprite = new Sprite Children = new Drawable[]
{
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Colour4.FromHex("333"),
},
flagSprite = new Sprite
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
FillMode = FillMode.Fill FillMode = FillMode.Fit
},
}; };
(flag = team.FlagName.GetBoundCopy()).BindValueChanged(_ => flagSprite.Texture = textures.Get($@"Flags/{team.FlagName}"), true); (flag = team.FlagName.GetBoundCopy()).BindValueChanged(_ => flagSprite.Texture = textures.Get($@"Flags/{team.FlagName}"), true);

View File

@ -5,6 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.Textures; using osu.Framework.Graphics.Textures;
using osu.Framework.Localisation; using osu.Framework.Localisation;
@ -75,10 +76,18 @@ namespace osu.Game.Users.Drawables
InternalChildren = new Drawable[] InternalChildren = new Drawable[]
{ {
new HoverClickSounds(), new HoverClickSounds(),
new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Colour4.FromHex("333"),
},
new Sprite new Sprite
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Texture = textures.Get(team.FlagUrl) Texture = textures.Get(team.FlagUrl),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
FillMode = FillMode.Fit,
} }
}; };
} }