public HudTextBoard(string pText, float px, float py, int width, int height, int textSize, CenterMode hor = CenterMode.Min, CenterMode ver = CenterMode.Min) { this.x = px; this.y = py; this._text = pText; _easyDraw = new EasyDraw(width, height, false); _easyDraw.TextFont("data/Gaiatype.ttf", 12); if (!string.IsNullOrEmpty(pText)) { _easyDraw.TextSize(textSize); _easyDraw.TextDimensions(_text, out var w, out var h); var wr = Mathf.Round(w); var hr = Mathf.Round(h); if (wr <= 0) { wr = 10; } if (hr <= 0) { hr = 10; } _easyDraw = new EasyDraw(wr, hr, false); } _easyDraw.TextFont("data/Gaiatype.ttf", 12); _easyDraw.TextSize(textSize); _easyDraw.TextAlign(hor, ver); AddChild(_easyDraw); if (hor == CenterMode.Center) { _textX = _easyDraw.width * 0.5f; } else if (hor == CenterMode.Max) { _textX = _easyDraw.width; } if (ver == CenterMode.Center) { _textY = _easyDraw.height * 0.5f; } else if (ver == CenterMode.Max) { _textY = _easyDraw.height; } SetText(_text); }