1 | |
---|
2 | |
---|
3 | |
---|
4 | #include "Dialogue.h" |
---|
5 | #include "core/CoreIncludes.h" |
---|
6 | #include "core/EventIncludes.h" |
---|
7 | #include "core/XMLPort.h" |
---|
8 | |
---|
9 | #include "overlays/hud/HUDDialogue.h" |
---|
10 | |
---|
11 | #include "NotificationDispatcher.h" |
---|
12 | |
---|
13 | namespace orxonox{ |
---|
14 | |
---|
15 | RegisterClass(Dialogue); |
---|
16 | |
---|
17 | Dialogue::Dialogue(Context* context):NotificationDispatcher(context){ |
---|
18 | RegisterObject(Dialogue); |
---|
19 | |
---|
20 | this->setSender("dialogue"); |
---|
21 | |
---|
22 | this->setSyncMode(ObjectDirection::None); |
---|
23 | } |
---|
24 | |
---|
25 | Dialogue::~Dialogue() |
---|
26 | { |
---|
27 | |
---|
28 | } |
---|
29 | void Dialogue::XMLPort(Element& xmlelement, XMLPort::Mode mode) |
---|
30 | { |
---|
31 | SUPER(Dialogue, XMLPort, xmlelement, mode); |
---|
32 | |
---|
33 | XMLPortParam(Dialogue, "speaker", setSpeaker, getSpeaker, xmlelement, mode); |
---|
34 | XMLPortParam(Dialogue, "message", setMessage, getMessage, xmlelement, mode); |
---|
35 | XMLPortParam(Dialogue, "portrait", setPortrait, getPortrait, xmlelement, mode); |
---|
36 | |
---|
37 | } |
---|
38 | void Dialogue::update() |
---|
39 | { |
---|
40 | for(HUDDialogue* huddialogue : ObjectList<HUDDialogue>()) |
---|
41 | huddialogue->updateTarget(portrait_); |
---|
42 | } |
---|
43 | |
---|
44 | const std::string& Dialogue::createNotificationMessage(void) |
---|
45 | { |
---|
46 | dialogue_ = speaker_ + ": " + message_; |
---|
47 | this->update(); |
---|
48 | return this->dialogue_ ; |
---|
49 | } |
---|
50 | } |
---|