Пример #1
0
        public override void ParseAttribute(string attribute, string value)
        {
            ParsedData p = new ParsedData(attribute, value);

            if (Parsed.Contains(p))
            {
                return;
            }

            Parsed.Add(p);

            if (attribute.ToLower() == "content")
            {
                Text = (c) => c.GetWrapper().TryLoadText(value, c, out string text) ? text : "";
            }
            else if (attribute.ToLower() == "font")
            {
                Font = (c) => c.GetWrapper().TryGet(value, out Font font) ? font : null;
            }
            else if (attribute.ToLower() == "textscale")
            {
                Scale = float.TryParse(value, out float scale) ? scale : 1f;
            }
            else if (attribute.ToLower() == "textlimit")
            {
                TextLimit = int.TryParse(value, out int limit) ? limit : -1;
            }
            else
            {
                Parsed.Remove(p);
                base.ParseAttribute(attribute, value);
            }
        }