Exemplo n.º 1
0
        /// <summary>
        /// nhìn trước các nước có thể đi của bên còn lại Khi di chuyển 1 quân cờ
        /// </summary>
        /// <param name="Source"></param>
        /// <param name="Destination"></param>
        /// <param name="cells"></param>
        /// <returns></returns>
        static internal ChessBoard Forwarding(Button Source, Button Destination, ChessBoard chessBoard)
        {
            ChessBoard Board            = ChessBoard.CloneButtonsInfo(chessBoard);
            Button     SourceClone      = Board.cells[Source.Location.X / chessBoard.cells[0, 0].Width, Source.Location.Y / chessBoard.cells[0, 0].Height];
            Button     DestinationClone = Board.cells[Destination.Location.X / chessBoard.cells[0, 0].Width, Destination.Location.Y / chessBoard.cells[0, 0].Height];

            ChessBoard.Chesspiece_Move_forForwarding(SourceClone, DestinationClone, Board);
            ChessBoard.ResetBoderColor(Board);
            Color x;

            if (Source.ForeColor == Color.Black)     // Máy nhìn trước
            {
                x = Color.Red;
            }
            else
            {
                x = Color.Black;
            }

            foreach (Button item in Board.cells)
            {
                if (item.ForeColor == x)
                {
                    ChessBoard.ShowMovement(item, Board);
                }
            }
            return(Board);
        }
Exemplo n.º 2
0
        static internal ChessBoard Forwarding3(Button SourceClone, Button DestinationClone, ChessBoard chessBoardClone, Color color)
        {
            ChessBoard.Chesspiece_Move_forForwarding(SourceClone, DestinationClone, chessBoardClone);
            ChessBoard.ResetBoderColor(chessBoardClone);

            foreach (Button item in chessBoardClone.cells)
            {
                if (item.ForeColor == color)
                {
                    ChessBoard.ShowMovement(item, chessBoardClone);
                }
            }
            return(chessBoardClone);
        }