Ejemplo n.º 1
0
        private void Form1_MouseDown(object sender, MouseEventArgs e)//MouseEventArgs e 滑鼠按下後的位置資訊存取區
        {
            Piece piece = game.PlaceAPiece(e.X, e.Y);

            if (piece != null)
            {
                this.Controls.Add(piece);

                if (game.Winner == PieceType.BLACK)
                {
                    result = MessageBox.Show("黑色獲勝", "遊戲結束", MessageBoxButtons.OK);
                }
                else if (game.Winner == PieceType.WHITE)
                {
                    result = MessageBox.Show("白色獲勝", "遊戲結束", MessageBoxButtons.OK);
                }
                if (result == DialogResult.OK)
                {
                    GameRestart();
                    board.ReStart();
                    game.ReStart();
                    result = new DialogResult();
                }
            }
        }