private void panelChecker_SelectPiece(object sender, SelectPieceArgs e) { if (_gs.IsWolf) { e.ValidMoves = _gs.GetValidWolfMoves(); } else { e.ValidMoves = _gs.GetValidSheepMoves(e.SelectedPiece); } }
private void UpdateSelected(Pos?selected, bool refresh) { if (_selectedPiece == null && selected == null) { return; } if (selected != null && _selectedPiece != null && selected.Value.Equals(_selectedPiece.Value)) { //click on selected piece // -wolf : do nothing // -sheep : unselect if (_gameState.IsWolf) { return; } _selectedPiece = null; } else { _selectedPiece = selected; } if (_selectedPiece != null) { if (SelectPiece != null) { SelectPieceArgs e = new SelectPieceArgs(_selectedPiece.Value); SelectPiece(this, e); _validMoves = e.ValidMoves; } } else { _validMoves = null; } if (refresh) { Invalidate(); } }