Example #1
0
        public override void DrawUI(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            if (signature != null)
            {
                Vector2 signatureSize = new Vector2(signature.width * 8, signature.height * 8);

                string  text     = "" + amount;
                Vector2 textSize = Game1.font.MeasureString(text);

                Vector2 signaturePos = new Vector2(
                    bounds.X + (bounds.Width - (signatureSize.X + textSize.X)) * 0.5f,
                    bounds.Y + 32 + (textSize.Y - signatureSize.Y) * 0.5f - textSize.Y
                    );

                Vector2 textPos = new Vector2(
                    signaturePos.X + signatureSize.X + 2,
                    bounds.Y + 32 - textSize.Y
                    );

                float     labelHeight = Math.Max(signatureSize.Y, textSize.Y);
                Vectangle labelRect   = new Vectangle(signaturePos.X, signaturePos.Y + (signatureSize.Y - labelHeight) * 0.5f, signatureSize.X + textSize.X, Math.Max(signatureSize.Y, textSize.Y));
                spriteBatch.Draw(TextureCache.white, labelRect.Bloat(5, 2), new Color(0, 0, 0, 0.5f));

                signature.Draw(spriteBatch, signaturePos, true);
                spriteBatch.DrawString(Game1.font, text, textPos, Color.LightGray);
            }
        }
Example #2
0
        public override void Draw(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            base.Draw(spriteBatch, blackboard);
            Vector2 pos           = new Vector2(bounds.X, bounds.Y + bounds.Height);
            Vector2 signatureSize = new Vector2(signature.width * 8, signature.height * 8);

            string  text     = "$" + price;
            Vector2 textSize = Game1.font.MeasureString(text);

            Vector2 signaturePos = new Vector2(
                pos.X + (bounds.Width - (signatureSize.X + textSize.X)) * 0.5f,
                pos.Y + (textSize.Y - signatureSize.Y) * 0.5f
                );

            Vector2 textPos = new Vector2(
                signaturePos.X + signatureSize.X,
                pos.Y
                );

            float     labelHeight = Math.Max(signatureSize.Y, textSize.Y);
            Vectangle labelRect   = new Vectangle(signaturePos.X, signaturePos.Y + (signatureSize.Y - labelHeight) * 0.5f, signatureSize.X + textSize.X, Math.Max(signatureSize.Y, textSize.Y));

            spriteBatch.Draw(TextureCache.white, labelRect.Bloat(5, 2), new Color(0, 0, 0, 0.5f));

            signature.Draw(spriteBatch, signaturePos, true);

            spriteBatch.DrawString(Game1.font, "$" + price, textPos, Color.Yellow);
        }
Example #3
0
        public override void DrawUI(SpriteBatch spriteBatch, CityUIBlackboard blackboard)
        {
            Vector2 pos           = new Vector2(bounds.X, bounds.Y + 32);
            Vector2 signatureSize = new Vector2(signature.width * 8, signature.height * 8);

            string  text     = numCrystals > 1? " +" + numCrystals + " bubbles": " +1 bubble";
            Vector2 textSize = Game1.font.MeasureString(text);

            Vector2 signaturePos = new Vector2(
                pos.X + (bounds.Width - (signatureSize.X + textSize.X)) * 0.5f,
                pos.Y + (textSize.Y - signatureSize.Y) * 0.5f
                );

            Vector2 textPos = new Vector2(
                signaturePos.X + signatureSize.X,
                pos.Y
                );

            Vectangle labelRect = new Vectangle(signaturePos.X, signaturePos.Y + (signatureSize.Y - textSize.Y) * 0.5f, signatureSize.X + textSize.X, Math.Max(signatureSize.Y, textSize.Y));

            spriteBatch.Draw(TextureCache.white, labelRect.Bloat(5, 2), new Color(0, 0, 0, 0.5f));
            signature.Draw(spriteBatch, signaturePos, true);

            spriteBatch.DrawString(Game1.font, text, textPos, Color.Yellow);
        }