private static void Draw2DCallback( Player player, Vector3I[] marks, object tag )
{
Block block = new Block();
Draw2DData data = ( Draw2DData )tag;
int radius = data.Radius;
int Points = data.Points;
bool fill = data.Fill;
string Shape = data.Shape;
if ( player.LastUsedBlockType == Block.Undefined ) {
block = Block.Stone;
} else {
block = player.LastUsedBlockType;
}
Direction direction = DirectionFinder.GetDirection( marks );
try {
ShapesLib lib = new ShapesLib( block, marks, player, radius, direction );
switch ( Shape.ToLower() ) {
case "polygon":
lib.DrawRegularPolygon( Points, 18, fill );
break;
case "star":
lib.DrawStar( Points, radius, fill );
break;
case "spiral":
lib.DrawSpiral();
break;
default:
player.Message( "&WUnknown shape" );
CdDraw2D.PrintUsage( player );
lib = null;
return;
}
if ( lib.blockCount > 0 ) {
player.Message( "/Draw2D: Drawing {0} with a size of '{1}' using {2} blocks of {3}",
Shape,
radius,
lib.blockCount,
block.ToString() );
} else {
player.Message( "&WNo direction was set" );
}
lib = null; //get lost
} catch ( Exception e ) {
player.Message( e.Message );
}
}