123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #include "UIDialog.h"
- #include "Game.h"
- #include "NetworkMessage.h"
- UIDialog::UIDialog(
- Framework::Text id, int playerId, Framework::XML::Element* uiml)
- : ReferenceCounter(),
- id(id),
- playerId(playerId),
- uiml(uiml)
- {}
- UIDialog::~UIDialog()
- {
- uiml->release();
- }
- void UIDialog::api(Framework::StreamReader* zRequest,
- NetworkMessage* zResponse)
- {}
- bool UIDialog::open() const
- {
- Entity* zEntity = Game::INSTANCE->zEntity(playerId);
- if (zEntity)
- {
- Game::INSTANCE->zQuestManager()->processEvent(new QuestEventOpenDialog(
- dynamic_cast<Entity*>(zEntity->getThis()), id));
- NetworkMessage* msg = new NetworkMessage();
- msg->openDialog(id, uiml->toString());
- Game::INSTANCE->sendMessage(msg, zEntity);
- return 1;
- }
- return 0;
- }
- bool UIDialog::update() const {
- Entity* zEntity = Game::INSTANCE->zEntity(playerId);
- if (zEntity)
- {
- Game::INSTANCE->zQuestManager()->processEvent(new QuestEventOpenDialog(
- dynamic_cast<Entity*>(zEntity->getThis()), id));
- NetworkMessage* msg = new NetworkMessage();
- msg->updateDialog(id, uiml->toString());
- Game::INSTANCE->sendMessage(msg, zEntity);
- return 1;
- }
- return 0;
- }
- const Framework::Text& UIDialog::getId() const
- {
- return id;
- }
- int UIDialog::getPlayerId() const
- {
- return playerId;
- }
|