get everything working again

This commit is contained in:
jorolf 2019-04-04 00:24:42 +02:00
parent 5bc6042309
commit ccc804a9b2
10 changed files with 49 additions and 36 deletions

View File

@ -11,7 +11,7 @@
using osu.Game.Overlays.Profile.Header; using osu.Game.Overlays.Profile.Header;
using osu.Game.Users; using osu.Game.Users;
namespace osu.Game.Tests.Visual namespace osu.Game.Tests.Visual.Online
{ {
public class TestCaseUserProfileHeader : OsuTestCase public class TestCaseUserProfileHeader : OsuTestCase
{ {
@ -24,7 +24,7 @@ public class TestCaseUserProfileHeader : OsuTestCase
}; };
[Resolved] [Resolved]
private APIAccess api { get; set; } private IAPIProvider api { get; set; }
private readonly ProfileHeader header; private readonly ProfileHeader header;

View File

@ -14,6 +14,8 @@ public abstract class ScreenTitle : CompositeDrawable, IHasAccentColour
{ {
private readonly SpriteIcon iconSprite; private readonly SpriteIcon iconSprite;
private readonly OsuSpriteText titleText, pageText; private readonly OsuSpriteText titleText, pageText;
public const float ICON_WIDTH = icon_size + icon_spacing;
private const float icon_size = 25, icon_spacing = 10;
protected IconUsage Icon protected IconUsage Icon
{ {
@ -48,12 +50,12 @@ protected ScreenTitle()
new FillFlowContainer new FillFlowContainer
{ {
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
Spacing = new Vector2(10, 0), Spacing = new Vector2(icon_spacing, 0),
Children = new Drawable[] Children = new Drawable[]
{ {
iconSprite = new SpriteIcon iconSprite = new SpriteIcon
{ {
Size = new Vector2(25), Size = new Vector2(icon_size),
}, },
new FillFlowContainer new FillFlowContainer
{ {

View File

@ -107,7 +107,7 @@ private void updateDisplay(User user)
bottomTopLinkContainer.AddText("Contributed "); bottomTopLinkContainer.AddText("Contributed ");
bottomTopLinkContainer.AddLink($@"{user.PostCount:#,##0} 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) void tryAddInfo(IconUsage icon, string content, string link = null)
{ {
if (string.IsNullOrEmpty(content)) return; if (string.IsNullOrEmpty(content)) return;
@ -138,16 +138,16 @@ void tryAddInfo(FontAwesome icon, string content, string link = null)
websiteWithoutProtcol = websiteWithoutProtcol.Substring(protocolIndex + 2); websiteWithoutProtcol = websiteWithoutProtcol.Substring(protocolIndex + 2);
} }
tryAddInfo(FontAwesome.fa_map_marker, user.Location); tryAddInfo(FontAwesome.Solid.MapMarker, user.Location);
tryAddInfo(FontAwesome.fa_heart_o, user.Interests); tryAddInfo(OsuIcon.Heart, user.Interests);
tryAddInfo(FontAwesome.fa_suitcase, user.Occupation); tryAddInfo(FontAwesome.Solid.Suitcase, user.Occupation);
bottomLinkContainer.NewLine(); bottomLinkContainer.NewLine();
if (!string.IsNullOrEmpty(user.Twitter)) if (!string.IsNullOrEmpty(user.Twitter))
tryAddInfo(FontAwesome.fa_twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}"); tryAddInfo(FontAwesome.Brands.Twitter, "@" + user.Twitter, $@"https://twitter.com/{user.Twitter}");
tryAddInfo(FontAwesome.fa_gamepad, user.Discord); //todo: update fontawesome to include discord logo tryAddInfo(FontAwesome.Brands.Discord, user.Discord);
tryAddInfo(FontAwesome.fa_skype, user.Skype, @"skype:" + user.Skype + @"?chat"); tryAddInfo(FontAwesome.Brands.Skype, user.Skype, @"skype:" + user.Skype + @"?chat");
tryAddInfo(FontAwesome.fa_lastfm, user.Lastfm, $@"https://last.fm/users/{user.Lastfm}"); tryAddInfo(FontAwesome.Brands.Lastfm, user.Lastfm, $@"https://last.fm/users/{user.Lastfm}");
tryAddInfo(FontAwesome.fa_link, websiteWithoutProtcol, user.Website); tryAddInfo(FontAwesome.Solid.Link, websiteWithoutProtcol, user.Website);
} }
} }
} }

View File

@ -77,7 +77,7 @@ private void load(OsuColour colours, TextureStore textures)
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Icon = FontAwesome.fa_user, Icon = FontAwesome.Solid.User,
FillMode = FillMode.Fit, FillMode = FillMode.Fit,
Size = new Vector2(50, 14) Size = new Vector2(50, 14)
}, },
@ -116,7 +116,7 @@ private void load(OsuColour colours, TextureStore textures)
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Size = new Vector2(20), Size = new Vector2(20),
Icon = FontAwesome.fa_chevron_up, Icon = FontAwesome.Solid.ChevronUp,
}, },
} }
}, },
@ -212,7 +212,7 @@ private void load(OsuColour colours, TextureStore textures)
detailsToggleButton.Action = () => detailsToggleButton.Action = () =>
{ {
detailsVisible = !detailsVisible; detailsVisible = !detailsVisible;
expandButtonIcon.Icon = detailsVisible ? FontAwesome.fa_chevron_down : FontAwesome.fa_chevron_up; expandButtonIcon.Icon = detailsVisible ? FontAwesome.Solid.ChevronDown : FontAwesome.Solid.ChevronUp;
hiddenDetailContainer.Alpha = detailsVisible ? 1 : 0; hiddenDetailContainer.Alpha = detailsVisible ? 1 : 0;
expandedDetailContainer.Alpha = detailsVisible ? 0 : 1; expandedDetailContainer.Alpha = detailsVisible ? 0 : 1;
DetailsVisibilityAction(detailsVisible); DetailsVisibilityAction(detailsVisible);

View File

@ -4,7 +4,7 @@
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Graphics; using osu.Framework.Graphics.Sprites;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.Chat; using osu.Game.Online.Chat;
using osu.Game.Users; using osu.Game.Users;
@ -26,7 +26,7 @@ public class ProfileMessageButton : ProfileHeaderButton
private ChatOverlay chatOverlay { get; set; } private ChatOverlay chatOverlay { get; set; }
[Resolved] [Resolved]
private APIAccess apiAccess { get; set; } private IAPIProvider apiProvider { get; set; }
public ProfileMessageButton() public ProfileMessageButton()
{ {
@ -37,7 +37,7 @@ public ProfileMessageButton()
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Icon = FontAwesome.fa_envelope, Icon = FontAwesome.Solid.Envelope,
FillMode = FillMode.Fit, FillMode = FillMode.Fit,
Size = new Vector2(50, 14) Size = new Vector2(50, 14)
}; };
@ -51,7 +51,7 @@ public ProfileMessageButton()
chatOverlay?.Show(); chatOverlay?.Show();
}; };
User.ValueChanged += e => Content.Alpha = !e.NewValue.PMFriendsOnly && apiAccess.LocalUser.Value.Id != e.NewValue.Id ? 1 : 0; User.ValueChanged += e => Content.Alpha = !e.NewValue.PMFriendsOnly && apiProvider.LocalUser.Value.Id != e.NewValue.Id ? 1 : 0;
} }
} }
} }

