1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-25 18:57:18 +08:00

Add team flag display to rankings overlays

This commit is contained in:
Dean Herbert 2025-02-14 19:30:23 +09:00
parent b86eeabef0
commit 1b5101ed5e
No known key found for this signature in database
4 changed files with 14 additions and 15 deletions

View File

@ -80,7 +80,7 @@ namespace osu.Game.Overlays
protected override CountryCode GetCountryCode(APIUser item) => item.CountryCode;
protected override Drawable CreateFlagContent(APIUser item)
protected override Drawable[] CreateFlagContent(APIUser item)
{
var username = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: TEXT_SIZE, italics: true))
{
@ -89,7 +89,7 @@ namespace osu.Game.Overlays
TextAnchor = Anchor.CentreLeft
};
username.AddUserLink(item);
return username;
return [username];
}
}
}

View File

@ -34,7 +34,7 @@ namespace osu.Game.Overlays.Rankings.Tables
protected override CountryCode GetCountryCode(CountryStatistics item) => item.Code;
protected override Drawable CreateFlagContent(CountryStatistics item) => new CountryName(item.Code);
protected override Drawable[] CreateFlagContent(CountryStatistics item) => [new CountryName(item.Code)];
protected override Drawable[] CreateAdditionalContent(CountryStatistics item) => new Drawable[]
{

View File

@ -80,7 +80,7 @@ namespace osu.Game.Overlays.Rankings.Tables
protected abstract CountryCode GetCountryCode(TModel item);
protected abstract Drawable CreateFlagContent(TModel item);
protected abstract Drawable[] CreateFlagContent(TModel item);
private OsuSpriteText createIndexDrawable(int index) => new RowText
{
@ -92,16 +92,13 @@ namespace osu.Game.Overlays.Rankings.Tables
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Spacing = new Vector2(5, 0),
Margin = new MarginPadding { Bottom = row_spacing },
Children = new[]
{
new UpdateableFlag(GetCountryCode(item))
{
Size = new Vector2(28, 20),
},
CreateFlagContent(item)
}
Children =
[
new UpdateableFlag(GetCountryCode(item)) { Size = new Vector2(28, 20) },
..CreateFlagContent(item)
]
};
protected class RankingsTableColumn : TableColumn

View File

@ -14,6 +14,8 @@ using osu.Game.Users;
using osu.Game.Scoring;
using osu.Framework.Localisation;
using osu.Game.Resources.Localisation.Web;
using osu.Game.Users.Drawables;
using osuTK;
namespace osu.Game.Overlays.Rankings.Tables
{
@ -61,7 +63,7 @@ namespace osu.Game.Overlays.Rankings.Tables
protected sealed override CountryCode GetCountryCode(UserStatistics item) => item.User.CountryCode;
protected sealed override Drawable CreateFlagContent(UserStatistics item)
protected sealed override Drawable[] CreateFlagContent(UserStatistics item)
{
var username = new LinkFlowContainer(t => t.Font = OsuFont.GetFont(size: TEXT_SIZE, italics: true))
{
@ -70,7 +72,7 @@ namespace osu.Game.Overlays.Rankings.Tables
TextAnchor = Anchor.CentreLeft
};
username.AddUserLink(item.User);
return username;
return [new UpdateableTeamFlag(item.User.Team) { Size = new Vector2(40, 20) }, username];
}
protected sealed override Drawable[] CreateAdditionalContent(UserStatistics item) => new[]