mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Add url clicking support to profile badges
This commit is contained in:
@ -1,22 +1,20 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Localisation;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Online;
|
||||
using osu.Game.Users;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Header.Components
|
||||
{
|
||||
[LongRunningLoad]
|
||||
public class DrawableBadge : CompositeDrawable, IHasTooltip
|
||||
public class DrawableBadge : OsuClickableContainer
|
||||
{
|
||||
public static readonly Vector2 DRAWABLE_BADGE_SIZE = new Vector2(86, 40);
|
||||
|
||||
@ -29,22 +27,25 @@ namespace osu.Game.Overlays.Profile.Header.Components
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(LargeTextureStore textures)
|
||||
private void load(LargeTextureStore textures, ILinkHandler? linkHandler)
|
||||
{
|
||||
InternalChild = new Sprite
|
||||
Child = new Sprite
|
||||
{
|
||||
FillMode = FillMode.Fit,
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Texture = textures.Get(badge.ImageUrl),
|
||||
};
|
||||
|
||||
if (!string.IsNullOrEmpty(badge.Url))
|
||||
Action = () => linkHandler?.HandleLink(badge.Url);
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
InternalChild.FadeInFromZero(200);
|
||||
this.FadeInFromZero(200);
|
||||
}
|
||||
|
||||
public LocalisableString TooltipText => badge.Description;
|
||||
public override LocalisableString TooltipText => badge.Description;
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user