1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-22 00:43:25 +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",
Discord = "test_user",
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 OsuSpriteText titleText = null!;
private UpdateableFlag userFlag = null!;
private UpdateableTeamFlag teamFlag = null!;
private OsuHoverContainer userCountryContainer = null!;
private OsuSpriteText userCountryText = null!;
private UpdateableTeamFlag teamFlag = null!;
private OsuSpriteText teamText = null!;
private GroupBadgeFlow groupBadgeFlow = null!;
private ToggleCoverButton coverToggle = null!;
private PreviousUsernamesDisplay previousUsernamesDisplay = null!;
@ -155,33 +156,58 @@ namespace osu.Game.Overlays.Profile.Header
titleText = new OsuSpriteText
{
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[]
{
userFlag = new UpdateableFlag
{
Size = new Vector2(28, 20),
},
teamFlag = new UpdateableTeamFlag
{
Size = new Vector2(40, 20),
},
userCountryContainer = new OsuHoverContainer
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Margin = new MarginPadding { Left = 5 },
Child = userCountryText = new OsuSpriteText
Direction = FillDirection.Horizontal,
Spacing = new Vector2(4, 0),
Children = new Drawable[]
{
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
},
userFlag = new UpdateableFlag
{
Size = new Vector2(28, 20),
},
userCountryContainer = new OsuHoverContainer
{
AutoSizeAxes = Axes.Both,
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Child = userCountryText = new OsuSpriteText
{
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
},
},
}
},
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;
openUserExternally.Link = $@"{api.Endpoints.WebsiteUrl}/users/{user?.Id ?? 0}";
userFlag.CountryCode = user?.CountryCode ?? default;
teamFlag.Team = user?.Team;
userCountryText.Text = (user?.CountryCode ?? default).GetDescription();
userCountryContainer.Action = () => rankingsOverlay?.ShowCountry(user?.CountryCode ?? default);
teamFlag.Team = user?.Team;
teamText.Text = user?.Team?.Name ?? string.Empty;
supporterTag.SupportLevel = user?.SupportLevel ?? 0;
titleText.Text = user?.Title ?? string.Empty;
titleText.Colour = Color4Extensions.FromHex(user?.Colour ?? "fff");