Esempio n. 1
0
        protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType) {
            RevertAndClearState(p, x, y, z);
            CatchPos cpos = (CatchPos)p.blockchangeObject;
            GetRealBlock(type, extType, p, ref cpos);
            DrawOp drawOp = null;
            Brush brush = null;

            switch (cpos.solid) {
                case SolidType.solid:
                    drawOp = new CuboidDrawOp(); break;
                case SolidType.hollow:
                    drawOp = new CuboidHollowsDrawOp(); break;
                case SolidType.walls:
                    drawOp = new CuboidWallsDrawOp(); break;
                case SolidType.holes:
                    drawOp = new CuboidHolesDrawOp(); break;
                case SolidType.wire:
                    drawOp = new CuboidWireframeDrawOp(); break;
                case SolidType.random:
                    drawOp = new CuboidDrawOp();
                    brush = new RandomBrush(cpos.type, cpos.extType); break;
            }
            
            if (brush == null) brush = new SolidBrush(cpos.type, cpos.extType);
            ushort x1 = Math.Min(cpos.x, x), x2 = Math.Max(cpos.x, x);
            ushort y1 = Math.Min(cpos.y, y), y2 = Math.Max(cpos.y, y);
            ushort z1 = Math.Min(cpos.z, z), z2 = Math.Max(cpos.z, z);            
            if (!DrawOp.DoDrawOp(drawOp, brush, p, x1, y1, z1, x2, y2, z2))
                return;
            if (p.staticCommands)
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
        }
Esempio n. 2
0
        protected override void Blockchange2(Player p, ushort x, ushort y, ushort z, byte type, byte extType)
        {
            RevertAndClearState(p, x, y, z);
            CatchPos cpos = (CatchPos)p.blockchangeObject;

            GetRealBlock(type, extType, p, ref cpos);
            DrawOp op = null;
            Func <BrushArgs, Brush> constructor = null;

            switch (cpos.mode)
            {
            case DrawMode.solid:
                op          = new CuboidDrawOp();
                constructor = SolidBrush.Process; break;

            case DrawMode.normal:
                op = new CuboidDrawOp(); break;

            case DrawMode.hollow:
                op = new CuboidHollowsDrawOp(); break;

            case DrawMode.walls:
                op = new CuboidWallsDrawOp(); break;

            case DrawMode.holes:
                op          = new CuboidDrawOp();
                constructor = CheckeredBrush.Process; break;

            case DrawMode.wire:
                op = new CuboidWireframeDrawOp(); break;

            case DrawMode.random:
                op          = new CuboidDrawOp();
                constructor = RandomBrush.Process; break;
            }

            int   brushOffset = cpos.mode == DrawMode.normal ? 0 : 1;
            Brush brush       = GetBrush(p, cpos, brushOffset, constructor);

            if (brush == null)
            {
                return;
            }
            if (!DrawOp.DoDrawOp(op, brush, p, cpos.x, cpos.y, cpos.z, x, y, z))
            {
                return;
            }
            if (p.staticCommands)
            {
                p.Blockchange += new Player.BlockchangeEventHandler(Blockchange1);
            }
        }