コード例 #1
0
ファイル: Board.cs プロジェクト: rowanlittlefield/SharpChess
 public Board(string[] gridLines)
 {
     _cursor        = new Cursor(Board.GridLength);
     _grid          = GridBuilder.CreateGrid(gridLines);
     PieceSelection = NullPieceSelection.GetInstance();
     _view          = new BoardView(this);
     IsFlipped      = false;
 }
コード例 #2
0
ファイル: Board.cs プロジェクト: rowanlittlefield/SharpChess
 private Board(Piece[,] grid)
 {
     _cursor        = new Cursor(Board.GridLength);
     _grid          = GridBuilder.CloneGrid(grid);
     PieceSelection = NullPieceSelection.GetInstance();
     _view          = new BoardView(this);
     IsFlipped      = false;
 }
コード例 #3
0
ファイル: Board.cs プロジェクト: rowanlittlefield/SharpChess
        private void _selectCursorPiece(PieceColor currentPlayer)
        {
            var coordinates          = _cursor.getCoordinates();
            var piece                = _grid[coordinates.Item1, coordinates.Item2];
            var isCurrentPlayerPiece = piece.Color == currentPlayer;

            if (isCurrentPlayerPiece)
            {
                var validMoveOptions = _filterValidMoves(piece);
                PieceSelection = new PieceSelection(piece, validMoveOptions);
            }
            else
            {
                PieceSelection = NullPieceSelection.GetInstance();
            }
        }