public HtmlControl(int x, int y, int w, int h, bool hasbackground, bool hasscrollbar, bool useflagscrollbar = false, string text = "", int hue = 0, bool ishtml = false, byte font = 1, bool isunicode = true, FontStyle style = FontStyle.None, TEXT_ALIGN_TYPE align = TEXT_ALIGN_TYPE.TS_LEFT) : this() { X = x; Y = y; Width = w; Height = h; HasBackground = hasbackground; HasScrollbar = hasscrollbar; UseFlagScrollbar = useflagscrollbar; //hasscrollbar != 0 && hasscrollbar == 2; if (!string.IsNullOrEmpty(text)) { _gameText.IsHTML = ishtml; _gameText.FontStyle = style; _gameText.Align = align; _gameText.Font = font; _gameText.IsUnicode = isunicode; _gameText.MaxWidth = w - (HasScrollbar ? 15 : 0) - (HasBackground ? 8 : 0); } InternalBuild(text, hue); }
public static RenderedText Create(string text, ushort hue = 0xFFFF, byte font = 0xFF, bool isunicode = true, FontStyle style = 0, TEXT_ALIGN_TYPE align = 0, int maxWidth = 0, byte cell = 30, bool isHTML = false, bool recalculateWidthByInfo = false, bool saveHitmap = false) { RenderedText r; if (_pool.Count != 0) { r = _pool.Dequeue(); r.IsDestroyed = false; r.Links.Count = 0; } else { r = new RenderedText(); } r.Hue = hue; r.Font = font; r.IsUnicode = isunicode; r.FontStyle = style; r.Cell = cell; r.Align = align; r.MaxWidth = maxWidth; r.IsHTML = isHTML; r.RecalculateWidthByInfo = recalculateWidthByInfo; r.Width = 0; r.Height = 0; r.SaveHitMap = saveHitmap; r.HTMLColor = 0xFFFF_FFFF; r.HasBackgroundColor = false; r.IsPartialHue = false; if (r.Text != text) { r.Text = text; // here makes the texture } else { r.CreateTexture(); } return(r); }
private void AddStatTextLabel(string text, MobileStats stat, int x, int y, int maxWidth = 0, ushort hue = 0x0386, TEXT_ALIGN_TYPE alignment = TEXT_ALIGN_TYPE.TS_LEFT) { Label label = new Label(text, false, hue, maxWidth, align: alignment, font: 1) { X = x, Y = y }; _labels[(int)stat] = label; Add(label); }
public HoveredLabel(string text, bool isunicode, ushort hue, ushort overHue, ushort selectedHue, int maxwidth = 0, byte font = 255, FontStyle style = FontStyle.None, TEXT_ALIGN_TYPE align = TEXT_ALIGN_TYPE.TS_LEFT) : base($" {text}", isunicode, hue, maxwidth, font, style, align) { _overHue = overHue; _normalHue = hue; _selectedHue = selectedHue; AcceptMouseInput = true; }
public StbTextBox(byte font, int max_char_count = -1, int maxWidth = 0, bool isunicode = true, FontStyle style = FontStyle.None, ushort hue = 0, TEXT_ALIGN_TYPE align = 0) { AcceptKeyboardInput = true; AcceptMouseInput = true; CanMove = false; IsEditable = true; _maxCharCount = max_char_count; _stb = new TextEdit(this); _stb.SingleLine = true; if (maxWidth > 0) { style |= FontStyle.CropTexture; } _fontStyle = style; if ((style & (FontStyle.Fixed | FontStyle.Cropped)) != 0 && maxWidth <= 0) { Debug.Assert((style & (FontStyle.Fixed | FontStyle.Cropped)) != 0 && maxWidth <= 0); } // stb_textedit will handle part of these tag style &= ~(FontStyle.Fixed | FontStyle.Cropped | FontStyle.CropTexture); _rendererText = RenderedText.Create(string.Empty, hue, font, isunicode, style, align, maxWidth, 30, false, false, false); _rendererCaret = RenderedText.Create("_", hue, font, isunicode, (style & FontStyle.BlackBorder) != 0 ? FontStyle.BlackBorder : FontStyle.None, align: align); Height = _rendererCaret.Height; if (Height < 50) { Height = 50; } }
public Label(string text, bool isunicode, ushort hue, int maxwidth = 0, byte font = 0xFF, FontStyle style = FontStyle.None, TEXT_ALIGN_TYPE align = TEXT_ALIGN_TYPE.TS_LEFT) { if (font == 0xFF) { font = (byte)(FileManager.ClientVersion >= ClientVersions.CV_305D ? 1 : 0); } _gText = new RenderedText { IsUnicode = isunicode, Font = font, FontStyle = style, Hue = hue, Align = align, MaxWidth = maxwidth, Text = text }; AcceptMouseInput = false; Width = _gText.Width; Height = _gText.Height; }
public PasswordStbTextBox(byte font, int max_char_count = -1, int maxWidth = 0, bool isunicode = true, FontStyle style = FontStyle.None, ushort hue = 0, TEXT_ALIGN_TYPE align = TEXT_ALIGN_TYPE.TS_LEFT) : base(font, max_char_count, maxWidth, isunicode, style, hue, align) { _rendererText = RenderedText.Create(string.Empty, hue, font, isunicode, style, align, maxWidth, 30, false, false, false); _rendererCaret = RenderedText.Create("_", hue, font, isunicode, (style & FontStyle.BlackBorder) != 0 ? FontStyle.BlackBorder : FontStyle.None, align: align); NoSelection = true; }
public Label(string text, bool isunicode, ushort hue, int maxwidth = 0, byte font = 0xFF, FontStyle style = FontStyle.None, TEXT_ALIGN_TYPE align = TEXT_ALIGN_TYPE.TS_LEFT, bool ishtml = false) { _gText = RenderedText.Create(text, hue, font, isunicode, style, align, maxwidth, isHTML: ishtml); AcceptMouseInput = false; Width = _gText.Width; Height = _gText.Height; }
public Label(string text, bool isunicode, ushort hue, int maxwidth = 0, byte font = 0xFF, FontStyle style = FontStyle.None, TEXT_ALIGN_TYPE align = TEXT_ALIGN_TYPE.TS_LEFT) { _gText = new RenderedText { IsUnicode = isunicode, Font = font, FontStyle = style, Hue = hue, Align = align, MaxWidth = maxwidth, Text = text }; AcceptMouseInput = false; Width = _gText.Width; Height = _gText.Height; }
public HoveredLabel(string text, bool isunicode, ushort hue, ushort overHue, int maxwidth = 0, byte font = 255, FontStyle style = FontStyle.None, TEXT_ALIGN_TYPE align = TEXT_ALIGN_TYPE.TS_LEFT, float timeToLive = 0) : base(text, isunicode, hue, maxwidth, font, style, align, timeToLive) { _overHue = overHue; _normalHue = hue; AcceptMouseInput = true; }
public NiceButton(int x, int y, int w, int h, ButtonAction action, string text, int groupnumber = 0, TEXT_ALIGN_TYPE align = TEXT_ALIGN_TYPE.TS_CENTER) : base(x, y, w, h) { _action = action; Label label; Add(label = new Label(text, true, 999, w, 0xFF, FontStyle.BlackBorder | FontStyle.Cropped, align) { X = align == TEXT_ALIGN_TYPE.TS_CENTER ? -2 : 0, }); label.Y = (h - label.Height) >> 1; _groupnumber = groupnumber; }
public FadeOutLabel(string text, bool isunicode, ushort hue, float timeToLive, int maxwidth = 0, byte font = 0xFF, FontStyle style = FontStyle.None, TEXT_ALIGN_TYPE align = TEXT_ALIGN_TYPE.TS_LEFT) : base(text, isunicode, hue, maxwidth, font, style, align) { _timeToLive = timeToLive; }
public TextBox(byte font, int maxcharlength = -1, int maxWidth = 0, int width = 0, bool isunicode = true, FontStyle style = FontStyle.None, ushort hue = 0, TEXT_ALIGN_TYPE alig = 0) { TxEntry = new TextEntry(font, maxcharlength, maxWidth, width, isunicode, style, hue, alig); base.AcceptKeyboardInput = true; base.AcceptMouseInput = true; IsEditable = true; Unicode = isunicode; Font = font; Texture = TxEntry.RenderText.Texture; }