public override void OnPieceDropped(SquareViewModel targetSquare) { if (practiceBoardService.IsComputerTurn()) { return; } base.OnPieceDropped(targetSquare); }
protected override void OnSelectionChanged(SquareViewModel oldSquare, SquareViewModel newSquare) { if (practiceBoardService.IsComputerTurn()) { return; } base.OnSelectionChanged(oldSquare, newSquare); }
private void OnSquarePressed(SquareViewModel squareVM) { // the square does not belong to our bord if (BoardViewModel.Squares.IndexOf(squareVM) == -1) { return; } ChessPieceViewModel pieceViewModel = BoardViewModel.GetPiece(squareVM.Coordinate); if (pieceViewModel != null || PiecesPaletteViewModel.SelectedPiece == null) { BoardViewModel.RemovePiece(pieceViewModel); editorBoardService.SetPiece(squareVM.Coordinate, null); } else { BoardViewModel.AddPiece(new ChessPieceViewModel(PiecesPaletteViewModel.SelectedPiece.Piece, squareVM.Coordinate)); editorBoardService.SetPiece(squareVM.Coordinate, PiecesPaletteViewModel.SelectedPiece.Piece); } IsBoardValid = editorBoardService.AcceptEditedPosition(); }
public virtual void OnPieceDropped(SquareViewModel targetSquare) { selectedSquare = targetSquare; NotifyPropertyChanged("SelectedSquare"); }
protected virtual void OnSelectionChanged(SquareViewModel oldSquare, SquareViewModel newSquare) { }