protected override void OnUpdate(float delta) { base.OnUpdate(delta); if (needDraw == false) { return; } width = 0; height = 0; possplit = 0; widthsplit = 0; foreach (var c in text) { Size?size = null; size = drawfont1.GetCharSize(c); if (size != null) { height = Math.Max(height, size.Value.Height); if (c == '0' && width == widthsplit) { widthsplit += size.Value.Width; possplit++; } width += size.Value.Width; } } if (valign == 0) { align.Y = 0; } if (valign == 1) { align.Y = (Size.Y - height) / 2; } if (valign == 2) { align.Y = (Size.Y - height); } if (halign == 0) { align.X = 0; } if (halign == 1) { align.X = (Size.X - width) / 2; } if (halign == 2) { align.X = (Size.X - width); } }