public void SendInitializeCommonPiece(BoardPosition position, PieceColor color)
 {
     foreach (var subscriber in this._subscribers)
     {
         subscriber.InitializeCommonPiece(position, color);
     }
 }
        private void CheckPieceMovement(MouseState mouseState)
        {
            if (this._selectedPiece == null || this._lastMouseState == null)
                return;

            if (this._lastMouseState.LeftButton == ButtonState.Pressed && mouseState.LeftButton == ButtonState.Released)
            {
                int j = (mouseState.X + 2) / 58;
                int i = (mouseState.Y + 2) / 58;
                BoardPosition position = new BoardPosition(i, j);

                if (position.I < 8 && position.J < 8 && position.I >= 0 && position.J >= 0)
                {
                    Square originalSquare = this._squares[this._selectedPiece.BoardPosition.I, this._selectedPiece.BoardPosition.J];
                    Square hoveringSquare = this._squares[position.I, position.J];

                    bool valid = RulesValidator.Instance.ValidateNewPosition(this._selectedPiece, originalSquare, hoveringSquare);
                    if (valid)
                    {
                        for (i = 0; i < 8; i++)
                            for (j = 0; j < 8; j++)
                                if (this._squares[i, j].Valid)
                                {
                                    this._squares[i, j].Valid = false;
                                    DrawingManager.Instance.DrawableObjects.Add(this._squares[i, j]);
                                }

                        RulesValidator.Instance.ApplyMovement(this._selectedPiece, originalSquare, hoveringSquare);
                    }
                }
            }
        }
        public QueenPiece(PieceColor color, BoardPosition boardPosition)
        {
            this._color = color;
            this._boardPosition = boardPosition;
            this._blackImage = Image.FromFile(@"E:\Projetos\C#\ucs-xna-rmi-draughts\UCS.XNA.Draughts\UCS.Forms.Draughts\Resources\BlackQueen.png");
            this._whiteImage = Image.FromFile(@"E:\Projetos\C#\ucs-xna-rmi-draughts\UCS.XNA.Draughts\UCS.Forms.Draughts\Resources\WhiteQueen.png");

            this.InitializeValidMovementsList();
        }
        public Square this[BoardPosition boardPosition]
        {
            get
            {
                if (boardPosition.I >= 0 && boardPosition.J >= 0 && boardPosition.I < 8 && boardPosition.J < 8)
                    return this._squares[boardPosition.I, boardPosition.J];

                return null;
            }
        }
 public PieceMovement(BoardPosition boardMovement, BoardPosition jumpPosition)
 {
     this._boardMovement = boardMovement;
     this._jumpPosition = jumpPosition;
 }
 public PieceMovement(BoardPosition boardMovement)
 {
     this._boardMovement = boardMovement;
     this._jumpPosition = null;
 }
        private void InitializeSquares()
        {
            this._squares = new Square[8, 8];

            for (int i = 0; i < 8; i++)
            {
                for (int j = 0; j < 8; j++)
                {
                    BoardPosition position = new BoardPosition(i, j);
                    SquareType type = (i + j) % 2 == 0 ? SquareType.White : SquareType.Black;

                    this._squares[i, j] = new Square(type, position);
                }
            }
        }
 public Square(SquareType type, BoardPosition boardPosition)
 {
     this._type = type;
     this._boardPosition = boardPosition;
 }