public Pipeline Finally <TBlock>(int threadCount = 1, BlockArgs args = null) where TBlock : FinalBlock <TOutput>, new() { if (args == null) { args = new BlockArgs(); } args.ThreadCount = threadCount; return(Finally <TBlock>(args)); }
public TBlock Then <TBlock>(int threadCount = 1, int bufferCapacity = int.MaxValue, BlockArgs args = null) where TBlock : Block, IConsumer <TOutput>, new() { if (args == null) { args = new BlockArgs(); } args.ThreadCount = threadCount; args.BufferCapacity = bufferCapacity; return(Then <TBlock>(args)); }
public static TBlock First <TBlock>(int threadCount = 1, int bufferCapacity = int.MaxValue, BlockArgs args = null) where TBlock : Block, new() { if (args == null) { args = new BlockArgs(); } args.ThreadCount = threadCount; args.BufferCapacity = bufferCapacity; return(First <TBlock>(args)); }
public static TBlock First <TBlock>(BlockArgs args) where TBlock : Block, new() { TBlock block = new TBlock(); Pipeline pipeline = new Pipeline(); block.Pipeline = pipeline; block.Arguments = args; pipeline.Add(block); return(block); }
public TBlock Then <TBlock>(BlockArgs args) where TBlock : Block, IConsumer <TOutput>, new() { TBlock block = new TBlock() { Pipeline = Pipeline, Source = Output, Arguments = args }; Pipeline.Add(block); return(block); }
private void PlayerBlock(Player player, BlockArgs e, bool sendPlayer) { if (sendPlayer) { if (!player.level.SetBlock(player, e.X, e.Y, e.Z, e.Type)) { Protocol.BlockPacket(e.X, e.Y, e.Z, player.level[e.X, e.Y, e.Z]).Send(player); } } else { player.level.PlayerSetBlock(player, e.X, e.Y, e.Z, e.Type); } }
public Pipeline Finally <TBlock>(BlockArgs args) where TBlock : FinalBlock <TOutput>, new() { TBlock block = new TBlock() { Pipeline = Pipeline, Source = Output, Arguments = args }; Pipeline.Add(block); Pipeline.Start(); return(block); }
public Pipeline Start() { if (_isRunning) { throw new InvalidOperationException("Pipeline is already running"); } _tasks = new List <Task>(); foreach (Block block in _blocks) { BlockArgs config = block.Arguments; for (int i = 0; i < config.ThreadCount; i++) { Task task = Task.Factory.StartNew(() => block.Run(), _tokenSource.Token, TaskCreationOptions.LongRunning, TaskScheduler.Default); _tasks.Add(task); } } _isRunning = true; return(this); }
private void Grid3D_OnTileAdded(object sender, BlockArgs e) { UpdateResources(CurrentResources - e.ObjectData.Cost); }
public override void Initialize(BlockArgs args) { }
public abstract void Initialize(BlockArgs args);