private static TagType ParseTag(StringPart text, ref Vector2 position, ref int lineSpacing, ref int lineIndex)
{
var type = TagType.None;
if (text.Equals("\n"))
{
NewLine(ref position, ref lineSpacing, ref lineIndex);
type = TagType.NewLine;
}
else if (text.StartsWith("f:") && fonts != null)
{
var fontName = text.Substring(2);
SpriteFont font;
if (fonts.TryParse(fontName, out font))
{
PushFont(font);
type = TagType.FontStart;
}
}
else if (text.Equals("/f"))
{
PopFont();
type = TagType.FontEnd;
}
else if (text.StartsWith("c:"))
{
var colourName = text.Substring(2);
Color colour;
if (ColourParser.TryParse(colourName, out colour))
{
PushColour(colour);
type = TagType.ColourStart;
}
}
else if (text.Equals("/c"))
{
PopColour();
type = TagType.ColourEnd;
}
return(type);
}