1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 07:22:55 +08:00

Move text and isFullWidth parameters to constructor

This commit is contained in:
Dean Herbert 2021-05-27 14:04:50 +09:00
parent a7865d3f22
commit d66f07fccb
2 changed files with 16 additions and 20 deletions

View File

@ -77,10 +77,8 @@ namespace osu.Game.Overlays.Wiki
{ {
yield return new Drawable[] yield return new Drawable[]
{ {
new WikiPanelContainer new WikiPanelContainer(panelsNode[i].InnerText, true)
{ {
Text = panelsNode[i].InnerText,
IsFullWidth = true,
Width = 2, Width = 2,
}, },
null, null,
@ -91,14 +89,8 @@ namespace osu.Game.Overlays.Wiki
{ {
yield return new Drawable[] yield return new Drawable[]
{ {
new WikiPanelContainer new WikiPanelContainer(panelsNode[i].InnerText),
{ new WikiPanelContainer(panelsNode[i + 1].InnerText),
Text = panelsNode[i].InnerText,
},
new WikiPanelContainer
{
Text = panelsNode[i + 1].InnerText,
},
}; };
} }
} }

View File

@ -23,12 +23,15 @@ namespace osu.Game.Overlays.Wiki
{ {
private WikiPanelMarkdownContainer panelContainer; private WikiPanelMarkdownContainer panelContainer;
public string Text; private readonly string text;
public bool IsFullWidth; private readonly bool isFullWidth;
public WikiPanelContainer() public WikiPanelContainer(string text, bool isFullWidth = false)
{ {
this.text = text;
this.isFullWidth = isFullWidth;
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Padding = new MarginPadding(3); Padding = new MarginPadding(3);
} }
@ -56,12 +59,11 @@ namespace osu.Game.Overlays.Wiki
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
}, },
}, },
panelContainer = new WikiPanelMarkdownContainer panelContainer = new WikiPanelMarkdownContainer(isFullWidth)
{ {
Text = Text, Text = text,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
IsFullWidth = IsFullWidth,
} }
}; };
} }
@ -74,10 +76,12 @@ namespace osu.Game.Overlays.Wiki
private class WikiPanelMarkdownContainer : WikiMarkdownContainer private class WikiPanelMarkdownContainer : WikiMarkdownContainer
{ {
public bool IsFullWidth; private readonly bool isFullWidth;
public WikiPanelMarkdownContainer() public WikiPanelMarkdownContainer(bool isFullWidth)
{ {
this.isFullWidth = isFullWidth;
LineSpacing = 0; LineSpacing = 0;
DocumentPadding = new MarginPadding(30); DocumentPadding = new MarginPadding(30);
DocumentMargin = new MarginPadding(0); DocumentMargin = new MarginPadding(0);
@ -92,7 +96,7 @@ namespace osu.Game.Overlays.Wiki
protected override MarkdownHeading CreateHeading(HeadingBlock headingBlock) => new WikiPanelHeading(headingBlock) protected override MarkdownHeading CreateHeading(HeadingBlock headingBlock) => new WikiPanelHeading(headingBlock)
{ {
IsFullWidth = IsFullWidth, IsFullWidth = isFullWidth,
}; };
} }