async Task CreateObjects(CanvasControl sender) { TetrisGrid grid = new TetrisGrid(200, 100); TetrisBlockHolder holder = new TetrisBlockHolder(-(((float)Tetrimino.Size.Width * 5)), 0, grid); TetrisBag bag = new TetrisBag(new Random(), grid.Width, 0, grid); TetrisScoreKeeper keeper = new TetrisScoreKeeper(0, holder.Height, holder); handler = new TetrisBlockHandler(grid, holder, bag, keeper, handleWin, handleLoss); drawables.Add(handler); handler.start(); }
public TetrisBlockHandler(TetrisGrid grid, TetrisBlockHolder holder, TetrisBag bag, TetrisScoreKeeper keeper, System.Action winCallback, System.Action loseCallback) { this.grid = grid; this.holder = holder; this.bag = bag; this.scoreKeeper = keeper; this.winCallback = winCallback; this.loseCallback = loseCallback; winCallback(); }