Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/archive/Presentation_HS16/src/modules/notifications/dispatchers/Dialogue.cc @ 11475

Last change on this file since 11475 was 11347, checked in by maxima, 8 years ago

dialog branch merged to presentation

File size: 1.8 KB
Line 
1
2#include "Dialogue.h"
3#include "core/CoreIncludes.h"
4#include "core/EventIncludes.h"
5#include "core/XMLPort.h"
6
7#include "overlays/hud/HUDDialogue.h"
8
9#include "NotificationDispatcher.h"
10
11namespace orxonox{
12       
13        RegisterClass(Dialogue);
14
15    /**
16    @brief
17        Default Constructor. Registers the object and initializes variables.
18    */
19        Dialogue::Dialogue(Context* context):NotificationDispatcher(context){
20                RegisterObject(Dialogue);
21
22                this->setSender("dialogue");
23
24        this->setSyncMode(ObjectDirection::None);
25        }
26    /**
27    @brief
28        Destructor.
29    */
30        Dialogue::~Dialogue()
31    {
32
33    }
34    /**
35    @brief
36        Method for creating a Dialogue object through XML.
37    */
38    void Dialogue::XMLPort(Element& xmlelement, XMLPort::Mode mode)
39    {
40        SUPER(Dialogue, XMLPort, xmlelement, mode);
41
42        XMLPortParam(Dialogue, "speaker", setSpeaker, getSpeaker, xmlelement, mode);
43        XMLPortParam(Dialogue, "message", setMessage, getMessage, xmlelement, mode);
44        XMLPortParam(Dialogue, "portrait", setPortrait, getPortrait, xmlelement, mode);
45       
46    }
47    /**
48    @brief
49        Passes the name of the picture over to the HUDDialogue class
50    */
51    void Dialogue::update()
52    {   
53       for(HUDDialogue* huddialogue : ObjectList<HUDDialogue>())
54                       huddialogue->updateTarget(portrait_);
55    }
56    /**
57        @brief Creates the notification message,Pconsisting of a speaker and a message, that should be sent upon the Dialgue triggering.
58        @return Returns the notification message.
59    */
60    const std::string& Dialogue::createNotificationMessage(void)
61                {       
62                        dialogue_ = speaker_ + ": " + message_;
63                    this->update();
64                        return this->dialogue_ ;
65                }
66}
Note: See TracBrowser for help on using the repository browser.