View File

@ -37,7 +37,7 @@ public int SupporterLevel
{ {
Width = 12, Width = 12,
RelativeSizeAxes = Axes.Y, RelativeSizeAxes = Axes.Y,
Icon = FontAwesome.fa_heart, Icon = FontAwesome.Solid.Heart,
}); });
} }
@ -66,8 +66,7 @@ public SupporterIcon()
AutoSizeAxes = Axes.X, AutoSizeAxes = Axes.X,
Height = 0.6f, Height = 0.6f,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre
Icon = FontAwesome.Solid.Heart,
} }
} }
}; };

View File

@ -5,11 +5,11 @@
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Textures;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Overlays.Profile.Header; using osu.Game.Overlays.Profile.Header;
using osu.Game.Users; using osu.Game.Users;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
namespace osu.Game.Overlays.Profile namespace osu.Game.Overlays.Profile
@ -17,7 +17,6 @@ namespace osu.Game.Overlays.Profile
public class ProfileHeader : Container public class ProfileHeader : Container
{ {
private readonly UserCoverBackground coverContainer; private readonly UserCoverBackground coverContainer;
private readonly ScreenTitle coverTitle;
private readonly ProfileHeaderTabControl infoTabControl; private readonly ProfileHeaderTabControl infoTabControl;
private const float cover_height = 150; private const float cover_height = 150;
@ -52,10 +51,9 @@ public ProfileHeader()
Depth = -float.MaxValue, Depth = -float.MaxValue,
Children = new Drawable[] Children = new Drawable[]
{ {
coverTitle = new ScreenTitle new ProfileHeaderTitle
{ {
Title = "Player ", X = -ScreenTitle.ICON_WIDTH,
Page = "Info"
}, },
infoTabControl = new ProfileHeaderTabControl infoTabControl = new ProfileHeaderTabControl
{ {
@ -113,10 +111,8 @@ public ProfileHeader()
} }
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colours, TextureStore textures) private void load(OsuColour colours)
{ {
coverTitle.AccentColour = colours.CommunityUserGreen;
infoTabControl.AccentColour = colours.CommunityUserGreen; infoTabControl.AccentColour = colours.CommunityUserGreen;
} }
@ -131,5 +127,20 @@ public class HasTooltipContainer : Container, IHasTooltip
{ {
public string TooltipText { get; set; } public string TooltipText { get; set; }
} }
private class ProfileHeaderTitle : ScreenTitle
{
public ProfileHeaderTitle()
{
Title = "Player ";
Section = "Info";
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
AccentColour = colours.CommunityUserGreen;
}
}
} }
} }

View File

@ -42,7 +42,7 @@ public Header(ScreenStack stack)
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
X = -35, X = -ScreenTitle.ICON_WIDTH,
}, },
breadcrumbs = new HeaderBreadcrumbControl(stack) breadcrumbs = new HeaderBreadcrumbControl(stack)
{ {

View File

@ -36,15 +36,16 @@ protected override Drawable CreateDrawable(User user)
} }
else else
{ {
return new Sprite var sprite = new Sprite
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Texture = textures.Get(user.CoverUrl), Texture = textures.Get(user.CoverUrl),
FillMode = FillMode.Fill, FillMode = FillMode.Fill,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre
OnLoadComplete = d => d.FadeInFromZero(400),
}; };
sprite.OnLoadComplete += d => d.FadeInFromZero(400);
return sprite;
} }
} }
} }

View File

@ -76,7 +76,7 @@ private void load(OsuColour colours, UserProfileOverlay profile)
Children = new Drawable[] Children = new Drawable[]
{ {
new DelayedLoadWrapper(coverBackground = new UserCoverBackground(user) new DelayedLoadWrapper(coverBackground = new UserCoverBackground
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Anchor = Anchor.Centre, Anchor = Anchor.Centre,