1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 10:42:55 +08:00

Improve condition check

This commit is contained in:
TheWildTree 2020-01-30 20:51:33 +01:00
parent 1751e96840
commit 3970151e31

View File

@ -15,6 +15,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Users; using osu.Game.Users;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using static osu.Framework.Graphics.Containers.TextFlowContainer;
namespace osu.Game.Overlays.Profile.Header namespace osu.Game.Overlays.Profile.Header
{ {
@ -133,9 +134,12 @@ namespace osu.Game.Overlays.Profile.Header
tryAddInfo(FontAwesome.Brands.Lastfm, user.Lastfm, $@"https://last.fm/users/{user.Lastfm}"); tryAddInfo(FontAwesome.Brands.Lastfm, user.Lastfm, $@"https://last.fm/users/{user.Lastfm}");
tryAddInfo(FontAwesome.Solid.Link, websiteWithoutProtocol, user.Website); tryAddInfo(FontAwesome.Solid.Link, websiteWithoutProtocol, user.Website);
// Hide the container to prevent adding unnecessary padding if it has no children other than the NewLine // Hide the container to prevent adding unnecessary padding if it has no children other than the NewLineContainer
if (!bottomLinkContainer.Children.Skip(1).Any()) if (!bottomLinkContainer.Children.Any(child => !(child is NewLineContainer)))
bottomLinkContainer.Hide(); bottomLinkContainer.Hide();
else
// this is needed if user gets changed without the whole header being reloaded
bottomLinkContainer.Show();
} }
private void addSpacer(OsuTextFlowContainer textFlow) => textFlow.AddArbitraryDrawable(new Container { Width = 15 }); private void addSpacer(OsuTextFlowContainer textFlow) => textFlow.AddArbitraryDrawable(new Container { Width = 15 });