mirror of
https://github.com/osukey/osukey.git
synced 2025-05-09 23:57:18 +09:00
Add method to add arbitrary drawables as links
This commit is contained in:
parent
deaf4ab4a1
commit
f8d25a1b6c
@ -7,6 +7,7 @@ using System.Linq;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Logging;
|
using osu.Framework.Logging;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osu.Game.Overlays.Notifications;
|
using osu.Game.Overlays.Notifications;
|
||||||
@ -61,8 +62,19 @@ namespace osu.Game.Graphics.Containers
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void AddLink(string text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null, Action<SpriteText> creationParameters = null)
|
public void AddLink(string text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null, Action<SpriteText> creationParameters = null)
|
||||||
|
=> createLink(AddText(text, creationParameters), text, url, linkType, linkArgument, tooltipText);
|
||||||
|
|
||||||
|
public void AddLink(IEnumerable<SpriteText> text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null)
|
||||||
{
|
{
|
||||||
AddInternal(new DrawableLinkCompiler(AddText(text, creationParameters).OfType<SpriteText>().ToList())
|
foreach (var t in text)
|
||||||
|
AddArbitraryDrawable(t);
|
||||||
|
|
||||||
|
createLink(text, null, url, linkType, linkArgument, tooltipText);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createLink(IEnumerable<Drawable> drawables, string text, string url, LinkAction linkType = LinkAction.External, string linkArgument = null, string tooltipText = null)
|
||||||
|
{
|
||||||
|
AddInternal(new DrawableLinkCompiler(drawables.OfType<SpriteText>().ToList())
|
||||||
{
|
{
|
||||||
TooltipText = tooltipText ?? (url != text ? url : string.Empty),
|
TooltipText = tooltipText ?? (url != text ? url : string.Empty),
|
||||||
Action = () =>
|
Action = () =>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user