public Player GetPlayer() { try { IDraughtsServiceCallback callback = OperationContext.Current.GetCallbackChannel<IDraughtsServiceCallback>(); if (!_subscribers.Contains(callback)) _subscribers.Add(callback); } catch { } if (this._blackPlayer == null) { this._blackPlayer = new Player(PieceColor.Black); return this._blackPlayer; } if (this._whitePlayer == null) { this._whitePlayer = new Player(PieceColor.White); this._canInitialize = true; return this._whitePlayer; } return null; }
public void ChangePlayer() { if (this._currentPlayer == this._whitePlayer) this._currentPlayer = this._blackPlayer; else this._currentPlayer = this._whitePlayer; DrawingManager.Instance.DrawableObjects.Add(this.CurrentPlayerLabel); }
public void SetWinner(Player winner) { this._winner = winner; DrawingManager.Instance.DrawableObjects.Add(this.WinnerLabel); }
private void InitializePlayers() { this._whitePlayer = new Player(PieceColor.White); this._blackPlayer = new Player(PieceColor.Black); this._currentPlayer = this._whitePlayer; }
private List<PieceMovement> GetPlayerValidMovements(Player player) { List<PieceMovement> validMovements = new List<PieceMovement>(); for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { Piece squarePiece = _draughts.Board.Squares[i, j].Piece; if (squarePiece != null && squarePiece.Color == player.Color) validMovements.AddRange(this.GetValidMovements(squarePiece)); } } return validMovements; }