Removed private OsuHoverContainer "content" from OsuLinkSpriteText for more customization.

This commit is contained in:
FreezyLemon 2017-12-11 11:28:16 +01:00
parent 4d475f1c1b
commit bb0a32b555
2 changed files with 14 additions and 15 deletions

View File

@ -13,18 +13,12 @@ namespace osu.Game.Graphics.Sprites
{ {
public class OsuLinkSpriteText : OsuSpriteText public class OsuLinkSpriteText : OsuSpriteText
{ {
private readonly OsuClickableContainer content;
public override bool HandleInput => content.Action != null;
protected override Container<Drawable> Content => content ?? (Container<Drawable>)this;
protected override IEnumerable<Drawable> FlowingChildren => Children; protected override IEnumerable<Drawable> FlowingChildren => Children;
protected override bool OnClick(InputState state) protected override bool OnClick(InputState state)
{ {
OnLinkClicked(); OnLinkClicked();
return true; return base.OnClick(state);
} }
private string url; private string url;
@ -42,14 +36,6 @@ namespace osu.Game.Graphics.Sprites
} }
} }
public OsuLinkSpriteText()
{
AddInternal(content = new OsuClickableContainer
{
AutoSizeAxes = Axes.Both,
});
}
public ColourInfo TextColour public ColourInfo TextColour
{ {
get { return Content.Colour; } get { return Content.Colour; }

View File

@ -17,6 +17,7 @@ using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Users; using osu.Game.Users;
using osu.Framework.Graphics.Cursor; using osu.Framework.Graphics.Cursor;
using osu.Framework.Input;
namespace osu.Game.Overlays.Profile namespace osu.Game.Overlays.Profile
{ {
@ -490,8 +491,20 @@ namespace osu.Game.Overlays.Profile
{ {
public string TooltipText => "View Profile in Browser"; public string TooltipText => "View Profile in Browser";
private readonly OsuHoverContainer content;
protected override Container<Drawable> Content => content ?? (Container<Drawable>)this;
public override bool HandleInput => true;
public ProfileLink(User user) public ProfileLink(User user)
{ {
AddInternal(content = new OsuHoverContainer
{
Action = OnLinkClicked,
AutoSizeAxes = Axes.Both,
});
Text = user.Username; Text = user.Username;
Url = $@"https://osu.ppy.sh/users/{user.Id}"; Url = $@"https://osu.ppy.sh/users/{user.Id}";
Font = @"Exo2.0-RegularItalic"; Font = @"Exo2.0-RegularItalic";