mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 09:42:54 +08:00
change createPanels method to create grid content
This commit is contained in:
parent
8389d90f7e
commit
24fef221e3
@ -61,22 +61,48 @@ namespace osu.Game.Overlays.Wiki
|
||||
};
|
||||
}
|
||||
|
||||
private IEnumerable<Container> createPanels(HtmlDocument html)
|
||||
private IEnumerable<Drawable[]> createPanels(HtmlDocument html)
|
||||
{
|
||||
var panelsNode = html.DocumentNode.SelectNodes("//div[contains(@class, 'wiki-main-page-panel')]");
|
||||
var panelsNode = html.DocumentNode.SelectNodes("//div[contains(@class, 'wiki-main-page-panel')]").ToArray();
|
||||
|
||||
foreach (var panel in panelsNode)
|
||||
for (var i = 0; i < panelsNode.Length; i++)
|
||||
{
|
||||
var isFullWidth = panel.HasClass("wiki-main-page-panel--full");
|
||||
var isFullWidth = panelsNode[i].HasClass("wiki-main-page-panel--full");
|
||||
|
||||
yield return new WikiPanelContainer
|
||||
if (isFullWidth)
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Width = isFullWidth ? 1.0f : 0.5f,
|
||||
Text = panel.InnerText,
|
||||
IsFullWidth = isFullWidth,
|
||||
};
|
||||
yield return new Drawable[]
|
||||
{
|
||||
new WikiPanelContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Text = panelsNode[i].InnerText,
|
||||
IsFullWidth = true,
|
||||
Width = 2,
|
||||
},
|
||||
null,
|
||||
};
|
||||
}
|
||||
|
||||
if (i % 2 == 1)
|
||||
{
|
||||
yield return new Drawable[]
|
||||
{
|
||||
new WikiPanelContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Text = panelsNode[i].InnerText,
|
||||
},
|
||||
new WikiPanelContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.X,
|
||||
AutoSizeAxes = Axes.Y,
|
||||
Text = panelsNode[i + 1].InnerText,
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user