mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 23:23:04 +08:00
Merge pull request #23329 from rltn/clickable-country-name-in-profile
Clickable country name in profile
This commit is contained in:
commit
119687cf6e
@ -11,6 +11,7 @@ using osu.Framework.Graphics.Effects;
|
|||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
@ -31,6 +32,9 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private IAPIProvider api { get; set; } = null!;
|
private IAPIProvider api { get; set; } = null!;
|
||||||
|
|
||||||
|
[Resolved]
|
||||||
|
private RankingsOverlay? rankingsOverlay { get; set; }
|
||||||
|
|
||||||
private UserCoverBackground cover = null!;
|
private UserCoverBackground cover = null!;
|
||||||
private SupporterIcon supporterTag = null!;
|
private SupporterIcon supporterTag = null!;
|
||||||
private UpdateableAvatar avatar = null!;
|
private UpdateableAvatar avatar = null!;
|
||||||
@ -38,6 +42,7 @@ 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 OsuHoverContainer userCountryContainer = null!;
|
||||||
private OsuSpriteText userCountryText = null!;
|
private OsuSpriteText userCountryText = null!;
|
||||||
private GroupBadgeFlow groupBadgeFlow = null!;
|
private GroupBadgeFlow groupBadgeFlow = null!;
|
||||||
private ToggleCoverButton coverToggle = null!;
|
private ToggleCoverButton coverToggle = null!;
|
||||||
@ -156,13 +161,17 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
Size = new Vector2(28, 20),
|
Size = new Vector2(28, 20),
|
||||||
ShowPlaceholderOnUnknown = false,
|
ShowPlaceholderOnUnknown = false,
|
||||||
},
|
},
|
||||||
userCountryText = new OsuSpriteText
|
userCountryContainer = new OsuHoverContainer
|
||||||
|
{
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Anchor = Anchor.CentreLeft,
|
||||||
|
Origin = Anchor.CentreLeft,
|
||||||
|
Margin = new MarginPadding { Left = 5 },
|
||||||
|
Child = userCountryText = new OsuSpriteText
|
||||||
{
|
{
|
||||||
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
|
Font = OsuFont.GetFont(size: 14f, weight: FontWeight.Regular),
|
||||||
Margin = new MarginPadding { Left = 5 },
|
},
|
||||||
Origin = Anchor.CentreLeft,
|
},
|
||||||
Anchor = Anchor.CentreLeft,
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
@ -202,6 +211,7 @@ namespace osu.Game.Overlays.Profile.Header
|
|||||||
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
|
openUserExternally.Link = $@"{api.WebsiteRootUrl}/users/{user?.Id ?? 0}";
|
||||||
userFlag.CountryCode = user?.CountryCode ?? default;
|
userFlag.CountryCode = user?.CountryCode ?? default;
|
||||||
userCountryText.Text = (user?.CountryCode ?? default).GetDescription();
|
userCountryText.Text = (user?.CountryCode ?? default).GetDescription();
|
||||||
|
userCountryContainer.Action = () => rankingsOverlay?.ShowCountry(user?.CountryCode ?? default);
|
||||||
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");
|
||||||
|
Loading…
Reference in New Issue
Block a user