2021-12-21 22:22:52 +00:00
|
|
|
|
using Microsoft.Extensions.Logging;
|
2021-12-20 23:04:53 +00:00
|
|
|
|
|
2021-12-21 22:22:52 +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>()
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|