Ejemplo n.º 1
0
        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();
            }
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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();
        }