Example #1
0
        ////////////////

        public Rectangle DrawColorIcon(SpriteBatch sb, int itemType, Color color, float amountPercent,
                                       int stack, int x, int y, double paletteAngle, double angleStep, bool isSelected)
        {
            bool      hasGlow;
            Texture2D cartTex = this.GetPaintTexture(itemType);
            Texture2D overTex = this.GetPaintOverlayTexture(itemType, out hasGlow);

            bool isHover = this.IsHoveringIcon(paletteAngle, angleStep);

            var   rect     = new Rectangle(x - (cartTex.Width / 2), y - (cartTex.Height / 2), cartTex.Width, cartTex.Height);
            float colorMul = isSelected ? PaintBlasterUI.SelectedScale :
                             (isHover ? PaintBlasterUI.HoveredScale : PaintBlasterUI.IdleScale);

            sb.Draw(cartTex, rect, Color.White * colorMul);
            if (overTex != null)
            {
                sb.Draw(overTex, rect, (hasGlow ? color : color * colorMul));
            }

            if (isHover)
            {
                Color textColor  = ColorCartridgeItem.GetCapacityColor(amountPercent);
                Color labelColor = hasGlow ? Color.GreenYellow * PaintBlasterUI.HoveredScale
                                        : Color.White * PaintBlasterUI.HoveredScale;
                Color bgColor = Color.Black * PaintBlasterUI.HoveredScale;

                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "Capacity:", Main.mouseX, Main.mouseY - 16, labelColor, bgColor, default(Vector2), 1f);
                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, (int)(amountPercent * 100) + "%", Main.mouseX + 72, Main.mouseY - 16, labelColor, bgColor, default(Vector2), 1f);

                string colorStr = PaintBlasterHelpers.ColorString(color);

                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, "Color:", Main.mouseX, Main.mouseY + 8, labelColor, bgColor, default(Vector2), 1f);
                Utils.DrawBorderStringFourWay(sb, Main.fontMouseText, colorStr, Main.mouseX + 56, Main.mouseY + 8, color, bgColor, default(Vector2), 1f);
            }

            if (isSelected)
            {
                Rectangle selRect = rect;
                selRect.X      -= 3;
                selRect.Y      -= 3;
                selRect.Width  += 6;
                selRect.Height += 6;

                HUDHelpers.DrawBorderedRect(sb, Color.Transparent, AnimatedColors.Air.CurrentColor * 0.5f, selRect, 2);
            }

            Utils.DrawBorderStringFourWay(sb, Main.fontItemStack, stack + "", (rect.X + cartTex.Width) - 4, (rect.Y + cartTex.Height) - 12, Color.White, Color.Black, default(Vector2), 1f);

            return(rect);
        }
Example #2
0
        ////////////////

        public override void Action(CommandCaller caller, string input, string[] args)
        {
            var mymod     = (BetterPaintMod)this.mod;
            int paintType = ModContent.ItemType <ColorCartridgeItem>();

            int  itemIdx   = ItemHelpers.CreateItem(Main.LocalPlayer.position, paintType, 1, ColorCartridgeItem.Width, ColorCartridgeItem.Height);
            Item paintItem = Main.item[itemIdx];

            if (paintItem == null || paintItem.IsAir)
            {
                throw new ModHelpersException("Could not create cheaty paint.");
            }

            Func <byte> rand    = () => (byte)Main.rand.Next(0, 255);
            var         randClr = new Color(rand(), rand(), rand());

            var myitem = (ColorCartridgeItem)paintItem.modItem;

            myitem.SetPaint(randClr, mymod.Config.PaintCartridgeCapacity);

            caller.Reply("Random color cartridge created: " + PaintBlasterHelpers.ColorString(randClr), randClr);
        }
Example #3
0
        public override void ModifyTooltips(List <TooltipLine> tooltips)
        {
            if (!this.IsInitialized)
            {
                return;
            }

            var   mymod   = (BetterPaintMod)this.mod;
            float percent = this.Quantity / mymod.Config.PaintCartridgeCapacity;

            var tip1 = new TooltipLine(this.mod, "BetterPaint: Color Indicator", "Color value: " + PaintBlasterHelpers.ColorString(this.MyColor))
            {
                overrideColor = this.MyColor
            };
            var tip2 = new TooltipLine(this.mod, "BetterPaint: Capacity", "Capacity: " + (int)(percent * 100) + "%")
            {
                overrideColor = ColorCartridgeItem.GetCapacityColor(percent)
            };

            tooltips.Add(tip1);
            tooltips.Add(tip2);
        }