quest-wizard/models/events/qw_startdialogueevent.cpp

37 lines
1.0 KiB
C++

#include "models/dialogues/qw_abstractgamedialogue.h"
#include "features/qw_abstractdialoguemanager.h"
#include "qw_startdialogueevent.h"
QWStartDialogueEvent::QWStartDialogueEvent(const std::shared_ptr<QWAbstractGameDialogue> &dialogue) :
ptr_dialogue(dialogue)
{}
void QWStartDialogueEvent::execute()
{
ptr_dialogue_manager->activateDialogue(ptr_dialogue);
}
////////////////////////
void QWStartDialogueEvent::setDialogueManager(QWAbstractDialogueManager *dialogman) noexcept
{
ptr_dialogue_manager = dialogman;
}
QWAbstractDialogueManager *QWStartDialogueEvent::dialogueManager() const noexcept
{
return ptr_dialogue_manager;
}
////////////////////////
void QWStartDialogueEvent::writeToJson(QJsonObject &event_data)
{
event_data.insert("id", tag());
event_data.insert("type", EVENT_TYPE::START_DIALOGUE);
event_data.insert("dialogue", ptr_dialogue->tag());
qDebug() << " The start_dialogue event:\n" << " id " << tag()
<< "\n dialogue " << ptr_dialogue->tag();
}