Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
		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);
		}
Exemplo n.º 3
0
        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;
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
        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);
        }
Exemplo n.º 6
0
        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);
        }
Exemplo n.º 7
0
        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);
        }
Exemplo n.º 8
0
        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);
        }
Exemplo n.º 9
0
        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);
        }
Exemplo n.º 10
0
        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);
        }