public UI MakeUI(ComplexLS ui_script) { var sprite = Context.Content.MakeSprite(ui_script.Read <ComplexLS>("SPRITE")); float left = (float)ui_script.ReadToken <double>("LEFT"); float right = (float)ui_script.ReadToken <double>("RIGHT"); float top = (float)ui_script.ReadToken <double>("TOP"); float bottom = (float)ui_script.ReadToken <double>("BOTTOM"); var id = ui_script.Read <TokenLS <string> >("ID"); var ui = new UI(sprite, left, bottom, right, top); ui.Visible = ui_script.Read("HIDDEN") == null; List <IRender> uis = new List <IRender>(); foreach (var suic in ui_script.Read <ComplexLS>("CHILDREN").SubRunes) { if (suic.Word == "ELEMENT") { uis.Add(MakeUI(suic as ComplexLS)); } else if (suic.Word == "TEXT") { uis.Add(MakeText(suic as ComplexLS, right - left, 0.7f)); } } ui.Children = uis.ToArray(); if (id != null) { AssignUI(ui, id); } return(ui); }
public TextRender MakeText(ComplexLS text_script, float line_length, float font_size) { float x = (float)text_script.ReadToken <double>("X"); float y = (float)text_script.ReadToken <double>("Y"); var str = Context.Content.Text.CompileString( text_script.ReadToken <string>("LINE"), new Vector2(x, y), Context.Window.RenderWorker, line_length / font_size); str.CalcFontSize(font_size); return(str); }