mirror of
https://github.com/ppy/osu
synced 2025-02-25 23:21:26 +00:00
create TocTitle in WikiSidebar
This commit is contained in:
parent
59dbed6418
commit
d8d4bf66b3
@ -1,10 +1,13 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Containers.Markdown;
|
using osu.Framework.Graphics.Containers.Markdown;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
|
|
||||||
namespace osu.Game.Overlays.Wiki
|
namespace osu.Game.Overlays.Wiki
|
||||||
@ -39,13 +42,34 @@ namespace osu.Game.Overlays.Wiki
|
|||||||
switch (level)
|
switch (level)
|
||||||
{
|
{
|
||||||
case 2:
|
case 2:
|
||||||
tableOfContents.Add(new OsuSpriteText
|
tableOfContents.Add(new TocTitle(title));
|
||||||
{
|
|
||||||
Text = title,
|
|
||||||
Font = OsuFont.GetFont(size: 15),
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private class TocTitle : OsuHoverContainer
|
||||||
|
{
|
||||||
|
private readonly OsuSpriteText spriteText;
|
||||||
|
|
||||||
|
public TocTitle(string text)
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.X;
|
||||||
|
AutoSizeAxes = Axes.Y;
|
||||||
|
Child = spriteText = new OsuSpriteText
|
||||||
|
{
|
||||||
|
Text = text,
|
||||||
|
Font = OsuFont.GetFont(size: 15),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override IEnumerable<Drawable> EffectTargets => new Drawable[] { spriteText };
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
|
{
|
||||||
|
IdleColour = colourProvider.Light2;
|
||||||
|
HoverColour = colourProvider.Light1;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user