refactor: move event disptacher into service locator
This commit is contained in:
@@ -7,8 +7,8 @@
|
||||
#include "../Factories/AbnormalEffectFactory.h"
|
||||
#include "../../../Events/AbnormalEffectChangedEvent.h"
|
||||
#include "../../../Events/HeroDeletedEvent.h"
|
||||
#include "../../../Events/EventDispatcher.h"
|
||||
#include "../GameStructs/NetworkHandlerWrapper.h"
|
||||
#include "../../../Services/ServiceLocator.h"
|
||||
|
||||
using namespace L2Bot::Domain;
|
||||
|
||||
@@ -27,12 +27,6 @@ namespace Interlude
|
||||
AbnormalEffectRepository(const AbnormalEffectFactory& factory) :
|
||||
m_Factory(factory)
|
||||
{
|
||||
EventDispatcher::GetInstance().Subscribe(AbnormalEffectChangedEvent::name, [this](const Event& evt) {
|
||||
OnEffectToggled(evt);
|
||||
});
|
||||
EventDispatcher::GetInstance().Subscribe(HeroDeletedEvent::name, [this](const Event& evt) {
|
||||
OnHeroDeleted(evt);
|
||||
});
|
||||
}
|
||||
|
||||
AbnormalEffectRepository() = delete;
|
||||
@@ -41,6 +35,16 @@ namespace Interlude
|
||||
Reset();
|
||||
}
|
||||
|
||||
void Init() override
|
||||
{
|
||||
ServiceLocator::GetInstance().GetEventDispatcher()->Subscribe(AbnormalEffectChangedEvent::name, [this](const Event& evt) {
|
||||
OnEffectToggled(evt);
|
||||
});
|
||||
ServiceLocator::GetInstance().GetEventDispatcher()->Subscribe(HeroDeletedEvent::name, [this](const Event& evt) {
|
||||
OnHeroDeleted(evt);
|
||||
});
|
||||
}
|
||||
|
||||
void Reset() override
|
||||
{
|
||||
std::shared_lock<std::shared_timed_mutex>(m_Mutex);
|
||||
|
Reference in New Issue
Block a user