mirror of
https://github.com/ppy/osu
synced 2024-12-16 11:56:31 +00:00
Rename link class, add hover colour
This commit is contained in:
parent
ae58e18178
commit
4229f933fe
@ -494,21 +494,41 @@ namespace osu.Game.Overlays.Profile
|
||||
{
|
||||
}
|
||||
|
||||
protected override SpriteText CreateSpriteText() => new SpriteLink();
|
||||
protected override SpriteText CreateSpriteText() => new LinkText();
|
||||
|
||||
public void AddLink(string text, string url) => AddText(text, link => ((SpriteLink)link).Url = url);
|
||||
public void AddLink(string text, string url) => AddText(text, link => ((LinkText)link).Url = url);
|
||||
|
||||
private class SpriteLink : OsuSpriteText
|
||||
private class LinkText : OsuSpriteText
|
||||
{
|
||||
public override bool HandleInput => Url != null;
|
||||
|
||||
public string Url;
|
||||
|
||||
private Color4 hoverColour;
|
||||
|
||||
protected override bool OnHover(InputState state)
|
||||
{
|
||||
FadeColour(hoverColour, 500, EasingTypes.OutQuint);
|
||||
return base.OnHover(state);
|
||||
}
|
||||
|
||||
protected override void OnHoverLost(InputState state)
|
||||
{
|
||||
FadeColour(Color4.White, 500, EasingTypes.OutQuint);
|
||||
base.OnHoverLost(state);
|
||||
}
|
||||
|
||||
protected override bool OnClick(InputState state)
|
||||
{
|
||||
Process.Start(Url);
|
||||
return true;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
{
|
||||
hoverColour = colours.Yellow;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user