Exemplo n.º 1
0
        public void StartServer()
        {
#if !DISABLE_TCP
            var port      = this.GetIntConstant("listenPort").GetValueOrDefault(9001);
            var ipAddress = this.GetStringConstant("hostAddress").ConvertToIpAddress();
            NetMgr.Server.Startup(port, ipAddress);
#endif
            LoopProcessor.Start();
            EventMgr.ThrowEvent <OnGameStart>(this);
        }
Exemplo n.º 2
0
        protected override async Task ExecuteAsync(CancellationToken stoppingToken)
        {
            ProcessingContext    processingContext = new ProcessingContext(stoppingToken);
            List <LoopProcessor> loopProcessors    = new List <LoopProcessor>();
            var innerProcessors = _serviceProvider.GetServices <IProcessor>();
            var loggerFactory   = _serviceProvider.GetService <ILoggerFactory>();

            foreach (var innerProcessor in innerProcessors)
            {
                LoopProcessor processor = new LoopProcessor(innerProcessor, loggerFactory);
                loopProcessors.Add(processor);
            }
            var tasks = loopProcessors.Select(p => p.Process(processingContext));

            _compositeTask = Task.WhenAll(tasks);
            await _compositeTask;
        }
Exemplo n.º 3
0
 public void StopServer()
 {
     LoopProcessor.Stop();
     NetMgr.Server.Shutdown(string.Empty);
     EventMgr.ThrowEvent(this, new OnGameStop());
 }