private void InternalSetText(object text, float textScale, bool large) { DynamicSpriteFont val = large ? FontAssets.DeathText.get_Value() : FontAssets.MouseText.get_Value(); _text = text; _isLarge = large; _textScale = textScale; _lastTextReference = _text.ToString(); if (IsWrapped) { _visibleText = val.CreateWrappedText(_lastTextReference, GetInnerDimensions().Width / _textScale); } else { _visibleText = _lastTextReference; } Vector2 vector = val.MeasureString(_visibleText); Vector2 vector2 = _textSize = ((!IsWrapped) ? (new Vector2(vector.X, large ? 32f : 16f) * textScale) : (new Vector2(vector.X, vector.Y + WrappedTextBottomPadding) * textScale)); MinWidth.Set(vector2.X + PaddingLeft + PaddingRight, 0f); MinHeight.Set(vector2.Y + PaddingTop + PaddingBottom, 0f); if (this.OnInternalTextChange != null) { this.OnInternalTextChange(); } }
public void UpdateSize() { int num = _itemsPerLine = GetDimensions().ToRectangle().Width / 44; int num2 = (int)Math.Ceiling((float)_itemIdsAvailableToShow.Count / (float)num); MinHeight.Set(44 * num2, 0f); }
public virtual void SetText(T text, float textScale) { Vector2 textSize = new Vector2(FontAssets.MouseText.get_Value().MeasureString(text.ToString()).X, 16f) * textScale; _text = text; _textScale = textScale; _textSize = textSize; MinWidth.Set(textSize.X + PaddingLeft + PaddingRight, 0f); MinHeight.Set(textSize.Y + PaddingTop + PaddingBottom, 0f); }
public override void OnInitialize() { MediaCache.LoadTexture(Image, out string key); Texture2D temp = MediaCache.GetTexture(key); MinWidth.Set(temp.Width, 0f); MinHeight.Set(temp.Height, 0f); Image = key; }
private void InternalSetText(object text, float textScale, bool large) { Vector2 textSize = new Vector2((large ? Main.fontDeathText : Main.fontMouseText).MeasureString(text.ToString()).X, large ? 32f : 16f) * textScale; _textScale = textScale; _textSize = textSize; _isLarge = large; MinWidth.Set(textSize.X + PaddingLeft + PaddingRight, 0f); MinHeight.Set(textSize.Y + PaddingTop + PaddingBottom, 0f); }
public UITextWrapPanel() { Width.Set(0, 1f); MinHeight.Set(22f, 0f); _text = ""; _textInLines = new string[1]; uiText = new UIText(_text, 0.9f, false); base.Append(uiText); }
public virtual void SetText(T text, float textScale, bool large) { Vector2 textSize = new Vector2((large ? FontAssets.DeathText.Value : FontAssets.MouseText.Value).MeasureString(text.ToString()).X, large ? 32f : 16f) * textScale; _text = text; _textScale = textScale; _textSize = textSize; _isLarge = large; MinWidth.Set(textSize.X + PaddingLeft + PaddingRight, 0f); MinHeight.Set(textSize.Y + PaddingTop + PaddingBottom, 0f); }
public void SetText(string text, float textScale, bool large) { Vector2 vector2 = new Vector2((large ? Main.fontDeathText : Main.fontMouseText).MeasureString(text).X, large ? 32f : 16f) * textScale; _text = text; _textScale = textScale; _textSize = vector2; _isLarge = large; MinWidth.Set(vector2.X + PaddingLeft + PaddingRight, 0.0f); MinHeight.Set(vector2.Y + PaddingTop + PaddingBottom, 0.0f); }
public void SetText(string text, float textScale, bool large) { SpriteFont spriteFont = large ? Main.fontDeathText : Main.fontMouseText; Vector2 textSize = new Vector2(spriteFont.MeasureString(text).X, large ? 32f : 16f) * textScale; _text = text; _textScale = textScale; _textSize = textSize; _isLarge = large; MinWidth.Set(textSize.X + PaddingLeft + PaddingRight, 0f); MinHeight.Set(textSize.Y + PaddingTop + PaddingBottom, 0f); }
public virtual void SetText(T text, float scale, bool large) { Vector2 size = (large ? Main.Xiq12 : Main.Xiq12).MeasureString(text.ToString()) * scale; size.Y = (large ? 28f : 16f) * scale; this.text = text; TextScale = scale; TextSize = size; IsLarge = large; MinWidth.Set(size.X + PaddingLeft + PaddingRight, 0f); MinHeight.Set(size.Y + PaddingTop + PaddingBottom, 0f); }
private void InternalSetText(object text, float scale, bool large) { Vector2 size = (large ? Main.Xiq12 : Main.Xiq12).MeasureString(text.ToString()) * scale; size.Y = (large ? 28f : 16f) * scale; Text = text; TextScale = scale; TextSize = size; IsLarge = large; MinWidth.Set(size.X + PaddingLeft + PaddingRight, 0f); MinHeight.Set(size.Y + PaddingTop + PaddingBottom, 0f); }
public override void OnInitialize() { MinWidth = StyleDimension.Fill; MinHeight.Set(DEFAULT_HEIGHT, 0); Append(Checkbox); UILabel = new UIText(Label); UILabel.Left.Set(DEFAULT_HEIGHT + Gap, 0f); UILabel.VAlign = 0.5f; Append(UILabel); }
public UIButtonChoice(GUIBase parent, Texture2D[] _butons, LocalizedText[] mouseText) { if (_butons.Length != mouseText.Length || _butons.Length == 0) { throw new ArgumentException(); } buttons = _butons; mouseOverTexts = mouseText; parentGui = parent; int width = BUTTON_SIZE * _butons.Length + BUTTON_PADDING * (_butons.Length - 1); Width.Set(width, 0f); MinWidth.Set(width, 0f); Height.Set(BUTTON_SIZE, 0f); MinHeight.Set(BUTTON_SIZE, 0f); }