Selector/Selector.Event/Consumers/UserEventFirerFactory.cs

31 lines
848 B
C#
Raw Normal View History

using Microsoft.Extensions.Logging;
2021-12-20 23:04:53 +00:00
namespace Selector.Events
2021-12-20 23:04:53 +00:00
{
public interface IUserEventFirerFactory
{
public Task<UserEventFirer> Get(IPlayerWatcher watcher = null);
}
public class UserEventFirerFactory: IUserEventFirerFactory
{
private readonly ILoggerFactory LoggerFactory;
private readonly UserEventBus UserEvent;
public UserEventFirerFactory(ILoggerFactory loggerFactory, UserEventBus userEvent)
{
LoggerFactory = loggerFactory;
UserEvent = userEvent;
}
public Task<UserEventFirer> Get(IPlayerWatcher watcher = null)
{
return Task.FromResult(new UserEventFirer(
watcher,
UserEvent,
LoggerFactory.CreateLogger<UserEventFirer>()
));
}
}
}