Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/Presentation_HS16/src/modules/notifications/dispatchers/Dialogue.cc @ 11347

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

dialog branch merged to presentation

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