1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-13 19:54:15 +08:00

Show user rank on list panels (#37659)

Addresses https://github.com/ppy/osu/discussions/37616 partly.

<img width="828" height="826" alt="osu! 2026-05-07 at 06 59 23"
src="https://github.com/user-attachments/assets/15343112-dc07-4501-b291-b53db870be5a"
/>
This commit is contained in:
Dean Herbert
2026-05-08 15:34:59 +09:00
committed by GitHub
Unverified
parent 21c892fa7d
commit 9e20929ad3
4 changed files with 75 additions and 7 deletions
@@ -56,6 +56,17 @@ namespace osu.Game.Tests.Visual.Online
{
Username = @"flyte",
Id = 3103765,
Rank = new APIUser.GlobalRank
{
Rank = null,
},
Team = new APITeam
{
Id = 2,
Name = "mom?",
ShortName = "MOM",
FlagUrl = "https://assets.ppy.sh/teams/flag/1/b46fb10dbfd8a35dc50e6c00296c0dc6172dffc3ed3d3a4b379277ba498399fe.png",
},
CountryCode = CountryCode.JP,
CoverUrl = @"https://assets.ppy.sh/user-cover-presets/1/df28696b58541a9e67f6755918951d542d93bdf1da41720fcca2fd2c1ea8cf51.jpeg",
WasRecentlyOnline = true
@@ -64,6 +75,17 @@ namespace osu.Game.Tests.Visual.Online
{
Username = @"peppy",
Id = 2,
Rank = new APIUser.GlobalRank
{
Rank = 9999999,
},
Team = new APITeam
{
Id = 2,
Name = "mom?",
ShortName = "MOM",
FlagUrl = "https://assets.ppy.sh/teams/flag/1/b46fb10dbfd8a35dc50e6c00296c0dc6172dffc3ed3d3a4b379277ba498399fe.png",
},
CountryCode = CountryCode.AU,
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
IsSupporter = true,
@@ -72,7 +94,18 @@ namespace osu.Game.Tests.Visual.Online
new OnlineUserListPanel(new APIUser
{
Username = @"flyte",
Rank = new APIUser.GlobalRank
{
Rank = null,
},
Id = 3103765,
Team = new APITeam
{
Id = 2,
Name = "mom?",
ShortName = "MOM",
FlagUrl = "https://assets.ppy.sh/teams/flag/1/b46fb10dbfd8a35dc50e6c00296c0dc6172dffc3ed3d3a4b379277ba498399fe.png",
},
CountryCode = CountryCode.JP,
CoverUrl = @"https://assets.ppy.sh/user-cover-presets/1/df28696b58541a9e67f6755918951d542d93bdf1da41720fcca2fd2c1ea8cf51.jpeg",
WasRecentlyOnline = true
@@ -81,6 +114,17 @@ namespace osu.Game.Tests.Visual.Online
{
Username = @"peppy",
Id = 2,
Rank = new APIUser.GlobalRank
{
Rank = 9999999,
},
Team = new APITeam
{
Id = 2,
Name = "mom?",
ShortName = "MOM",
FlagUrl = "https://assets.ppy.sh/teams/flag/1/b46fb10dbfd8a35dc50e6c00296c0dc6172dffc3ed3d3a4b379277ba498399fe.png",
},
CountryCode = CountryCode.AU,
CoverUrl = @"https://assets.ppy.sh/user-profile-covers/8195163/4a8e2ad5a02a2642b631438cfa6c6bd7e2f9db289be881cb27df18331f64144c.jpeg",
LastVisit = DateTimeOffset.Now
+3 -1
View File
@@ -113,11 +113,13 @@ namespace osu.Game.Users
message.Anchor = Anchor.CentreLeft;
message.Origin = Anchor.CentreLeft;
message.Margin = new MarginPadding { Left = margin };
})
}),
}
}
};
// TODO: add rank somewhere (needs design consideration).
if (User.IsSupporter)
{
details.Add(new SupporterIcon
+17 -6
View File
@@ -2,15 +2,15 @@
// See the LICENCE file in the repository root for full licence text.
using System.Diagnostics;
using osu.Framework.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics.Colour;
using osu.Framework.Extensions.Color4Extensions;
using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Game.Online.API.Requests.Responses;
using osuTK;
using osu.Game.Overlays.Profile.Header.Components;
using osuTK;
using osuTK.Graphics;
namespace osu.Game.Users
{
@@ -51,7 +51,7 @@ namespace osu.Game.Users
AutoSizeAxes = Axes.Both,
Direction = FillDirection.Horizontal,
Spacing = new Vector2(10, 0),
Children = new Drawable[]
Children = new[]
{
CreateAvatar().With(avatar =>
{
@@ -64,12 +64,23 @@ namespace osu.Game.Users
flag.Anchor = Anchor.CentreLeft;
flag.Origin = Anchor.CentreLeft;
}),
CreateTeamLogo().With(flag =>
{
flag.Anchor = Anchor.CentreLeft;
flag.Origin = Anchor.CentreLeft;
}),
CreateUsername().With(username =>
{
username.Anchor = Anchor.CentreLeft;
username.Origin = Anchor.CentreLeft;
username.UseFullGlyphHeight = false;
})
}),
CreateRank().With(rank =>
{
rank.Anchor = Anchor.CentreLeft;
rank.Origin = Anchor.CentreLeft;
rank.UseFullGlyphHeight = false;
}),
}
},
new FillFlowContainer
+11
View File
@@ -5,6 +5,7 @@ using System;
using System.Collections.Generic;
using System.Linq;
using osu.Framework.Allocation;
using osu.Framework.Extensions.LocalisationExtensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes;
@@ -133,6 +134,16 @@ namespace osu.Game.Users
Text = User.Username,
};
protected OsuSpriteText CreateRank() => new OsuSpriteText
{
Font = OsuFont.GetFont(size: 16, weight: FontWeight.SemiBold),
Shadow = false,
// We can't colour the properly because we don't have the required percentile data.
Colour = Colours.BlueLighter,
Text = User.Rank?.Rank?.ToLocalisableString("\\##,##0") ?? string.Empty,
};
protected UpdateableAvatar CreateAvatar() => new UpdateableAvatar(User, false);
protected UpdateableFlag CreateFlag() => new UpdateableFlag(User.CountryCode)