public void update() { flBricksHolder.Controls.Clear(); int total = stack.getBricks().Count; int totalWidth = flBricksHolder.Width; foreach (Brick b in stack.getBricks()) { int brickWidth = (totalWidth * (10 - total + b.size)) / 10; int diff = totalWidth - brickWidth; BrickView bView = new BrickView(b, callback, this, brickWidth); bView.Margin = new Padding(diff / 2, 0, 0, 0); flBricksHolder.Controls.Add(bView); } }
public void updatePanel() { updateGameView(); selectedBrick.deselect(); selectedBrick = null; if (game.isOver()) { game.stop(); timer.Stop(); DialogResult result = MessageBox.Show("Game Over"); Application.Exit(); } }
public void selectBrick(BrickView brick) { if (this.selectedBrick != null) { selectedBrick.deselect(); } selectedBrick = brick; }
public Boolean validSelection(BrickView brick) { return stack.isValidToBeMoved(brick.getBrick()); }