mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 06:36:31 +09:00
Use a better method of link compilation
Adds word wrap back, simplifies a lot.
This commit is contained in:
@ -2,6 +2,7 @@
|
||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using OpenTK;
|
||||
using OpenTK.Graphics;
|
||||
using osu.Framework.Allocation;
|
||||
@ -9,6 +10,7 @@ using osu.Framework.Extensions.Color4Extensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
@ -16,7 +18,6 @@ using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Users;
|
||||
using osu.Framework.Graphics.Cursor;
|
||||
|
||||
namespace osu.Game.Overlays.Profile
|
||||
{
|
||||
@ -435,6 +436,28 @@ namespace osu.Game.Overlays.Profile
|
||||
infoTextRight.NewLine();
|
||||
}
|
||||
|
||||
private class ProfileLink : OsuHoverContainer, IHasTooltip
|
||||
{
|
||||
public string TooltipText => "View Profile in Browser";
|
||||
|
||||
public override bool HandleInput => true;
|
||||
|
||||
public ProfileLink(User user)
|
||||
{
|
||||
Action = () => Process.Start($@"https://osu.ppy.sh/users/{user.Id}");
|
||||
|
||||
AutoSizeAxes = Axes.Both;
|
||||
|
||||
Child = new OsuSpriteText
|
||||
{
|
||||
Text = user.Username,
|
||||
Font = @"Exo2.0-RegularItalic",
|
||||
TextSize = 30,
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private class GradeBadge : Container
|
||||
{
|
||||
private const float width = 50;
|
||||
@ -472,34 +495,5 @@ namespace osu.Game.Overlays.Profile
|
||||
badge.Texture = textures.Get($"Grades/{grade}");
|
||||
}
|
||||
}
|
||||
|
||||
private class LinkFlowContainer : OsuTextFlowContainer
|
||||
{
|
||||
public override bool HandleInput => true;
|
||||
|
||||
public LinkFlowContainer(Action<SpriteText> defaultCreationParameters = null)
|
||||
: base(defaultCreationParameters)
|
||||
{
|
||||
}
|
||||
|
||||
protected override SpriteText CreateSpriteText() => new OsuSpriteLink();
|
||||
|
||||
public void AddLink(string text, string url) => AddText(text, sprite => ((OsuSpriteLink)sprite).Url = url);
|
||||
}
|
||||
|
||||
private class ProfileLink : OsuSpriteLink, IHasTooltip
|
||||
{
|
||||
public string TooltipText => "View Profile in Browser";
|
||||
|
||||
public override bool HandleInput => true;
|
||||
|
||||
public ProfileLink(User user)
|
||||
{
|
||||
Text = user.Username;
|
||||
Url = $@"https://osu.ppy.sh/users/{user.Id}";
|
||||
Font = @"Exo2.0-RegularItalic";
|
||||
TextSize = 30;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user