private void SquareClicked(object sender, BoardTileClickedArgs e) { IChessPiece piece = Board[e.ColIndex, e.RowIndex]; if (CanPlayerSelectPiece(piece)) { ChessBoardUI.RemoveMoveIndicators(); SelectedPiece = piece; SelectedPiece.MarkValidMovesWithIndicator(); return; } if (SelectedPiece != null) { (int, int)fromCoords = SelectedPiece.Coords; bool moved = SelectedPiece.AttemptMove(e.ColIndex, e.RowIndex); ChessBoardUI.RemoveMoveIndicators(); if (moved) { (int, int)toCoords = SelectedPiece.Coords; game.SendMoveAction(fromCoords, toCoords); } SelectedPiece = null; } }