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

use derived component in OsuMarkdownFencedCodeBlock

This commit is contained in:
Gagah Pangeran Rosfatiputra 2021-05-06 17:05:41 +07:00
parent 67f51959db
commit 010f625870
No known key found for this signature in database
GPG Key ID: 25F6F17FD29031E2

View File

@ -12,33 +12,34 @@ namespace osu.Game.Graphics.Containers.Markdown
{
public class OsuMarkdownFencedCodeBlock : MarkdownFencedCodeBlock
{
private Box background;
private MarkdownTextFlowContainer textFlow;
// TODO : change to monospace font for this component
public OsuMarkdownFencedCodeBlock(FencedCodeBlock fencedCodeBlock)
: base(fencedCodeBlock)
{
}
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
// TODO : Change to monospace font to match with osu-web
background.Colour = colourProvider.Background6;
textFlow.Colour = colourProvider.Light1;
}
protected override Drawable CreateBackground() => new CodeBlockBackground();
protected override Drawable CreateBackground()
public override MarkdownTextFlowContainer CreateTextFlow() => new CodeBlockTextFlowContainer();
private class CodeBlockBackground : Box
{
return background = new Box
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
RelativeSizeAxes = Axes.Both,
};
RelativeSizeAxes = Axes.Both;
Colour = colourProvider.Background6;
}
}
public override MarkdownTextFlowContainer CreateTextFlow()
private class CodeBlockTextFlowContainer : OsuMarkdownTextFlowContainer
{
return textFlow = base.CreateTextFlow();
[BackgroundDependencyLoader]
private void load(OverlayColourProvider colourProvider)
{
Colour = colourProvider.Light1;
Margin = new MarginPadding(10);
}
}
}
}