Beispiel #1
0
        public GameService(
            IListener listener,
            ILogger <GameService> logger,
            GameState state,
            PacketProcessExecutor packetProcessExecutor,
            IEnumerable <ILoopTask> loopTasks,
            IDbConnection dbConnection,
            DatabaseOptions dbOptions
            )
        {
            _logger    = logger;
            _loopTasks = loopTasks?
                         .GroupBy(x => x.Order)
                         .OrderBy(x => x.Key)
                         .Select(x => new Tuple <int, ILoopTask[]>(x.Key, x.ToArray()))
                         .ToArray() ?? throw new ArgumentNullException(nameof(LoopTasks));

            _state    = state ?? throw new ArgumentNullException(nameof(state));
            _listener = listener ?? throw new ArgumentNullException(nameof(listener));
            _packetProcessExecutor = packetProcessExecutor ?? throw new ArgumentNullException(nameof(packetProcessExecutor));
            _db        = dbConnection ?? throw new ArgumentNullException(nameof(dbConnection));
            _dbOptions = dbOptions ?? throw new ArgumentNullException(nameof(dbOptions));

            _listener.OnClientConnect    += Listener_OnClientConnect;
            _listener.OnClientData       += Listener_OnClientData;
            _listener.OnClientDisconnect += Listener_OnClientDisconnect;
        }
 public ProcessIncommingPackets(PacketProcessExecutor packetProcessExecutor)
 {
     _packetProcessExecutor = packetProcessExecutor;
 }