Esempio n. 1
0
        public Task StartAsync(CancellationToken cancellationToken)
        {
            IGameNotificationManager gameNotificationManager = _serviceProvider.GetService <IGameNotificationManager>();

            _gameLoop = new GameLoop(100);
            Thread t = new Thread(() => _gameLoop.Start(_serviceProvider, gameNotificationManager).ConfigureAwait(false));

            t.Start();

            return(Task.CompletedTask);
        }
Esempio n. 2
0
 public async Task Start(IServiceProvider serviceProvider, IGameNotificationManager gameNotificationManager)
 {
     Game.SetServiceProvider(serviceProvider);
     Game.SetNotificationManager(gameNotificationManager);
     Running = true;
     DateTime previouseLoopTime = DateTime.Now;
     DateTime time; while (Running)
     {
         time = DateTime.Now;
         if ((time - previouseLoopTime).TotalMilliseconds > LoopIntervalMiliseconds)
         {
             previouseLoopTime = time;
             await Game.Instance.Update();
         }
     }
 }
 public EventService(IGameNotificationManager NotificationManager)
 {
     _NotificationManager = NotificationManager;
 }
Esempio n. 4
0
 public void SetNotificationManager(IGameNotificationManager notificationManager)
 {
     _notificationManager = notificationManager;
 }