2020-03-06 21:12:02 +00: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.
|
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2020-03-06 21:12:02 +00:00
|
|
|
|
using System;
|
|
|
|
|
using osu.Framework.Graphics.Sprites;
|
2021-10-30 16:50:13 +00:00
|
|
|
|
using osu.Framework.Localisation;
|
2020-03-06 21:12:02 +00:00
|
|
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
|
using osu.Game.Graphics.UserInterface;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Online.Placeholders
|
|
|
|
|
{
|
|
|
|
|
public partial class ClickablePlaceholder : Placeholder
|
|
|
|
|
{
|
|
|
|
|
public Action Action;
|
|
|
|
|
|
2021-10-30 16:50:13 +00:00
|
|
|
|
public ClickablePlaceholder(LocalisableString actionMessage, IconUsage icon)
|
2020-03-06 21:12:02 +00:00
|
|
|
|
{
|
|
|
|
|
OsuTextFlowContainer textFlow;
|
|
|
|
|
|
|
|
|
|
AddArbitraryDrawable(new OsuAnimatedButton
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Framework.Graphics.Axes.Both,
|
|
|
|
|
Child = textFlow = new OsuTextFlowContainer(cp => cp.Font = cp.Font.With(size: TEXT_SIZE))
|
|
|
|
|
{
|
|
|
|
|
AutoSizeAxes = Framework.Graphics.Axes.Both,
|
|
|
|
|
Margin = new Framework.Graphics.MarginPadding(5)
|
|
|
|
|
},
|
|
|
|
|
Action = () => Action?.Invoke()
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
textFlow.AddIcon(icon, i =>
|
|
|
|
|
{
|
|
|
|
|
i.Padding = new Framework.Graphics.MarginPadding { Right = 10 };
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
textFlow.AddText(actionMessage);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|