Example #1
0
 static void WriteCallback( Player player, Vector3I[] marks, object tag )
 {
     Block block = new Block();
     string sentence = ( string )tag;
     //block bugfix kinda
     if ( player.LastUsedBlockType == Block.Undefined ) {
         block = Block.Stone;
     } else {
         block = player.LastUsedBlockType;
     }
     Direction direction = DirectionFinder.GetDirection( marks );
     try {
         FontHandler render = new FontHandler( block, marks, player, direction ); //create new instance
         render.CreateGraphicsAndDraw( sentence ); //render the sentence
         if ( render.blockCount > 0 ) {
             player.Message( "/Write (Size {0}, {1}: Writing '{2}' using {3} blocks of {4}",
                 player.font.Size,
                 player.font.FontFamily.Name,
                 sentence, render.blockCount,
                 block.ToString() );
         } else {
             player.Message( "&WNo direction was set" );
         }
         render = null; //get lost
     } catch ( Exception e ) {
         player.Message( e.Message );
         Logger.Log( LogType.Error, "WriteCommand: " + e );
     }
 }