Пример #1
0
        public GameConnection JoinGame(GameService gameService, string nickname, int gameSize)
        {
            GameConfiguration config     = GameConfiguration.FromNumberOfPlayers(gameSize);
            GameConnection    connection = null;

            while (connection == null)
            {
                HostedGame game = games.GetOrAdd(config, c => new HostedGame(c));

                if (game.Started)
                {
                    games.TryUpdate(config, new HostedGame(config), game);
                }
                else
                {
                    connection = game.TryAddPlayer(gameService, nickname);
                }
            }

            return(connection);
        }
Пример #2
0
 internal GameConnection(GameService client, Player player, HostedGame hostedGame)
 {
     this.Client     = client;
     this.Player     = player;
     this.hostedGame = hostedGame;
 }
Пример #3
0
 internal GameConnection(GameService client, Player player, HostedGame hostedGame)
 {
     this.Client = client;
     this.Player = player;
     this.hostedGame = hostedGame;
 }