1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 09:27:29 +08:00

Merge pull request #2422 from tgi74/profile_web_changes

Update profile header to match osu-web changes
This commit is contained in:
Dean Herbert 2018-04-20 14:00:34 +09:00 committed by GitHub
commit 6d3533b777
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 6 deletions

View File

@ -61,9 +61,9 @@ namespace osu.Game.Graphics.Containers
AddText(text.Substring(previousLinkEnd)); AddText(text.Substring(previousLinkEnd));
} }
public void AddLink(string text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null) public void AddLink(string text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null, Action<SpriteText> creationParameters = null)
{ {
AddInternal(new DrawableLinkCompiler(AddText(text).ToList()) AddInternal(new DrawableLinkCompiler(AddText(text, creationParameters).ToList())
{ {
TooltipText = tooltipText ?? (url != text ? url : string.Empty), TooltipText = tooltipText ?? (url != text ? url : string.Empty),
Action = () => Action = () =>

View File

@ -24,7 +24,7 @@ namespace osu.Game.Overlays.Profile
{ {
public class ProfileHeader : Container public class ProfileHeader : Container
{ {
private readonly OsuTextFlowContainer infoTextLeft; private readonly LinkFlowContainer infoTextLeft;
private readonly LinkFlowContainer infoTextRight; private readonly LinkFlowContainer infoTextRight;
private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText; private readonly FillFlowContainer<SpriteText> scoreText, scoreNumberText;
private readonly RankGraph rankGraph; private readonly RankGraph rankGraph;
@ -141,7 +141,7 @@ namespace osu.Game.Overlays.Profile
} }
} }
}, },
infoTextLeft = new OsuTextFlowContainer(t => t.TextSize = 14) infoTextLeft = new LinkFlowContainer(t => t.TextSize = 14)
{ {
X = UserProfileOverlay.CONTENT_X_MARGIN, X = UserProfileOverlay.CONTENT_X_MARGIN,
Y = cover_height + 20, Y = cover_height + 20,
@ -350,7 +350,7 @@ namespace osu.Game.Overlays.Profile
if (user.Country != null) if (user.Country != null)
{ {
infoTextLeft.AddText("from ", lightText); infoTextLeft.AddText("From ", lightText);
infoTextLeft.AddText(user.Country.FullName, boldItalic); infoTextLeft.AddText(user.Country.FullName, boldItalic);
countryFlag.Country = user.Country; countryFlag.Country = user.Country;
} }
@ -378,6 +378,10 @@ namespace osu.Game.Overlays.Profile
infoTextLeft.AddText(string.Join(", ", user.PlayStyle), boldItalic); infoTextLeft.AddText(string.Join(", ", user.PlayStyle), boldItalic);
} }
infoTextLeft.NewLine();
infoTextLeft.AddText("Contributed ", lightText);
infoTextLeft.AddLink($@"{user.PostCount} forum posts", url: $"https://osu.ppy.sh/users/{user.Id}/posts", creationParameters: boldItalic);
string websiteWithoutProtcol = user.Website; string websiteWithoutProtcol = user.Website;
if (!string.IsNullOrEmpty(websiteWithoutProtcol)) if (!string.IsNullOrEmpty(websiteWithoutProtcol))
{ {
@ -392,8 +396,10 @@ namespace osu.Game.Overlays.Profile
infoTextRight.NewParagraph(); infoTextRight.NewParagraph();
if (!string.IsNullOrEmpty(user.Twitter)) if (!string.IsNullOrEmpty(user.Twitter))
tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}"); tryAddInfoRightLine(FontAwesome.fa_twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}");
tryAddInfoRightLine(FontAwesome.fa_globe, websiteWithoutProtcol, user.Website); tryAddInfoRightLine(FontAwesome.fa_gamepad, user.Discord);
tryAddInfoRightLine(FontAwesome.fa_skype, user.Skype, @"skype:" + user.Skype + @"?chat"); tryAddInfoRightLine(FontAwesome.fa_skype, user.Skype, @"skype:" + user.Skype + @"?chat");
tryAddInfoRightLine(FontAwesome.fa_lastfm, user.Lastfm, $@"https://last.fm/users/{user.Lastfm}");
tryAddInfoRightLine(FontAwesome.fa_globe, websiteWithoutProtcol, user.Website);
if (user.Statistics != null) if (user.Statistics != null)
{ {

View File

@ -98,9 +98,15 @@ namespace osu.Game.Users
[JsonProperty(@"skype")] [JsonProperty(@"skype")]
public string Skype; public string Skype;
[JsonProperty(@"discord")]
public string Discord;
[JsonProperty(@"website")] [JsonProperty(@"website")]
public string Website; public string Website;
[JsonProperty(@"post_count")]
public int PostCount;
[JsonProperty(@"playstyle")] [JsonProperty(@"playstyle")]
public string[] PlayStyle; public string[] PlayStyle;