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.Users;
namespace osu.Game.Tests.Visual
namespace osu.Game.Tests.Visual.Online
{
public class TestCaseUserProfileHeader : OsuTestCase
{
@ -24,7 +24,7 @@ public class TestCaseUserProfileHeader : OsuTestCase
};
[Resolved]
private APIAccess api { get; set; }
private IAPIProvider api { get; set; }
private readonly ProfileHeader header;

View File

@ -14,6 +14,8 @@ public abstract class ScreenTitle : CompositeDrawable, IHasAccentColour
{
private readonly SpriteIcon iconSprite;
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
{
@ -48,12 +50,12 @@ protected ScreenTitle()
new FillFlowContainer
{
AutoSizeAxes = Axes.Both,
Spacing = new Vector2(10, 0),
Spacing = new Vector2(icon_spacing, 0),
Children = new Drawable[]
{
iconSprite = new SpriteIcon
{
Size = new Vector2(25),
Size = new Vector2(icon_size),
},
new FillFlowContainer
{

View File

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

View File

@ -77,7 +77,7 @@ private void load(OsuColour colours, TextureStore textures)
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Icon = FontAwesome.fa_user,
Icon = FontAwesome.Solid.User,
FillMode = FillMode.Fit,
Size = new Vector2(50, 14)
},
@ -116,7 +116,7 @@ private void load(OsuColour colours, TextureStore textures)
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
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 = () =>
{
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;
expandedDetailContainer.Alpha = detailsVisible ? 0 : 1;
DetailsVisibilityAction(detailsVisible);

View File

@ -4,7 +4,7 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics;
using osu.Game.Graphics;
using osu.Framework.Graphics.Sprites;
using osu.Game.Online.API;
using osu.Game.Online.Chat;
using osu.Game.Users;
@ -26,7 +26,7 @@ public class ProfileMessageButton : ProfileHeaderButton
private ChatOverlay chatOverlay { get; set; }
[Resolved]
private APIAccess apiAccess { get; set; }
private IAPIProvider apiProvider { get; set; }
public ProfileMessageButton()
{
@ -37,7 +37,7 @@ public ProfileMessageButton()
{
Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft,
Icon = FontAwesome.fa_envelope,
Icon = FontAwesome.Solid.Envelope,
FillMode = FillMode.Fit,
Size = new Vector2(50, 14)
};
@ -51,7 +51,7 @@ public ProfileMessageButton()
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,
RelativeSizeAxes = Axes.Y,
Icon = FontAwesome.fa_heart,
Icon = FontAwesome.Solid.Heart,
});
}
@ -66,8 +66,7 @@ public SupporterIcon()
AutoSizeAxes = Axes.X,
Height = 0.6f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Icon = FontAwesome.Solid.Heart,
Origin = Anchor.Centre
}
}
};

View File

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

View File

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

View File

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