[11247] | 1 | |
---|
| 2 | #ifndef _Dialogue_H__ |
---|
| 3 | #define _Dialogue_H__ |
---|
| 4 | #include <string> |
---|
[11261] | 5 | //#include "core/BaseObject.h" |
---|
[11247] | 6 | |
---|
[11261] | 7 | #include "notifications/NotificationsPrereqs.h" |
---|
| 8 | |
---|
| 9 | #include "notifications/NotificationDispatcher.h" |
---|
| 10 | |
---|
[11247] | 11 | namespace orxonox{ |
---|
| 12 | |
---|
[11331] | 13 | /** |
---|
| 14 | @brief |
---|
| 15 | The Dialogue class enables the sending of (in XML) predefined Notifications upon some kind of triggering event. |
---|
| 16 | |
---|
| 17 | In use it would like this: |
---|
| 18 | @code |
---|
| 19 | <Dialogue message="some message..." speaker="speaker" portrait="Orxonox/some_file"> |
---|
| 20 | <events> |
---|
| 21 | <trigger> |
---|
| 22 | <PlayerTrigger /> |
---|
| 23 | </trigger> |
---|
| 24 | </events> |
---|
| 25 | </Dialogue> |
---|
| 26 | @endcode |
---|
| 27 | For more information on what can be used for @code <PlayerTrigger /> @endcode see the @ref orxonox::NotificationDispatcher "NotificationDispatcher" documentation. |
---|
| 28 | For more information about the Dialogue class take a look at the Notifications entry in the wiki. |
---|
| 29 | */ |
---|
| 30 | |
---|
[11261] | 31 | class _NotificationsExport Dialogue: public NotificationDispatcher{ |
---|
[11247] | 32 | |
---|
| 33 | public: |
---|
| 34 | Dialogue(Context* context); //!< Default Constructor. |
---|
| 35 | virtual ~Dialogue(); //!< Destructor. |
---|
| 36 | |
---|
[11331] | 37 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Dialogue object through XML. |
---|
[11247] | 38 | |
---|
[11331] | 39 | /** |
---|
| 40 | @brief Get the message, that is displayed. |
---|
| 41 | @return Returns the message, that is displayed. |
---|
| 42 | */ |
---|
[11247] | 43 | const std::string& getMessage(void) |
---|
[11317] | 44 | { return this->message_; } |
---|
[11331] | 45 | /** |
---|
| 46 | @brief Get the name of the speaker. |
---|
| 47 | @return Returns the name of the speaker. |
---|
| 48 | */ |
---|
[11270] | 49 | const std::string& getSpeaker(void) |
---|
| 50 | {return this->speaker_;} |
---|
[11331] | 51 | /** |
---|
| 52 | @brief Get the name of the file of the picture |
---|
| 53 | @return Returns the name of the file. |
---|
| 54 | */ |
---|
[11317] | 55 | const std::string& getPortrait(void) |
---|
| 56 | { return this->portrait_;} |
---|
| 57 | |
---|
[11247] | 58 | protected: |
---|
[11331] | 59 | /** |
---|
| 60 | @brief Creates the notification message that should be sent upon the Dialgue triggering. |
---|
| 61 | @return Returns the notification message. |
---|
| 62 | */ |
---|
[11270] | 63 | virtual const std::string& createNotificationMessage(void); |
---|
[11331] | 64 | /** |
---|
| 65 | @brief Updates the picture that is displayed by passing the name of the picture over to the HUDDialogue class. |
---|
| 66 | */ |
---|
[11317] | 67 | virtual void update(void); |
---|
[11270] | 68 | |
---|
[11247] | 69 | private: |
---|
[11331] | 70 | std::string message_; //!< The message. |
---|
| 71 | std::string speaker_; //!< The name of the speaker. |
---|
| 72 | std::string dialogue_; //!< The speaker and the message that is displayed. |
---|
| 73 | std::string portrait_; //!< The name of the file. |
---|
[11261] | 74 | |
---|
[11331] | 75 | /** |
---|
| 76 | @brief Sets the name of the speaker. |
---|
| 77 | @param speaker The name of the speaker. |
---|
| 78 | */ |
---|
[11270] | 79 | void setSpeaker(const std::string& speaker) |
---|
| 80 | { this->speaker_ = speaker;} |
---|
[11331] | 81 | /** |
---|
| 82 | @brief Sets the message that is to be displayed. |
---|
| 83 | @param message The message to be displayed. |
---|
| 84 | */ |
---|
[11261] | 85 | void setMessage(const std::string& message) |
---|
| 86 | { this->message_ = message; } |
---|
[11331] | 87 | /** |
---|
| 88 | @brief Sets the name of the file of the picture. |
---|
| 89 | @param portrait Name of the file which is used. |
---|
| 90 | */ |
---|
[11317] | 91 | void setPortrait(const std::string& portrait) |
---|
| 92 | { this->portrait_ = portrait;} |
---|
[11247] | 93 | } ; |
---|
| 94 | } |
---|
| 95 | |
---|
| 96 | #endif |
---|