• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Drawing.DrawOperation类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中fCraft.Drawing.DrawOperation的典型用法代码示例。如果您正苦于以下问题:C# DrawOperation类的具体用法?C# DrawOperation怎么用?C# DrawOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DrawOperation类属于fCraft.Drawing命名空间,在下文中一共展示了DrawOperation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1:

 IBrushInstance IBrush.MakeInstance( Player player, CommandReader cmd, DrawOperation op ) {
     if( ReadParams( cmd ) ) {
         return this;
     } else {
         return null;
     }
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:7,代码来源:DrawOpWithBrush.cs


示例2: NextBlock

 public override Block NextBlock(DrawOperation op) {
     if (op == null) throw new ArgumentNullException("op");
     Block block = op.Map.GetBlock(op.Coords);
     for (int i = 0; i < Blocks.Length; i++) {
         if (block == Blocks[i]) {
             return Block.None;
         }
     }
     return Replacement;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:10,代码来源:ReplaceNotBrush.cs


示例3: Begin

 public bool Begin(Player player, DrawOperation state) {
     if (player == null) throw new ArgumentNullException("player");
     if (state == null) throw new ArgumentNullException("state");
     if (Blocks == null || Blocks.Length == 0) {
         if (player.LastUsedBlockType == Block.None) {
             player.Message("Cannot deduce desired block. Click a block or type out the block name.");
             return false;
         } else {
             Blocks = new[] {
                 player.GetBind(player.LastUsedBlockType)
             };
         }
     }
     return true;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:15,代码来源:NormalBrush.cs


示例4: MakeInstance

        public IBrushInstance MakeInstance( Player player, CommandReader cmd, DrawOperation state ) {
            if( player == null ) throw new ArgumentNullException( "player" );
            if( cmd == null ) throw new ArgumentNullException( "cmd" );
            if( state == null ) throw new ArgumentNullException( "state" );
            List<Block> blocks = new List<Block>();

            while( cmd.HasNext ) {
                Block block;
                if( !cmd.NextBlock( player, true, out block ) ) {
                    return null;
                }
                blocks.Add( block );
            }

            return new NormalBrush( blocks.ToArray() );
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:16,代码来源:NormalBrush.cs


示例5: Begin

        public virtual bool Begin( Player player, DrawOperation op ) {
            if( player == null ) throw new ArgumentNullException( "player" );
            if( op == null ) throw new ArgumentNullException( "op" );

            if( op.Bounds.Volume > 32 * 32 * 32 ) {
                player.Message( "{0} brush: Preparing, please wait...", Brush.Factory.Name );
            }

            noise3D = new PerlinNoise3D( new Random( Seed ) ) {
                Amplitude = 1,
                Frequency = Frequency,
                Octaves = Octaves,
                Persistence = Persistence
            };

            // generate and normalize the raw (float) data
            float[, ,] rawData = new float[op.Bounds.Width, op.Bounds.Length, op.Bounds.Height];
            for( int x = 0; x < op.Bounds.Width; x++ ) {
                for( int y = 0; y < op.Bounds.Length; y++ ) {
                    for( int z = 0; z < op.Bounds.Height; z++ ) {
                        rawData[x, y, z] = noise3D.Compute( x, y, z );
                    }
                }
            }
            Noise.Normalize( rawData, out normMultiplier, out normConstant );
            if( MapAllValues( rawData ) ) {
                Noise.Normalize( rawData, out normMultiplier, out normConstant );
            }

            // create a mapping of raw data to blocks
            int totalBlocks = BlockRatios.Sum();
            int blocksSoFar = BlockRatios[0];
            computedThresholds = new float[Blocks.Length];
            computedThresholds[0] = 0;
            for( int i = 1; i < Blocks.Length; i++ ) {
                float desiredCoverage = blocksSoFar / (float)totalBlocks;
                computedThresholds[i] = Noise.FindThreshold( rawData, desiredCoverage );
                blocksSoFar += BlockRatios[i];
            }
            return true;
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:41,代码来源:AbstractPerlinNoiseBrush.cs


示例6: MakeInstance

        public IBrushInstance MakeInstance( Player player, CommandReader cmd, DrawOperation op ) {
            if( player == null ) throw new ArgumentNullException( "player" );
            if( cmd == null ) throw new ArgumentNullException( "cmd" );
            if( op == null ) throw new ArgumentNullException( "op" );

            if( cmd.HasNext ) {
                Block block, altBlock;
                if( !cmd.NextBlock( player, true, out block ) ) return null;
                if( cmd.HasNext ) {
                    if( !cmd.NextBlock( player, true, out altBlock ) ) return null;
                } else {
                    altBlock = Block.None;
                }
                Block1 = block;
                Block2 = altBlock;

            } else if( Block1 == Block.None ) {
                player.Message( "{0}: Please specify one or two blocks.", Factory.Name );
                return null;
            }

            return new CheckeredBrush( this );
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:23,代码来源:CheckeredBrush.cs


示例7: RaiseEndedEvent

 protected static void RaiseEndedEvent( DrawOperation op ) {
     var h = Ended;
     if( h != null ) h( null, new DrawOperationEventArgs( op ) );
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:4,代码来源:DrawOperation.cs


示例8: RaiseBeganEvent

 protected static void RaiseBeganEvent( DrawOperation op ) {
     var h = Began;
     if( h != null ) h( null, new DrawOperationEventArgs( op ) );
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:4,代码来源:DrawOperation.cs


示例9: RaiseBeginningEvent

 // Returns false if cancelled
 protected static bool RaiseBeginningEvent( DrawOperation op ) {
     var h = Beginning;
     if( h == null ) return true;
     var e = new DrawOperationBeginningEventArgs( op );
     h( null, e );
     return !e.Cancel;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:8,代码来源:DrawOperation.cs


示例10: MakeInstance

        public IBrushInstance MakeInstance( Player player, CommandReader cmd, DrawOperation state ) {
            if( player == null ) throw new ArgumentNullException( "player" );
            if( cmd == null ) throw new ArgumentNullException( "cmd" );
            if( state == null ) throw new ArgumentNullException( "state" );

            List<Block> blocks = new List<Block>();
            List<int> blockRatios = new List<int>();
            while( cmd.HasNext ) {
                int ratio;
                Block block;
                if( !cmd.NextBlockWithParam( player, true, out block, out ratio ) ) return null;
                if( ratio < 1 || ratio > MaxRatio ) {
                    player.Message( "Cloudy brush: Invalid block ratio ({0}). Must be between 1 and {1}.",
                                    ratio, MaxRatio );
                    return null;
                }
                blocks.Add( block );
                blockRatios.Add( ratio );
            }

            if( blocks.Count == 0 ) {
                if( Blocks.Length == 0 ) {
                    player.Message( "{0} brush: Please specify at least one block.", Factory.Name );
                    return null;
                } else {
                    return new CloudyBrush( this );
                }
            } else if( blocks.Count == 1 ) {
                return new CloudyBrush( blocks[0], blockRatios[0] );
            } else {
                return new CloudyBrush( blocks.ToArray(), blockRatios.ToArray() );
            }
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:33,代码来源:CloudyBrush.cs


示例11: Begin

 public bool Begin( Player player, DrawOperation op ) {
     if( player == null ) throw new ArgumentNullException( "player" );
     if( op == null ) throw new ArgumentNullException( "op" );
     op.Context |= BlockChangeContext.Replaced;
     return ReplacementInstance.Begin( player, op );
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:6,代码来源:ReplaceBrushBrush.cs


示例12:

 bool IBrushInstance.Begin( Player player, DrawOperation op )
 {
     return true;
 }
开发者ID:GlennMR,项目名称:800craft,代码行数:4,代码来源:DrawOpWithBrush.cs


示例13: Begin

 public bool Begin(Player player, DrawOperation op) {
     if (player == null)
         throw new ArgumentNullException("player");
     if (op == null)
         throw new ArgumentNullException("op");
     if (Blocks == null || Blocks.Length == 0) {
         throw new InvalidOperationException("No blocks given.");
     }
     if (Replacement == Block.None) {
         if (player.LastUsedBlockType == Block.None) {
             player.Message("Cannot deduce desired replacement block. Click a block or type out the block name.");
             return false;
         } else {
             Replacement = player.GetBind(player.LastUsedBlockType);
         }
     }
     op.Context |= BlockChangeContext.Replaced;
     return true;
 }
开发者ID:Magi1053,项目名称:ProCraft,代码行数:19,代码来源:ReplaceBrush.cs


示例14: Begin

 public bool Begin( Player player, DrawOperation op ) {
     if( player == null ) throw new ArgumentNullException( "player" );
     if( op == null ) throw new ArgumentNullException( "op" );
     if( Blocks == null || Blocks.Length == 0 ) {
         throw new InvalidOperationException( "No blocks given." );
     }
     return true;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:8,代码来源:RandomBrush.cs


示例15: NextBlock

 public Block NextBlock(DrawOperation state) {
     if (state == null) throw new ArgumentNullException("state");
     if (state.AlternateBlockIndex < Blocks.Length) {
         return Blocks[state.AlternateBlockIndex];
     } else {
         return Block.None;
     }
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:8,代码来源:NormalBrush.cs


示例16: DrawOperationBegin

 //copy-paste from BuildingCommands
 private static void DrawOperationBegin(Player player, Command cmd, DrawOperation op)
 {
     IBrushInstance instance = player.Brush.MakeInstance(player, cmd, op);
     if (instance != null)
     {
         op.Brush = instance;
         player.SelectionStart(op.ExpectedMarks, new SelectionCallback(DrawOperationCallback), op, new Permission[] { Permission.DrawAdvanced });
         player.Message("{0}: Click {1} blocks or use &H/Mark&S to make a selection.", new object[] { op.Description, op.ExpectedMarks });
     }
 }
开发者ID:Rhinovex,项目名称:LegendCraft,代码行数:11,代码来源:MathCommands.cs


示例17: MakeInstance

        public IBrushInstance MakeInstance( Player player, CommandReader cmd, DrawOperation op ) {
            if( player == null ) throw new ArgumentNullException( "player" );
            if( cmd == null ) throw new ArgumentNullException( "cmd" );
            if( op == null ) throw new ArgumentNullException( "op" );

            if( cmd.HasNext ) {
                Block block;
                if( !cmd.NextBlock( player, false, out block ) ) return null;

                string brushName = cmd.Next();
                if( brushName == null || !CommandManager.IsValidCommandName( brushName ) ) {
                    player.Message( "ReplaceBrush usage: &H/Brush rb <Block> <BrushName>" );
                    return null;
                }
                IBrushFactory brushFactory = BrushManager.GetBrushFactory( brushName );

                if( brushFactory == null ) {
                    player.Message( "Unrecognized brush \"{0}\"", brushName );
                    return null;
                }

                IBrush replacement = brushFactory.MakeBrush( player, cmd );
                if( replacement == null ) {
                    return null;
                }
                Block = block;
                Replacement = replacement;
            }

            ReplacementInstance = Replacement.MakeInstance( player, cmd, op );
            if( ReplacementInstance == null ) return null;

            return new ReplaceBrushBrush( this );
        }
开发者ID:fragmer,项目名称:fCraft,代码行数:34,代码来源:ReplaceBrushBrush.cs


示例18: NextBlock

 public Block NextBlock( DrawOperation op ) {
     if( op == null ) throw new ArgumentNullException( "op" );
     Block block = op.Map.GetBlock( op.Coords );
     if( block == Block ) {
         return ReplacementInstance.NextBlock( op );
     }
     return Block.None;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:8,代码来源:ReplaceBrushBrush.cs


示例19: DrawOperationEventArgs

 public DrawOperationEventArgs( DrawOperation drawOp ) {
     DrawOp = drawOp;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:3,代码来源:DrawOperation.cs


示例20: Begin

 public bool Begin( Player player, DrawOperation state ) {
     if( player == null ) throw new ArgumentNullException( "player" );
     if( state == null ) throw new ArgumentNullException( "state" );
     return true;
 }
开发者ID:fragmer,项目名称:fCraft,代码行数:5,代码来源:CheckeredBrush.cs



注:本文中的fCraft.Drawing.DrawOperation类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Events.ChatSendingEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# fCraft.World类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap