public FactoriesController(IFactoryCreateService factoryCreateService, IFactoryManager factoryManager, IHubContext <FactoryHub, IFactoryHub> hubContext, ICraftingService craftingService, ILogger <FactoriesController> logger) { _logger = logger; _factoryCreateService = factoryCreateService; _factoryManager = factoryManager; _hubContext = hubContext; _craftingService = craftingService; }
public FactoryManager(ILogger <FactoryManager> logger, IFactoryCreateService factoryCreateService, IHubContext <FactoryHub, IFactoryHub> hubContext) { _logger = logger; _factoryCreateService = factoryCreateService; Factories = Enumerable.Range(1, 3) .Select(index => _factoryCreateService.CreateNewFactory($"Fabryka {index}")).ToList(); _logger.LogInformation($"Created {Factories.Count} factories."); _hubContext = hubContext; _timerService = new TimerService(); _timerService.Start(1000, OnFactoryTick); }