コード例 #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 op          = null;
            int    brushOffset = cpos.mode == DrawMode.normal ? 0 : 1;
            Brush  brush       = GetBrush(p, cpos, brushOffset);

            if (brush == null)
            {
                return;
            }

            switch (cpos.mode)
            {
            case DrawMode.solid:
            case DrawMode.normal:
                op = new EllipsoidDrawOp(); break;

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

            case DrawMode.vertical:
                op = new CylinderDrawOp(); break;
            }

            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);
            }
        }
コード例 #2
0
ファイル: CmdSpheroid.cs プロジェクト: tommyz56/MCGalaxy
        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 = new SolidBrush(cpos.type, cpos.extType);

            switch (cpos.solid) {
                case SolidType.solid:
                    drawOp = new EllipsoidDrawOp(); break;
                case SolidType.hollow:
                    drawOp = new EllipsoidHollowDrawOp(); break;
                case SolidType.vertical:
                    drawOp = new CylinderDrawOp(); break;
            }
            
            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);
        }
コード例 #3
0
        protected override DrawOp GetDrawOp(DrawArgs dArgs)
        {
            DrawOp op = null;

            switch (dArgs.Mode)
            {
            case DrawMode.cone:   op = new ConeDrawOp(); break;

            case DrawMode.hcone:  op = new AdvHollowConeDrawOp(); break;

            case DrawMode.icone:  op = new ConeDrawOp(true); break;

            case DrawMode.hicone: op = new AdvHollowConeDrawOp(true); break;

            case DrawMode.pyramid:   op = new AdvPyramidDrawOp(); break;

            case DrawMode.hpyramid:  op = new AdvHollowPyramidDrawOp(); break;

            case DrawMode.ipyramid:  op = new AdvPyramidDrawOp(true); break;

            case DrawMode.hipyramid: op = new AdvHollowPyramidDrawOp(true); break;

            case DrawMode.sphere:  op = new AdvSphereDrawOp(); break;

            case DrawMode.hsphere: op = new AdvHollowSphereDrawOp(); break;

            case DrawMode.volcano: op = new AdvVolcanoDrawOp(); break;

            case DrawMode.hollow:  op = new CylinderDrawOp(); break;
            }
            if (op == null)
            {
                Help(dArgs.Player); return(null);
            }

            AdvDrawMeta meta    = new AdvDrawMeta();
            bool        success = false;

            string[] args = dArgs.Message.SplitSpaces();
            Player   p    = dArgs.Player;

            if (UsesHeight(dArgs))
            {
                if (args.Length < 3)
                {
                    p.Message("You need to provide the radius and the height for the {0}.", args[0]);
                }
                else
                {
                    success = CommandParser.GetInt(p, args[1], "radius", ref meta.radius, 0, 2000) &&
                              CommandParser.GetInt(p, args[2], "height", ref meta.height, 0, 2000);
                }
            }
            else
            {
                if (args.Length < 2)
                {
                    p.Message("You need to provide the radius for the {0}.", args[0]);
                }
                else
                {
                    success = CommandParser.GetInt(p, args[1], "radius", ref meta.radius, 0, 2000);
                }
            }

            if (!success)
            {
                return(null);
            }
            dArgs.Meta = meta;
            return(op);
        }