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

Merge pull request #31904 from Joehuu/fix-profile-team-flag-layout

Fix team flag layout on user profile
This commit is contained in:
Salman Alshamrani 2025-02-16 20:23:03 -05:00 committed by GitHub
commit 20d89f3c87
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 52 additions and 18 deletions

View File

@ -346,6 +346,13 @@ namespace osu.Game.Tests.Visual.Online
Twitter = "test_user", Twitter = "test_user",
Discord = "test_user", Discord = "test_user",
Website = "https://google.com", Website = "https://google.com",
Team = new APITeam
{
Id = 1,
Name = "Collective Wangs",
ShortName = "WANG",
FlagUrl = "https://assets.ppy.sh/teams/logo/1/wanglogo.jpg",
}
}; };
} }
} }

View File

@ -42,9 +42,10 @@ namespace osu.Game.Overlays.Profile.Header
private ExternalLinkButton openUserExternally = null!; private ExternalLinkButton openUserExternally = null!;
private OsuSpriteText titleText = null!; private OsuSpriteText titleText = null!;
private UpdateableFlag userFlag = null!; private UpdateableFlag userFlag = null!;
private UpdateableTeamFlag teamFlag = null!;
private OsuHoverContainer userCountryContainer = null!; private OsuHoverContainer userCountryContainer = null!;
private OsuSpriteText userCountryText = null!; private OsuSpriteText userCountryText = null!;
private UpdateableTeamFlag teamFlag = null!;
private OsuSpriteText teamText = null!;
private GroupBadgeFlow groupBadgeFlow = null!; private GroupBadgeFlow groupBadgeFlow = null!;
private ToggleCoverButton coverToggle = null!; private ToggleCoverButton coverToggle = null!;
private PreviousUsernamesDisplay previousUsernamesDisplay = null!; private PreviousUsernamesDisplay previousUsernamesDisplay = null!;
@ -155,28 +156,32 @@ namespace osu.Game.Overlays.Profile.Header
titleText = new OsuSpriteText titleText = new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular), Font = OsuFont.GetFont(size: 16, weight: FontWeight.Regular),
Margin = new MarginPadding { Bottom = 5 } Margin = new MarginPadding { Bottom = 3 },
}, },
new FillFlowContainer
{
Margin = new MarginPadding { Top = 3 },
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[]
{
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Spacing = new Vector2(4, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
userFlag = new UpdateableFlag userFlag = new UpdateableFlag
{ {
Size = new Vector2(28, 20), Size = new Vector2(28, 20),
}, },
teamFlag = new UpdateableTeamFlag
{
Size = new Vector2(40, 20),
},
userCountryContainer = new OsuHoverContainer userCountryContainer = new OsuHoverContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Margin = new MarginPadding { Left = 5 },
Child = userCountryText = new OsuSpriteText Child = userCountryText = new OsuSpriteText
{ {
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular), Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
@ -184,6 +189,27 @@ namespace osu.Game.Overlays.Profile.Header
}, },
} }
}, },
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(4, 0),
Children = new Drawable[]
{
teamFlag = new UpdateableTeamFlag
{
Size = new Vector2(40, 20),
},
teamText = new OsuSpriteText
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
},
}
}
}
},
} }
}, },
} }
@ -220,9 +246,10 @@ namespace osu.Game.Overlays.Profile.Header
usernameText.Text = user?.Username ?? string.Empty; usernameText.Text = user?.Username ?? string.Empty;
openUserExternally.Link = $@"{api.Endpoints.WebsiteUrl}/users/{user?.Id ?? 0}"; openUserExternally.Link = $@"{api.Endpoints.WebsiteUrl}/users/{user?.Id ?? 0}";
userFlag.CountryCode = user?.CountryCode ?? default; userFlag.CountryCode = user?.CountryCode ?? default;
teamFlag.Team = user?.Team;
userCountryText.Text = (user?.CountryCode ?? default).GetDescription(); userCountryText.Text = (user?.CountryCode ?? default).GetDescription();
userCountryContainer.Action = () => rankingsOverlay?.ShowCountry(user?.CountryCode ?? default); userCountryContainer.Action = () => rankingsOverlay?.ShowCountry(user?.CountryCode ?? default);
teamFlag.Team = user?.Team;
teamText.Text = user?.Team?.Name ?? string.Empty;
supporterTag.SupportLevel = user?.SupportLevel ?? 0; supporterTag.SupportLevel = user?.SupportLevel ?? 0;
titleText.Text = user?.Title ?? string.Empty; titleText.Text = user?.Title ?? string.Empty;
titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff"); titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff");