2018-04-26 02:13:04 -04:00
|
|
|
|
using SharedLibraryCore;
|
2018-08-30 21:53:00 -04:00
|
|
|
|
using SharedLibraryCore.Events;
|
2018-04-26 02:13:04 -04:00
|
|
|
|
using SharedLibraryCore.Interfaces;
|
2018-08-30 21:53:00 -04:00
|
|
|
|
using System.Threading;
|
2018-04-26 02:13:04 -04:00
|
|
|
|
|
|
|
|
|
namespace IW4MAdmin.Application
|
|
|
|
|
{
|
|
|
|
|
class GameEventHandler : IEventHandler
|
|
|
|
|
{
|
2019-05-31 11:17:01 -04:00
|
|
|
|
readonly ApplicationManager Manager;
|
2018-04-26 02:13:04 -04:00
|
|
|
|
public GameEventHandler(IManager mgr)
|
|
|
|
|
{
|
2019-05-31 11:17:01 -04:00
|
|
|
|
Manager = (ApplicationManager)mgr;
|
2018-04-26 02:13:04 -04:00
|
|
|
|
}
|
|
|
|
|
|
2018-09-04 13:40:29 -04:00
|
|
|
|
public void AddEvent(GameEvent gameEvent)
|
2018-04-26 02:13:04 -04:00
|
|
|
|
{
|
2019-09-26 17:08:49 -04:00
|
|
|
|
#if DEBUG
|
|
|
|
|
ThreadPool.GetMaxThreads(out int workerThreads, out int n);
|
|
|
|
|
ThreadPool.GetAvailableThreads(out int availableThreads, out int m);
|
|
|
|
|
gameEvent.Owner.Logger.WriteDebug($"There are {workerThreads - availableThreads} active threading tasks");
|
|
|
|
|
#endif
|
2019-05-31 11:17:01 -04:00
|
|
|
|
Manager.OnServerEvent?.Invoke(gameEvent.Owner, new GameEventArgs(null, false, gameEvent));
|
2018-04-26 02:13:04 -04:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|