Example #1
0
        public void Draw(SpriteBatch spriteBatch, Item hoveredItem)
        {
            var cost = ModManager.Instance.GetItemPrice(hoveredItem);

            var costText = hoveredItem.Stack > 1 ? $"{cost * hoveredItem.Stack}({cost})" : $"{cost}";

            if (cost <= 0)
            {
                costText = "0";
            }

            var mousePos     = Game1.getMousePosition();
            var basePosition = new Vector2(mousePos.X, mousePos.Y) + new Vector2(-38, 0);

            var textOffsetX = _coinTexture.Width * Game1.pixelZoom + 5;
            var textWidth   = Game1.smallFont.MeasureString(costText).X;

            var boxWidth = textWidth + UIConstants.BorderWidth * 2 + _coinTexture.Width;

            RenderHelpers.DrawTextMenuBox((int)(basePosition.X - boxWidth), (int)(basePosition.Y - 40),
                                          Game1.smallFont, costText, textOffsetX);

            Utility.drawWithShadow(spriteBatch, _coinTexture, basePosition + new Vector2(-boxWidth + 16, -24),
                                   _coinTexture.Bounds, Color.White, 0f, Vector2.Zero, shadowIntensity: 0f);
        }
Example #2
0
        public void Draw(SpriteBatch spriteBatch)
        {
            var textOffsetX = _coinTexture.Width * Game1.pixelZoom + 5;

            RenderHelpers.DrawTextMenuBox(_balanceArea.bounds.X, _balanceArea.bounds.Y, _width, Game1.smallFont,
                                          RenderHelpers.FillString(Game1.player._money.ToString(), "0", Game1.smallFont, _width - textOffsetX - 5, "+"),
                                          textOffsetX);

            _coin.draw(spriteBatch);
        }
 public void Draw(SpriteBatch spriteBatch)
 {
     RenderHelpers.DrawTextMenuBox(_sortButton.bounds.X, _sortButton.bounds.Y, Game1.smallFont,
                                   _sortButton.name, _sortTexture.Width * Game1.pixelZoom + 5);
     _sortIcon.draw(spriteBatch);
 }