private void newGameBarItem_Click(object sender, EventArgs e) { // Pause the game for the Exit Dialog gameTimer.Stop(); if (AbandonGame()) { if (game.IsGameStarted) { game.QuitGame(); game = new BlocksGame(); } nextPieceForm.BGame = game; game.StartGame(); gridBoard.Invalidate(); gridBoard.Update(); SetPauseBarItemStatus(); } // Restart (or start) the game, if necessary if (game.IsGameRunning) { gameTimer.Start(); } }
public NextPieceForm(BlocksGame bGame, BlocksForm bForm) { InitializeComponent(); game = bGame; gridNextPiece.AllowDragSelectedCols = false; gridNextPiece.AllowDragSelectedRows = false; gridNextPiece.AllowSelection = GridSelectionFlags.None; gridNextPiece.ResizeColsBehavior = GridResizeCellsBehavior.None; gridNextPiece.ResizeRowsBehavior = GridResizeCellsBehavior.None; form = bForm; this.Left = bForm.Right; this.Top = bForm.Top; }
public BlocksForm() { InitializeComponent(); game = new BlocksGame(); SetPauseBarItemStatus(); // Disable Grid interaction gridBoard.AllowDragSelectedCols = false; gridBoard.AllowDragSelectedRows = false; gridBoard.AllowSelection = GridSelectionFlags.None; gridBoard.ResizeColsBehavior = GridResizeCellsBehavior.None; gridBoard.ResizeRowsBehavior = GridResizeCellsBehavior.None; // Create Next Piece display nextPieceForm = new NextPieceForm(game, this); nextPieceForm.TopLevel = false; this.nextPiecePanel.Controls.Add(nextPieceForm.gridNextPiece); nextPieceForm.gridNextPiece.Dock = DockStyle.Fill; this.Focus(); }