This commit is contained in:
jorolf
2018-12-22 16:51:24 +01:00
parent a54951b72d
commit b4fa2d9049
11 changed files with 981 additions and 269 deletions

View File

@ -7,7 +7,6 @@ using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osuTK;
namespace osu.Game.Overlays.Profile.Header
@ -15,50 +14,73 @@ namespace osu.Game.Overlays.Profile.Header
public class SupporterIcon : CircularContainer, IHasTooltip
{
private readonly Box background;
private readonly FillFlowContainer iconContainer;
public string TooltipText => "osu!supporter";
public int SupporterLevel
{
set
{
if (value == 0)
{
Hide();
}
else
{
Show();
iconContainer.Clear();
for (int i = 0; i < value; i++)
{
iconContainer.Add(new SpriteIcon
{
Width = 12,
RelativeSizeAxes = Axes.Y,
Icon = FontAwesome.fa_heart,
});
}
}
}
}
public SupporterIcon()
{
Masking = true;
AutoSizeAxes = Axes.X;
Hide();
Children = new Drawable[]
{
new Box { RelativeSizeAxes = Axes.Both },
new CircularContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Scale = new Vector2(0.8f),
Masking = true,
Children = new Drawable[]
{
background = new Box { RelativeSizeAxes = Axes.Both },
new Triangles
{
TriangleScale = 0.2f,
ColourLight = OsuColour.FromHex(@"ff7db7"),
ColourDark = OsuColour.FromHex(@"de5b95"),
RelativeSizeAxes = Axes.Both,
Velocity = 0.3f,
},
}
},
new SpriteIcon
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Icon = FontAwesome.fa_heart,
Scale = new Vector2(0.45f),
}
background = new Box { RelativeSizeAxes = Axes.Both },
iconContainer = new FillFlowContainer
{
Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
Height = 0.6f,
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
};
}
public override bool Invalidate(Invalidation invalidation = Invalidation.All, Drawable source = null, bool shallPropagate = true)
{
bool invalid = base.Invalidate(invalidation, source, shallPropagate);
if ((invalidation & Invalidation.DrawSize) != 0)
{
iconContainer.Padding = new MarginPadding { Horizontal = DrawHeight / 2 };
}
return invalid;
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
background.Colour = colours.Pink;
iconContainer.Colour = colours.CommunityUserGrayGreenDark;
}
}
}

File diff suppressed because it is too large Load Diff

View File

@ -31,7 +31,7 @@ namespace osu.Game.Overlays
private SectionsContainer<ProfileSection> sectionsContainer;
private ProfileTabControl tabs;
public const float CONTENT_X_MARGIN = 50;
public const float CONTENT_X_MARGIN = 70;
public UserProfileOverlay()
{
@ -113,12 +113,10 @@ namespace osu.Game.Overlays
Colour = OsuColour.Gray(0.2f)
});
Header = new ProfileHeader(user);
Add(sectionsContainer = new SectionsContainer<ProfileSection>
{
RelativeSizeAxes = Axes.Both,
ExpandableHeader = Header,
ExpandableHeader = Header = new ProfileHeader(),
FixedHeader = tabs,
HeaderBackground = new Box
{