示例#1
0
        public override void OnPieceDropped(SquareViewModel targetSquare)
        {
            if (practiceBoardService.IsComputerTurn())
            {
                return;
            }

            base.OnPieceDropped(targetSquare);
        }
示例#2
0
        protected override void OnSelectionChanged(SquareViewModel oldSquare, SquareViewModel newSquare)
        {
            if (practiceBoardService.IsComputerTurn())
            {
                return;
            }

            base.OnSelectionChanged(oldSquare, newSquare);
        }
示例#3
0
        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();
        }
示例#4
0
 public virtual void OnPieceDropped(SquareViewModel targetSquare)
 {
     selectedSquare = targetSquare;
     NotifyPropertyChanged("SelectedSquare");
 }
示例#5
0
 protected virtual void OnSelectionChanged(SquareViewModel oldSquare, SquareViewModel newSquare)
 {
 }