Changeset 11331
- Timestamp:
- Dec 12, 2016, 3:16:38 PM (8 years ago)
- Location:
- code/branches/Dialog_HS16/src/modules
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.cc
r11317 r11331 1 2 3 1 4 2 #include "Dialogue.h" … … 15 13 RegisterClass(Dialogue); 16 14 15 /** 16 @brief 17 Default Constructor. Registers the object and initializes variables. 18 */ 17 19 Dialogue::Dialogue(Context* context):NotificationDispatcher(context){ 18 20 RegisterObject(Dialogue); … … 22 24 this->setSyncMode(ObjectDirection::None); 23 25 } 24 26 /** 27 @brief 28 Destructor. 29 */ 25 30 Dialogue::~Dialogue() 26 31 { 27 32 28 33 } 34 /** 35 @brief 36 Method for creating a Dialogue object through XML. 37 */ 29 38 void Dialogue::XMLPort(Element& xmlelement, XMLPort::Mode mode) 30 39 { … … 36 45 37 46 } 38 void Dialogue::update() 39 { 47 /** 48 @brief 49 Passes the name of the picture over to the HUDDialogue class 50 */ 51 void Dialogue::update() 52 { 40 53 for(HUDDialogue* huddialogue : ObjectList<HUDDialogue>()) 41 54 huddialogue->updateTarget(portrait_); 42 55 } 43 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 */ 44 60 const std::string& Dialogue::createNotificationMessage(void) 45 61 { -
code/branches/Dialog_HS16/src/modules/notifications/dispatchers/Dialogue.h
r11317 r11331 11 11 namespace orxonox{ 12 12 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 13 31 class _NotificationsExport Dialogue: public NotificationDispatcher{ 14 32 … … 17 35 virtual ~Dialogue(); //!< Destructor. 18 36 19 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); 37 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating a Dialogue object through XML. 20 38 39 /** 40 @brief Get the message, that is displayed. 41 @return Returns the message, that is displayed. 42 */ 21 43 const std::string& getMessage(void) 22 44 { return this->message_; } 45 /** 46 @brief Get the name of the speaker. 47 @return Returns the name of the speaker. 48 */ 23 49 const std::string& getSpeaker(void) 24 50 {return this->speaker_;} 51 /** 52 @brief Get the name of the file of the picture 53 @return Returns the name of the file. 54 */ 25 55 const std::string& getPortrait(void) 26 56 { return this->portrait_;} 27 57 28 58 protected: 59 /** 60 @brief Creates the notification message that should be sent upon the Dialgue triggering. 61 @return Returns the notification message. 62 */ 29 63 virtual const std::string& createNotificationMessage(void); 64 /** 65 @brief Updates the picture that is displayed by passing the name of the picture over to the HUDDialogue class. 66 */ 30 67 virtual void update(void); 31 68 32 69 private: 33 std::string message_; 34 std::string speaker_; 35 std::string dialogue_; 36 std::string portrait_; 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. 37 74 75 /** 76 @brief Sets the name of the speaker. 77 @param speaker The name of the speaker. 78 */ 38 79 void setSpeaker(const std::string& speaker) 39 80 { this->speaker_ = speaker;} 81 /** 82 @brief Sets the message that is to be displayed. 83 @param message The message to be displayed. 84 */ 40 85 void setMessage(const std::string& message) 41 86 { this->message_ = message; } 87 /** 88 @brief Sets the name of the file of the picture. 89 @param portrait Name of the file which is used. 90 */ 42 91 void setPortrait(const std::string& portrait) 43 92 { this->portrait_ = portrait;} -
code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.cc
r11317 r11331 15 15 { 16 16 17 RegisterClass (HUDDialogue); 18 19 HUDDialogue::HUDDialogue(Context* context) : 20 OrxonoxOverlay(context) 17 RegisterClass (HUDDialogue); 18 /** 19 @brief 20 Default Constructor. Registers the object and initializes variables. 21 */ 22 HUDDialogue::HUDDialogue(Context* context) : 23 OrxonoxOverlay(context) 21 24 { 22 25 RegisterObject(HUDDialogue); 23 } 26 } 27 /** 28 @brief 29 Updates the picture to the picture which was declared in the Dialogue class and sets a timer to set the picture on invisible again. 30 */ 24 31 void HUDDialogue::updateTarget(std::string portrait) 25 32 { … … 33 40 portraitTimer.setTimer(2.9f,false,createExecutor(createFunctor(&HUDDialogue::invisible, this))); 34 41 } 42 /** 43 @brief 44 Sets the picture back to invisible again. 45 */ 35 46 void HUDDialogue::invisible() 36 47 { … … 38 49 Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->overlayElementIcon_); 39 50 } 40 HUDDialogue::~HUDDialogue() 41 { 51 /** 52 @brief 53 Default Destructor. 54 */ 55 HUDDialogue::~HUDDialogue() 56 { 42 57 43 58 44 59 } 45 60 } -
code/branches/Dialog_HS16/src/modules/overlays/hud/HUDDialogue.h
r11317 r11331 18 18 { 19 19 public: 20 HUDDialogue(Context* context); 21 virtual ~HUDDialogue(); 20 HUDDialogue(Context* context); //!< Default Constructor. 21 virtual ~HUDDialogue(); //!< Destructor. 22 22 23 /** 24 @brief Sets the active picture. 25 */ 23 26 virtual void updateTarget(std::string portrait); 24 27 /** 28 @brief Sets the picture to invivsible when Dialogue is over. 29 */ 25 30 virtual void invisible(); 26 31 … … 28 33 Ogre::PanelOverlayElement* overlayElementIcon_; 29 34 30 Timer portraitTimer; 35 Timer portraitTimer; //!< The Timer which is used to set the picture back to invisible. 31 36 }; 32 37 }
Note: See TracChangeset
for help on using the changeset viewer.