2021-04-27 15:15:19 +08:00
|
|
|
// 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.
|
|
|
|
|
|
|
|
using Markdig.Syntax.Inlines;
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics.Containers.Markdown;
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2021-05-02 23:41:11 +08:00
|
|
|
using osu.Framework.Input.Events;
|
2021-04-27 15:15:19 +08:00
|
|
|
using osu.Game.Overlays;
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.Containers.Markdown
|
|
|
|
{
|
|
|
|
public class OsuMarkdownLinkText : MarkdownLinkText
|
|
|
|
{
|
2021-05-02 23:41:11 +08:00
|
|
|
[Resolved]
|
|
|
|
private OverlayColourProvider colourProvider { get; set; }
|
|
|
|
|
2021-04-27 15:15:19 +08:00
|
|
|
private SpriteText spriteText;
|
|
|
|
|
|
|
|
public OsuMarkdownLinkText(string text, LinkInline linkInline)
|
|
|
|
: base(text, linkInline)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2021-05-02 23:41:11 +08:00
|
|
|
private void load()
|
2021-04-27 15:15:19 +08:00
|
|
|
{
|
|
|
|
spriteText.Colour = colourProvider.Light2;
|
|
|
|
}
|
|
|
|
|
|
|
|
public override SpriteText CreateSpriteText()
|
|
|
|
{
|
|
|
|
return spriteText = base.CreateSpriteText();
|
|
|
|
}
|
2021-05-02 23:41:11 +08:00
|
|
|
|
|
|
|
protected override bool OnHover(HoverEvent e)
|
|
|
|
{
|
|
|
|
spriteText.Colour = colourProvider.Light1;
|
|
|
|
return base.OnHover(e);
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void OnHoverLost(HoverLostEvent e)
|
|
|
|
{
|
|
|
|
spriteText.Colour = colourProvider.Light2;
|
|
|
|
base.OnHoverLost(e);
|
|
|
|
}
|
2021-04-27 15:15:19 +08:00
|
|
|
}
|
|
|
|
}
|