mirror of
https://github.com/ppy/osu.git
synced 2026-05-20 01:19:52 +08:00
64 lines
1.9 KiB
C#
64 lines
1.9 KiB
C#
using osu.Framework.Graphics;
|
|
using osu.Framework.Graphics.Containers;
|
|
using osu.Game.Graphics.Containers;
|
|
|
|
namespace Symcol.Rulesets.Core.Wiki
|
|
{
|
|
public class WikiParagraph : Container
|
|
{
|
|
public WikiParagraph(string text, float textsize = 20)
|
|
{
|
|
paragraphNoMarkdown(text, textsize);
|
|
}
|
|
|
|
public WikiParagraph(string text, bool markdown)
|
|
{
|
|
if (!markdown)
|
|
paragraphNoMarkdown(text, 20);
|
|
else
|
|
paragraphMarkdown(text, 20);
|
|
}
|
|
public WikiParagraph(string text, float textsize, bool markdown)
|
|
{
|
|
if (!markdown)
|
|
paragraphNoMarkdown(text, textsize);
|
|
else
|
|
paragraphMarkdown(text, textsize);
|
|
}
|
|
|
|
private void paragraphNoMarkdown(string text, float textsize)
|
|
{
|
|
Anchor = Anchor.TopCentre;
|
|
Origin = Anchor.TopCentre;
|
|
AutoSizeAxes = Axes.Y;
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
Child = new OsuTextFlowContainer(t => { t.TextSize = textsize; })
|
|
{
|
|
Anchor = Anchor.TopCentre,
|
|
Origin = Anchor.TopCentre,
|
|
RelativeSizeAxes = Axes.X,
|
|
AutoSizeAxes = Axes.Y,
|
|
Text = text
|
|
};
|
|
}
|
|
|
|
private void paragraphMarkdown(string text, float textsize)
|
|
{
|
|
Anchor = Anchor.TopCentre;
|
|
Origin = Anchor.TopCentre;
|
|
AutoSizeAxes = Axes.Y;
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
Child = new OsuTextFlowContainer(t => { t.TextSize = textsize; })
|
|
{
|
|
Anchor = Anchor.TopCentre,
|
|
Origin = Anchor.TopCentre,
|
|
RelativeSizeAxes = Axes.X,
|
|
AutoSizeAxes = Axes.Y,
|
|
Text = text
|
|
};
|
|
}
|
|
}
|
|
}
|