Ejemplo n.º 1
0
 public SimulationServerController(
     ILogger logger,
     PlayerConnectionManager playerConnections,
     GameWorlds worlds)
 {
     this._logger            = logger ?? throw new ArgumentNullException(nameof(logger));
     this._playerConnections = playerConnections ?? throw new ArgumentNullException(nameof(playerConnections));
     this._worlds            = worlds ?? throw new ArgumentNullException(nameof(worlds));
 }
Ejemplo n.º 2
0
 public ControlPlaneServerController(
     ILogger logger,
     PlayerConnectionManager playerConnections,
     OutgoingServerChannel channelOutgoing,
     GameWorlds worlds)
 {
     this._logger            = logger ?? throw new ArgumentNullException(nameof(logger));
     this._playerConnections = playerConnections ?? throw new ArgumentNullException(nameof(playerConnections));
     this._channelOutgoing   = channelOutgoing ?? throw new ArgumentNullException(nameof(channelOutgoing));
     this._worlds            = worlds ?? throw new ArgumentNullException(nameof(worlds));
 }
Ejemplo n.º 3
0
        public GameServer(
            IServerConfig serverConfig,
            ILogger logger)
        {
            this._serverConfig = serverConfig ?? throw new ArgumentNullException(nameof(serverConfig));
            this._logger       = logger ?? throw new ArgumentNullException(nameof(logger));

            this.Commander = new GameServerCommander(this);

            this._udpTransport = new ServerUdpPacketTransport(
                this._logger,
                serverConfig.NetworkTransport.PacketEncryptor,
                serverConfig.NetworkTransport,
                serverConfig.UdpServer);
            this._outgoingChannel = new OutgoingServerChannel(
                serverConfig.NetworkTransport,
                this._udpTransport,
                serverConfig.NetworkTransport.PacketEncryptor,
                this._logger);

            this._playerConnectionManager = new PlayerConnectionManager(
                this._logger,
                this._serverConfig.PlayerConnection);

            this._gameWorlds = new GameWorlds(
                this._logger,
                this._serverConfig,
                this._outgoingChannel,
                serverConfig.Server.WorldsCapacity);

            this._incomingChannel = new IncomingServerChannel(
                this._udpTransport,
                serverConfig.NetworkTransport.PacketEncryptor,
                new ControlPlaneServerController(
                    this._logger,
                    this._playerConnectionManager,
                    this._outgoingChannel,
                    this._gameWorlds),
                new SimulationServerController(
                    this._logger,
                    this._playerConnectionManager,
                    this._gameWorlds),
                this._logger);

            this._worldLoader = new GameWorldLoader();
        }