mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 01:52:55 +08:00
use derived component in OsuMarkdownFencedCodeBlock
This commit is contained in:
parent
67f51959db
commit
010f625870
@ -12,33 +12,34 @@ namespace osu.Game.Graphics.Containers.Markdown
|
|||||||
{
|
{
|
||||||
public class OsuMarkdownFencedCodeBlock : MarkdownFencedCodeBlock
|
public class OsuMarkdownFencedCodeBlock : MarkdownFencedCodeBlock
|
||||||
{
|
{
|
||||||
private Box background;
|
// TODO : change to monospace font for this component
|
||||||
private MarkdownTextFlowContainer textFlow;
|
|
||||||
|
|
||||||
public OsuMarkdownFencedCodeBlock(FencedCodeBlock fencedCodeBlock)
|
public OsuMarkdownFencedCodeBlock(FencedCodeBlock fencedCodeBlock)
|
||||||
: base(fencedCodeBlock)
|
: base(fencedCodeBlock)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override Drawable CreateBackground() => new CodeBlockBackground();
|
||||||
|
|
||||||
|
public override MarkdownTextFlowContainer CreateTextFlow() => new CodeBlockTextFlowContainer();
|
||||||
|
|
||||||
|
private class CodeBlockBackground : Box
|
||||||
|
{
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OverlayColourProvider colourProvider)
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
// TODO : Change to monospace font to match with osu-web
|
RelativeSizeAxes = Axes.Both;
|
||||||
background.Colour = colourProvider.Background6;
|
Colour = colourProvider.Background6;
|
||||||
textFlow.Colour = colourProvider.Light1;
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Drawable CreateBackground()
|
private class CodeBlockTextFlowContainer : OsuMarkdownTextFlowContainer
|
||||||
{
|
{
|
||||||
return background = new Box
|
[BackgroundDependencyLoader]
|
||||||
|
private void load(OverlayColourProvider colourProvider)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
Colour = colourProvider.Light1;
|
||||||
};
|
Margin = new MarginPadding(10);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override MarkdownTextFlowContainer CreateTextFlow()
|
|
||||||
{
|
|
||||||
return textFlow = base.CreateTextFlow();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user