public override bool CanUseItem(Player player)
        {
            if (player.whoAmI != Main.myPlayer)
            {
                return(false);
            }
            if ((!canPaint && UIStateLogic1.paintWheel.toolIndex != 2) ||
                !HelperMethods.ToolHasRange(toolRange))
            {
                return(false);
            }

            BEPlayer   mp             = player.GetModPlayer <BEPlayer>();
            PaintWheel panel          = UIStateLogic1.paintWheel;
            byte       selectedColor  = (byte)(panel.colorIndex + 1);
            bool       infPaintBucket = mp.infinitePaintBucketEquipped;

            switch (panel.toolIndex)
            {
            case 0:
                HelperMethods.PaintTileOrWall(selectedColor, panel.toolIndex, infPaintBucket);
                break;

            case 1:
                HelperMethods.PaintTileOrWall(selectedColor, panel.toolIndex, infPaintBucket);
                break;

            case 2:
                HelperMethods.ScrapPaint();
                break;
            }

            return(true);
        }
Esempio n. 2
0
 public void Unload()
 {
     Instance              = null;
     multiWandWheel        = null;
     autoHammerWheel       = null;
     paintWheel            = null;
     fillWandSelection     = null;
     mirrorWandSelection   = null;
     shapesDrawerSelection = null;
     rectangleShape        = null;
     ellipseShape          = null;
     bezierCurve           = null;
 }
Esempio n. 3
0
        public override void OnInitialize()
        {
            Instance = this;

            multiWandWheel = new MultiWandWheel();
            Instance.Append(multiWandWheel);
            multiWandWheel.Hide();

            autoHammerWheel = new AutoHammerWheel();
            Instance.Append(autoHammerWheel);
            autoHammerWheel.Hide();

            paintWheel = new PaintWheel();
            Instance.Append(paintWheel);
            paintWheel.Hide();

            fillWandSelection = new FillWandSelection();
            Instance.Append(fillWandSelection);
            fillWandSelection.Hide();

            mirrorWandSelection = new MirrorWandSelection();
            Instance.Append(mirrorWandSelection);
            mirrorWandSelection.Show();

            shapesDrawerSelection = new ShapesDrawerSelection();
            Instance.Append(shapesDrawerSelection);
            shapesDrawerSelection.Show();

            rectangleShape = new RectangleShape();
            Instance.Append(rectangleShape);
            rectangleShape.Show();

            ellipseShape = new EllipseShape();
            Instance.Append(ellipseShape);
            ellipseShape.Show();

            bezierCurve = new BezierCurve();
            Instance.Append(bezierCurve);
            bezierCurve.Show();
        }
        public override void HoldItem(Player player)
        {
            BEPlayer mp = player.GetModPlayer <BEPlayer>();

            if (player.whoAmI != Main.myPlayer || Main.netMode == NetmodeID.Server || !mp.ValidCursorPos)
            {
                return;
            }

            PaintWheel panel = UIStateLogic1.paintWheel;

            canPaint = HelperMethods.ToolHasRange(toolRange) && (panel.colorIndex != -1 || panel.toolIndex == 2) &&
                       HelperMethods.IsUIAvailable(playerNotWieldingItem: false);
            player.showItemIcon = canPaint && !panel.IsMouseHovering;

            switch (panel.toolIndex)
            {
            case 0:     //Paint tiles
                if (mp.PointedTile.type >= 0 && mp.PointedTile.active())
                {
                    player.showItemIcon2 = ItemID.SpectrePaintbrush;
                }
                break;

            case 1:     //Paint walls
                if (mp.PointedTile.type >= 0 && mp.PointedTile.wall > 0)
                {
                    player.showItemIcon2 = ItemID.SpectrePaintRoller;
                }
                break;

            case 2:     //Scrap paint
                if (mp.PointedTile.color() != 0 || mp.PointedTile.wallColor() != 0)
                {
                    player.showItemIcon2 = ItemID.SpectrePaintScraper;
                }
                break;
            }
        }