コード例 #1
0
        public IGameBuilderSetStartingPlayer SecondPlayerSet(IPlayerType playerType)
        {
            var player = playerType.Player;

            _players = _players.Add(player);
            _startingPlayerMapper = _startingPlayerMapper.Add(StartingPlayer.As().SecondPlayer(), player);
            return(this);
        }
コード例 #2
0
        private Brush GetBrushForPlayerType(IPlayerType playerType)
        {
            if (playerType.GetType() == typeof(BluePlayer))
            {
                return(new SolidBrush(Color.Blue));
            }
            else if (playerType.GetType() == typeof(GreenPlayer))
            {
                return(new SolidBrush(Color.Green));
            }
            else if (playerType.GetType() == typeof(RedPlayer))
            {
                return(new SolidBrush(Color.Red));
            }
            else if (playerType.GetType() == typeof(YellowPlayer))
            {
                return(new SolidBrush(Color.Yellow));
            }

            return(new SolidBrush(Color.Gray));
        }
コード例 #3
0
 private static IGameBuilder BuildGameBuilder(IStartingPlayerMapper startingPlayerMapper = null,
                                              IPlayers players           = null,
                                              IBoardService boardService = null,
                                              int?size = null,
                                              IPlayerType firstPlayerType    = null,
                                              IPlayerType secondPlayerType   = null,
                                              IStartingPlayer startingPlayer = null)
 {
     startingPlayerMapper = startingPlayerMapper ?? new MockStartingPlayerMapper().AddReturnsItself();
     players          = players ?? new MockPlayers().AddReturnsItself();
     boardService     = boardService ?? new MockBoardService();
     size             = size ?? 3;
     firstPlayerType  = firstPlayerType ?? new MockPlayerType();
     secondPlayerType = secondPlayerType ?? new MockPlayerType();
     startingPlayer   = startingPlayer ?? new MockStartingPlayer();
     return(GameBuilder
            .Initialize(startingPlayerMapper, players, boardService)
            .WithBoardSize(size.Value)
            .FirstPlayerSet(firstPlayerType)
            .SecondPlayerSet(secondPlayerType)
            .Set(startingPlayer));
 }
コード例 #4
0
ファイル: GameSession.cs プロジェクト: PGBSNH19/ludo
 private bool PlayerOfTypeExists(IPlayerType playerType)
 {
     return(Players.Any(x => x.PlayerType.GetType() == playerType.GetType()));
 }
コード例 #5
0
ファイル: Player.cs プロジェクト: PGBSNH19/ludo
 public Player(IPlayerType playerType)
 {
     this.PlayerType = playerType;
 }
コード例 #6
0
 public void AddToGame(Guid gameGUID, IPlayerType playerType)
 {
     GameSessionGUID = gameGUID;
     PlayerType      = playerType;
     State           = PlayerState.Playing;
 }