1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 20:22:55 +08:00

update design and make play styles an enum

This commit is contained in:
jorolf 2019-01-04 22:52:00 +01:00
parent e05fbd4136
commit a33a1458a5
2 changed files with 34 additions and 15 deletions

View File

@ -75,6 +75,7 @@ namespace osu.Game.Overlays.Profile
private readonly Box headerBottomBox; private readonly Box headerBottomBox;
private readonly LinkFlowContainer bottomTopLinkContainer; private readonly LinkFlowContainer bottomTopLinkContainer;
private readonly LinkFlowContainer bottomLinkContainer; private readonly LinkFlowContainer bottomLinkContainer;
private Color4 linkBlue;
private const float cover_height = 150; private const float cover_height = 150;
private const float cover_info_height = 75; private const float cover_info_height = 75;
@ -693,6 +694,7 @@ namespace osu.Game.Overlays.Profile
headerBottomBox.Colour = colours.CommunityUserGrayGreenDarker; headerBottomBox.Colour = colours.CommunityUserGrayGreenDarker;
communityUserGrayGreenLighter = colours.CommunityUserGrayGreenLighter; communityUserGrayGreenLighter = colours.CommunityUserGrayGreenLighter;
linkBlue = colours.BlueLight;
} }
private User user; private User user;
@ -827,10 +829,10 @@ namespace osu.Game.Overlays.Profile
addSpacer(bottomTopLinkContainer); addSpacer(bottomTopLinkContainer);
if (user.PlayStyle?.Length > 0) if (user.PlayStyles?.Length > 0)
{ {
bottomTopLinkContainer.AddText("Plays with "); bottomTopLinkContainer.AddText("Plays with ");
bottomTopLinkContainer.AddText(string.Join(", ", user.PlayStyle.Select(style => play_styles[style])), bold); bottomTopLinkContainer.AddText(string.Join(", ", user.PlayStyles.Select(style => style.GetDescription())), bold);
addSpacer(bottomTopLinkContainer); addSpacer(bottomTopLinkContainer);
} }
@ -857,7 +859,11 @@ namespace osu.Game.Overlays.Profile
}); });
if (link != null) if (link != null)
{ {
bottomLinkContainer.AddLink(" " + content, link, creationParameters: bold); bottomLinkContainer.AddLink(" " + content, link, creationParameters: text =>
{
bold(text);
text.Colour = linkBlue;
});
} }
else else
{ {
@ -888,8 +894,6 @@ namespace osu.Game.Overlays.Profile
private class UserStatsLine : Container private class UserStatsLine : Container
{ {
private readonly OsuSpriteText rightText;
public UserStatsLine(string left, string right) public UserStatsLine(string left, string right)
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
@ -902,22 +906,16 @@ namespace osu.Game.Overlays.Profile
Text = left, Text = left,
Font = "Exo2.0-Medium" Font = "Exo2.0-Medium"
}, },
rightText = new OsuSpriteText new OsuSpriteText
{ {
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
TextSize = 15, TextSize = 15,
Text = right, Text = right,
Font = "Exo2.0-Medium" Font = "Exo2.0-Bold"
}, },
}; };
} }
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
rightText.Colour = colours.BlueLight;
}
} }
private class ProfileHeaderButton : OsuHoverContainer private class ProfileHeaderButton : OsuHoverContainer

View File

@ -2,7 +2,11 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE // Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System; using System;
using System.ComponentModel;
using System.Linq;
using System.Security.Cryptography;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using osu.Framework.Configuration; using osu.Framework.Configuration;
namespace osu.Game.Users namespace osu.Game.Users
@ -113,8 +117,13 @@ namespace osu.Game.Users
[JsonProperty(@"follower_count")] [JsonProperty(@"follower_count")]
public int[] FollowerCount; public int[] FollowerCount;
[JsonProperty(@"playstyle")] [JsonProperty]
public string[] PlayStyle; private string[] playstyle
{
set { PlayStyles = value?.Select(str => Enum.Parse(typeof(PlayStyle), str, true)).Cast<PlayStyle>().ToArray(); }
}
public PlayStyle[] PlayStyles;
[JsonProperty(@"playmode")] [JsonProperty(@"playmode")]
public string PlayMode; public string PlayMode;
@ -174,5 +183,17 @@ namespace osu.Game.Users
Username = "system", Username = "system",
Id = 0 Id = 0
}; };
public enum PlayStyle
{
[Description("Keyboard")]
Keyboard,
[Description("Mouse")]
Mouse,
[Description("Tablet")]
Tablet,
[Description("Touch Screen")]
Touch,
}
} }
} }