1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-13 10:03:05 +08:00

Merge pull request #15664 from Joehuu/supporter-icon-link

Link osu!supporter icon to its web page
This commit is contained in:
Dean Herbert 2021-11-18 14:02:15 +09:00 committed by GitHub
commit e344e74352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,22 +5,23 @@ using System;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Input.Events;
using osu.Framework.Localisation;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Resources.Localisation.Web;
namespace osu.Game.Overlays.Profile.Header.Components
{
public class SupporterIcon : CompositeDrawable, IHasTooltip
public class SupporterIcon : OsuClickableContainer
{
private readonly Box background;
private readonly FillFlowContainer iconContainer;
private readonly CircularContainer content;
public LocalisableString TooltipText => UsersStrings.ShowIsSupporter;
public override LocalisableString TooltipText => UsersStrings.ShowIsSupporter;
public int SupportLevel
{
@ -56,7 +57,7 @@ namespace osu.Game.Overlays.Profile.Header.Components
{
AutoSizeAxes = Axes.X;
InternalChild = content = new CircularContainer
Child = content = new CircularContainer
{
RelativeSizeAxes = Axes.Y,
AutoSizeAxes = Axes.X,
@ -78,10 +79,27 @@ namespace osu.Game.Overlays.Profile.Header.Components
};
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
[Resolved]
private OsuColour colours { get; set; }
[BackgroundDependencyLoader(true)]
private void load(OsuGame game)
{
background.Colour = colours.Pink;
Action = () => game?.OpenUrlExternally(@"/home/support");
}
protected override bool OnHover(HoverEvent e)
{
background.FadeColour(colours.PinkLight, 500, Easing.OutQuint);
return base.OnHover(e);
}
protected override void OnHoverLost(HoverLostEvent e)
{
background.FadeColour(colours.Pink, 500, Easing.OutQuint);
base.OnHoverLost(e);
}
}
}