1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 01:52:55 +08:00

directly using table of content entry in wiki table of contents

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-06-06 20:19:39 +07:00
parent 525c16419a
commit ed733ee648
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -15,9 +15,9 @@ namespace osu.Game.Overlays.Wiki
{ {
private readonly FillFlowContainer content; private readonly FillFlowContainer content;
private Container lastMainTitle; private TableOfContentsEntry lastMainTitle;
private Container lastSubTitle; private TableOfContentsEntry lastSubTitle;
public WikiTableOfContents() public WikiTableOfContents()
{ {
@ -42,26 +42,14 @@ namespace osu.Game.Overlays.Wiki
if (lastSubTitle != null) if (lastSubTitle != null)
lastSubTitle.Margin = new MarginPadding(0); lastSubTitle.Margin = new MarginPadding(0);
content.Add(lastSubTitle = new Container content.Add(lastSubTitle = entry.With(d => d.Margin = new MarginPadding { Bottom = 10 }));
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Bottom = 10 },
Child = entry,
});
return; return;
} }
lastSubTitle = null; lastSubTitle = null;
content.Add(lastMainTitle = new Container content.Add(lastMainTitle = entry.With(d => d.Margin = new MarginPadding { Bottom = 5 }));
{
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Margin = new MarginPadding { Bottom = 5 },
Child = entry,
});
} }
private class TableOfContentsEntry : OsuHoverContainer private class TableOfContentsEntry : OsuHoverContainer
@ -87,8 +75,8 @@ namespace osu.Game.Overlays.Wiki
f.AddText(text); f.AddText(text);
f.RelativeSizeAxes = Axes.X; f.RelativeSizeAxes = Axes.X;
f.AutoSizeAxes = Axes.Y; f.AutoSizeAxes = Axes.Y;
f.Margin = new MarginPadding { Bottom = 2 };
}); });
Margin = new MarginPadding { Bottom = 2 };
Padding = new MarginPadding { Left = subtitle ? 10 : 0 }; Padding = new MarginPadding { Left = subtitle ? 10 : 0 };
} }