mirror of
https://github.com/Ellpeck/MLEM.git
synced 2024-11-22 20:58:34 +01:00
fixed font formatting codes not having priority
This commit is contained in:
parent
5115bd8ca6
commit
728e2a53f2
2 changed files with 5 additions and 5 deletions
|
@ -184,18 +184,18 @@ namespace Demos {
|
||||||
|
|
||||||
var children = this.root.GetChildren();
|
var children = this.root.GetChildren();
|
||||||
var totalChildren = this.root.GetChildren(regardGrandchildren: true);
|
var totalChildren = this.root.GetChildren(regardGrandchildren: true);
|
||||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has [Bold]{children.Count()}[Regular] children, but there are [Bold]{totalChildren.Count()}[Regular] when regarding children's children"));
|
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{children.Count()}</b> children, but there are <b>{totalChildren.Count()}</b> when regarding children's children"));
|
||||||
|
|
||||||
var textFields = this.root.GetChildren<TextField>();
|
var textFields = this.root.GetChildren<TextField>();
|
||||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has [Bold]{textFields.Count()}[Regular] text fields"));
|
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{textFields.Count()}</b> text fields"));
|
||||||
|
|
||||||
var paragraphs = this.root.GetChildren<Paragraph>();
|
var paragraphs = this.root.GetChildren<Paragraph>();
|
||||||
var totalParagraphs = this.root.GetChildren<Paragraph>(regardGrandchildren: true);
|
var totalParagraphs = this.root.GetChildren<Paragraph>(regardGrandchildren: true);
|
||||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has [Bold]{paragraphs.Count()}[Regular] paragraphs, but there are [Bold]{totalParagraphs.Count()}[Regular] when regarding children's children"));
|
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{paragraphs.Count()}</b> paragraphs, but there are <b>{totalParagraphs.Count()}</b> when regarding children's children"));
|
||||||
|
|
||||||
var autoWidthChildren = this.root.GetChildren(e => e.Size.X == 1);
|
var autoWidthChildren = this.root.GetChildren(e => e.Size.X == 1);
|
||||||
var autoWidthButtons = this.root.GetChildren<Button>(e => e.Size.X == 1);
|
var autoWidthButtons = this.root.GetChildren<Button>(e => e.Size.X == 1);
|
||||||
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has [Bold]{autoWidthChildren.Count()}[Regular] auto-width children, [Bold]{autoWidthButtons.Count()}[Regular] of which are buttons"));
|
this.root.AddChild(new Paragraph(Anchor.AutoLeft, 1, $"The root has <b>{autoWidthChildren.Count()}</b> auto-width children, <b>{autoWidthButtons.Count()}</b> of which are buttons"));
|
||||||
|
|
||||||
// select the first element for auto-navigation
|
// select the first element for auto-navigation
|
||||||
this.root.Root.SelectElement(this.root.GetChildren().First(c => c.CanBeSelected));
|
this.root.Root.SelectElement(this.root.GetChildren().First(c => c.CanBeSelected));
|
||||||
|
|
|
@ -35,7 +35,7 @@ namespace MLEM.Formatting {
|
||||||
}
|
}
|
||||||
|
|
||||||
public GenericFont GetFont(GenericFont defaultPick) {
|
public GenericFont GetFont(GenericFont defaultPick) {
|
||||||
return this.AppliedCodes.Select(c => c.GetFont(defaultPick)).FirstOrDefault();
|
return this.AppliedCodes.Select(c => c.GetFont(defaultPick)).FirstOrDefault(f => f != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void DrawSelf(GameTime time, SpriteBatch batch, Vector2 pos, GenericFont font, Color color, float scale, float depth) {
|
public void DrawSelf(GameTime time, SpriteBatch batch, Vector2 pos, GenericFont font, Color color, float scale, float depth) {
|
||||||
|
|
Loading…
Reference in a new issue