1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 03:42:54 +08:00

add blurb

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-05-21 10:04:45 +07:00
parent 5964ee23cb
commit 216b87691c
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -3,15 +3,56 @@
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using System.Linq;
using HtmlAgilityPack;
using osu.Framework.Allocation;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
namespace osu.Game.Overlays.Wiki
{
public class WikiMainPage : FillFlowContainer
{
public string Markdown;
public WikiMainPage()
{
RelativeSizeAxes = Axes.X;
AutoSizeAxes = Axes.Y;
}
[BackgroundDependencyLoader]
private void load()
{
var html = new HtmlDocument();
html.LoadHtml(Markdown);
Children = new Drawable[]
{
createBlurb(html)
};
}
private Container createBlurb(HtmlDocument html)
{
var blurbNode = html.DocumentNode.SelectNodes("//div[contains(@class, 'wiki-main-page__blurb')]").First();
return new Container
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Padding = new MarginPadding
{
Vertical = 30,
},
Child = new OsuSpriteText
{
Text = blurbNode.InnerText,
Font = OsuFont.GetFont(size: 12),
Anchor = Anchor.TopCentre,
Origin = Anchor.TopCentre,
}
};
}
}
}