diff --git a/osu.Game.Tests/Visual/Online/TestSceneOnlineUserPanel.cs b/osu.Game.Tests/Visual/Online/TestSceneOnlineUserPanel.cs index 4d81443f29..b1e5ef95db 100644 --- a/osu.Game.Tests/Visual/Online/TestSceneOnlineUserPanel.cs +++ b/osu.Game.Tests/Visual/Online/TestSceneOnlineUserPanel.cs @@ -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 diff --git a/osu.Game/Users/UserGridPanel.cs b/osu.Game/Users/UserGridPanel.cs index f62c9ab4e7..a2a03f4f26 100644 --- a/osu.Game/Users/UserGridPanel.cs +++ b/osu.Game/Users/UserGridPanel.cs @@ -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 diff --git a/osu.Game/Users/UserListPanel.cs b/osu.Game/Users/UserListPanel.cs index 77ff13f260..51a1b42d5e 100644 --- a/osu.Game/Users/UserListPanel.cs +++ b/osu.Game/Users/UserListPanel.cs @@ -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 diff --git a/osu.Game/Users/UserPanel.cs b/osu.Game/Users/UserPanel.cs index 8a98fac159..c5988870dd 100644 --- a/osu.Game/Users/UserPanel.cs +++ b/osu.Game/Users/UserPanel.cs @@ -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)