Exemple #1
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            // Draw corresponding soul texture.
            Vector2   drawPos         = this.GetDimensions().Position();
            Rectangle sourceRectangle = new Rectangle(0, 16 * (int)this.soulType, 16, 16);

            spriteBatch.Draw(soulTexture, drawPos + new Vector2(6, (int)(Height.Pixels / 2 - sourceRectangle.Height / 2)), sourceRectangle, Color.White);

            // Do not continue drawing if there's no soul attached.
            if (soulReference == null)
            {
                return;
            }

            // Draw border.
            GetBorderTexture(out Texture2D borderTex);
            if (borderTex != null)
            {
                UIUtilities.DrawPanelBorders(spriteBatch, borderTex, this.GetOuterDimensions().ToRectangle(), 8, 2, false);
            }

            string nameString = this.soulReference.SoulNPCName();

            // Draw the name of the referenced soul.
            if (nameString.Length >= 12)
            {
                nameString = nameString.Substring(0, 12) + "...";
            }

            drawPos.X += 26;
            drawPos.Y += 4;
            Color color = !this.IsMouseHovering ? Color.White : new Color(Main.mouseTextColor, (int)(Main.mouseTextColor / 1.1F), Main.mouseTextColor / 2, Main.mouseTextColor);

            Utils.DrawBorderStringFourWay(spriteBatch, Main.fontItemStack, nameString, drawPos.X, drawPos.Y, color, Color.Black, Vector2.Zero, 1);

            // Draw the stack amount of the referenced soul.
            Main.LocalPlayer.GetModPlayer <SoulPlayer>().UnlockedSouls.TryGetValue(soulReference.soulNPC, out byte soulStack);
            nameString = "- " + soulStack;

            drawPos.X += this.Width.Pixels - 64;
            Utils.DrawBorderStringFourWay(spriteBatch, Main.fontItemStack, nameString, drawPos.X, drawPos.Y, Color.White, Color.Black, Vector2.Zero, 1);
        }
Exemple #2
0
        protected override void DrawSelf(SpriteBatch spriteBatch)
        {
            Rectangle panelRectangle = this.GetDimensions().ToRectangle();

            UIUtilities.DrawPanelBorders(spriteBatch, panelTexture, panelRectangle, (int)panelDimensions.X, (int)panelDimensions.Y, true);
        }