From da99161736610b1dba44962f8e03bd87a7efd462 Mon Sep 17 00:00:00 2001 From: jorolf Date: Sat, 22 Dec 2018 22:31:11 +0100 Subject: [PATCH] add some missing stuff --- osu.Game/Graphics/UserInterface/LineGraph.cs | 1 - .../Overlays/Profile/Header/SupporterIcon.cs | 1 - osu.Game/Overlays/Profile/ProfileHeader.cs | 44 ++++++++++++++++--- 3 files changed, 38 insertions(+), 8 deletions(-) diff --git a/osu.Game/Graphics/UserInterface/LineGraph.cs b/osu.Game/Graphics/UserInterface/LineGraph.cs index c750f7a89d..4948c0d7f4 100644 --- a/osu.Game/Graphics/UserInterface/LineGraph.cs +++ b/osu.Game/Graphics/UserInterface/LineGraph.cs @@ -111,7 +111,6 @@ namespace osu.Game.Graphics.UserInterface { float x = (i + count - values.Length) / (float)(count - 1) * DrawWidth - 1; float y = GetYPosition(values[i]) * DrawHeight - path.PathWidth; - // the -1 is for inner offset in path (actually -PathWidth) path.AddVertex(new Vector2(x, y)); } } diff --git a/osu.Game/Overlays/Profile/Header/SupporterIcon.cs b/osu.Game/Overlays/Profile/Header/SupporterIcon.cs index 8b33a60d37..03135824de 100644 --- a/osu.Game/Overlays/Profile/Header/SupporterIcon.cs +++ b/osu.Game/Overlays/Profile/Header/SupporterIcon.cs @@ -7,7 +7,6 @@ using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics; -using osuTK; namespace osu.Game.Overlays.Profile.Header { diff --git a/osu.Game/Overlays/Profile/ProfileHeader.cs b/osu.Game/Overlays/Profile/ProfileHeader.cs index 6ab178cfe1..1a51ab4cb6 100644 --- a/osu.Game/Overlays/Profile/ProfileHeader.cs +++ b/osu.Game/Overlays/Profile/ProfileHeader.cs @@ -3,6 +3,7 @@ using System; using System.Collections.Generic; +using System.Linq; using osu.Framework.Allocation; using osu.Framework.Configuration; using osu.Framework.Extensions; @@ -39,6 +40,7 @@ namespace osu.Game.Overlays.Profile private readonly Box headerTopBox; private readonly UpdateableAvatar avatar; private readonly OsuSpriteText usernameText; + private readonly ExternalLinkButton openUserExternally; private readonly OsuSpriteText titleText; private readonly DrawableFlag userFlag; private readonly OsuSpriteText userCountryText; @@ -76,6 +78,13 @@ namespace osu.Game.Overlays.Profile private const float cover_height = 150; private const float cover_info_height = 75; private const float avatar_size = 110; + private static readonly Dictionary play_styles = new Dictionary + { + {"keyboard", "Keyboard"}, + {"mouse", "Mouse"}, + {"tablet", "Tablet"}, + {"touch", "Touch Screen"}, + }; [Resolved(CanBeNull = true)] private ChannelManager channelManager { get; set; } @@ -195,10 +204,24 @@ namespace osu.Game.Overlays.Profile Padding = new MarginPadding { Left = 10 }, Children = new Drawable[] { - usernameText = new OsuSpriteText + new FillFlowContainer { - Font = "Exo2.0-Regular", - TextSize = 24 + AutoSizeAxes = Axes.Both, + Direction = FillDirection.Horizontal, + Children = new Drawable[] + { + usernameText = new OsuSpriteText + { + Font = "Exo2.0-Regular", + TextSize = 24 + }, + openUserExternally = new ExternalLinkButton + { + Margin = new MarginPadding { Left = 5 }, + Anchor = Anchor.CentreLeft, + Origin = Anchor.CentreLeft, + }, + } }, new FillFlowContainer { @@ -694,6 +717,7 @@ namespace osu.Game.Overlays.Profile avatar.User = User; usernameText.Text = user.Username; + openUserExternally.Link = $@"https://osu.ppy.sh/users/{user.Id}"; userFlag.Country = user.Country; userCountryText.Text = user.Country?.FullName; SupporterTag.SupporterLevel = user.SupportLevel; @@ -796,16 +820,24 @@ namespace osu.Game.Overlays.Profile addSpacer(bottomTopLinkContainer); + if (user.PlayStyle?.Length > 0) + { + bottomTopLinkContainer.AddText("Plays with "); + bottomTopLinkContainer.AddText(string.Join(", ", user.PlayStyle.Select(style => play_styles[style])), bold); + + addSpacer(bottomTopLinkContainer); + } + if (user.LastVisit.HasValue) { bottomTopLinkContainer.AddText("Last seen "); bottomTopLinkContainer.AddText(new DrawableDate(user.LastVisit.Value), bold); + + addSpacer(bottomTopLinkContainer); } - addSpacer(bottomTopLinkContainer); - bottomTopLinkContainer.AddText("Contributed "); - bottomTopLinkContainer.AddLink($@"{user.PostCount} forum posts", $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: bold); + bottomTopLinkContainer.AddLink($@"{user.PostCount:#,##0} forum posts", $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: bold); void tryAddInfo(FontAwesome icon, string content, string link = null) {