Changeset 7489
- Timestamp:
- Sep 24, 2010, 4:01:04 PM (14 years ago)
- Location:
- code/trunk
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/doc/api/Groups.dox
r7488 r7489 129 129 You first have to decide on a message, it shouldn't be too long but be long enough to get your point accross. 130 130 Then you have to decide on a sender. The sender is a string by which the different @ref orxonox::NotificationQueue "NotificationQueues" (the entities that display the @ref orxonox::Notification "Notifications") can decide whether they should display the @ref orxonox::Notification "Notification" or not. So the sender is some string that identifies a group of @ref orxonox::Notification "Notifications" that have something in common or some entity that is sending them. For example: All @ref orxonox::Notification "Notifications" sent by any part of the Questsystem have "questsystem" as sender and thus we could create a @ref orxonox::NotificationQueue "NotificationQueue" that only displays @ref orxonox::Notification "Notifications" from the Questsystem, but more to that later. 131 And lastly you have to decide to whom you want to send this @ref orxonox::Notification "Notification". You have to get the clientId of the intended recipient (e.g. trough ta @ref orxonox::PlayerInfo "PlayerInfo") or you only send the @ref orxonox::Notification "Notification" locally, either by setting the clientId to Host::getPlayerID() or by setting the variable 'isLocal' to true, and setting clientId to what ever you want, since it will be ignored.131 And lastly you have to decide to whom you want to send this @ref orxonox::Notification "Notification". You have to get the clientId of the intended recipient (e.g. trough a @ref orxonox::PlayerInfo "PlayerInfo") or you only send the @ref orxonox::Notification "Notification" locally, either by setting the clientId to Host::getPlayerID() or by setting the variable 'isLocal' to true, and setting clientId to what ever you want, since it will be ignored. 132 132 Once you have decided all that you can send the Notification by calling: 133 133 @code … … 136 136 137 137 @subsection NotificationsDisplay Displaying notifications 138 Displaying @ref or oxnox::Notification "Notifications" is even easier, all you need to do is to load the NotificationLayer in the level, where you want @ref orxonox::Notification "Notifications" displayed. You can either do this manually by executing the following command in the console:138 Displaying @ref orxonox::Notification "Notifications" is even easier, all you need to do is to load the NotificationLayer in the level, where you want @ref orxonox::Notification "Notifications" displayed. You can either do this manually by executing the following command in the console: 139 139 @code 140 140 showGUI NotificationLayer false true … … 154 154 155 155 @subsection NotificationQueue NotificationQueue 156 The @ref orxonox::NotificationQueue "NotificationQueue" is the entity, that (as said earlier) logically displays @ref orxonox::Notification "Notifications". Furthermore a @ref orxonox::NotificationQueue "NotificationQueue" displays only a subset of all the @ref orxonox::Notification "Notifications". The parameters that reduce the range of @ref orxonox::Notification "Notifications" are:157 - @b senders The senders, set of targets of a @ref orxonox::NotificationQueue "NotificationQueue" is the set of senders a @ref orxonox::NotificationQueue "NotificationQueue" displays @ref orxonox::Notification "Notifications" from. E.g. If one would set the senders to "questsystem" then only @ref orxonox::Notification "Notifications" from the Questsystem wouuld be displayed in that particular queue. If you set senders to "all" then all Notifications will be displayed. Different senders can be concatinated with commas.158 - @b size The size specifies how many @ref orxonox::Notification "Notifications" are displayed at the most, if there are more @ref orxonox::Notification "Notifications" that could be displayed but the size is smaller than the number of @ref orxonox::Notification "Notifications", then only the most recent are displayed.156 The @ref orxonox::NotificationQueue "NotificationQueue" is the entity, that (as said earlier) logically displays @ref orxonox::Notification "Notifications". Furthermore a @ref orxonox::NotificationQueue "NotificationQueue" displays only a subset of all the @ref orxonox::Notification "Notifications". The parameters that reduce the range of displayed @ref orxonox::Notification "Notifications" are: 157 - @b senders The senders, the set of targets of a @ref orxonox::NotificationQueue "NotificationQueue" is the set of senders a @ref orxonox::NotificationQueue "NotificationQueue" displays @ref orxonox::Notification "Notifications" from. E.g. If one would set the senders to "questsystem" then only @ref orxonox::Notification "Notifications" from the Questsystem would be displayed in that particular queue. If you set senders to "all" then all Notifications will be displayed. Different senders can be concatinated with commas. 158 - @b size The size specifies how many @ref orxonox::Notification "Notifications" are displayed at the most, if there are more @ref orxonox::Notification "Notifications" that could be displayed, then only the most recent are displayed. 159 159 - @b displayTime The display time specifies how long a @ref orxonox::Notification "Notification" is displayed at the most. 160 160 161 161 @subsection NotificationLayer NotificationLayer 162 The NotificationLayer is a GUI sheet, that displays all the @ref orxonox::NotificationQueue "NotificationQueues" and their @ref orxonox::Notification "Notifications". In its normal mode of operation it is transparent to input, meaning that it only functions as a means of displaying, however if switched to edit mode the NotificationLayer no longer is transparent to input and allows for the adding, removal and modification of @ref orxonox::NotificationQueue "NotificationQueues". 162 The NotificationLayer is a GUI sheet, that displays all the @ref orxonox::NotificationQueue "NotificationQueues" and their @ref orxonox::Notification "Notifications". In its normal mode of operation it is transparent to input, meaning that it only functions as a means of displaying, however if switched to edit mode the NotificationLayer no longer is transparent to input and allows for the adding, removal and modification of @ref orxonox::NotificationQueue "NotificationQueues". For every @ref orxonox::NotificationQueue "NotificationQueue" there is the equivalent representation in the NotificationLayer. So @ref orxonox::NotificationQueue "NotificationQueues" are not each represented by a GUI sheet, but thely all belong to one and the same GUI sheet, the NotificationLayer. 163 163 164 164 @subsection NotificationManager NotificationManager 165 The @ref orxonox::NotificationManager "NotificationManager" is (hence the name) the managing entity in this setting. It is responsible for the registering and unregistering of @ref orxonox::NotificationListener "NotificationListeners" (which the @ref orxonox::NotificationQueue "NotificationQueue" is) and also informs them about changes related to @ref orxonox::Notification "Notifications". It is also responsible for the creation and destruction of @ref orxonox::NotificationQueue "NotificationQueues" through the NotificationLayer and is also the point of approach for the NotificationLayer to get information it needs . Finally the @ref orxonox::NotificationManager "NotificationManager" is responsible for sending (and in the process creating) @ref orxonox::Notification "Notifications" and is a means for the @ref orxonox::NotificationQueue "NotificationQueues" to get the information they need about @ref orxonox::Notification "Notifications".165 The @ref orxonox::NotificationManager "NotificationManager" is (hence the name) the managing entity in this setting. It is responsible for the registering and unregistering of @ref orxonox::NotificationListener "NotificationListeners" (which the @ref orxonox::NotificationQueue "NotificationQueue" is) and also informs them about changes related to @ref orxonox::Notification "Notifications". It is also responsible for the creation and destruction of @ref orxonox::NotificationQueue "NotificationQueues" through the NotificationLayer and is also the point of approach for the NotificationLayer to get information it needs to display the queues. Finally the @ref orxonox::NotificationManager "NotificationManager" is responsible for sending (and in the process creating) @ref orxonox::Notification "Notifications" and is a means for the @ref orxonox::NotificationQueue "NotificationQueues" to get the information they need about @ref orxonox::Notification "Notifications". 166 166 167 167 @subsection Notification Notification 168 The @ref orxonox::Notification "Notification" class is more or less a data structure that groups the notification message and the sender, and possibly other future parameters together to form a comprehensive structure that we call Notification.168 The @ref orxonox::Notification "Notification" class is more or less a data structure that groups the notification message and the sender, and possibly other future parameters, together to form a comprehensive structure that we call Notification. 169 169 170 170 Additionally there is another important class of objects belonging to the Notifications module. The @ref orxonox::NotificationDispatcher "NotificationDispatchers". -
code/trunk/src/modules/notifications/Notification.cc
r7488 r7489 35 35 36 36 #include "core/CoreIncludes.h" 37 #include "network/NetworkFunction.h"38 #include "network/Host.h"39 37 #include "NotificationManager.h" 40 38 … … 44 42 /** 45 43 @brief 46 Default constructor. Initializes the object. 47 */ 48 Notification::Notification() 49 { 50 RegisterRootObject(Notification); 51 this->initialize(); 52 } 53 54 /** 55 @brief 56 Constructor. Creates a Notification with the input message. 57 @param creator 58 The creator. 44 Constructor. Creates a Notification with the input message and sender. 59 45 @param message 60 46 The message of the Notification. 47 @param sender 48 The sender of the Notification. 61 49 */ 62 50 Notification::Notification(const std::string& message, const std::string& sender) -
code/trunk/src/modules/notifications/Notification.h
r7488 r7489 39 39 40 40 #include <string> 41 #include "core/ BaseObject.h"41 #include "core/OrxonoxClass.h" 42 42 43 43 namespace orxonox … … 46 46 /** 47 47 @brief 48 A Notification is a short message used to inform the player about something that just happened. A Notification can be sent from any part of orxonox and is then displayed in the proper @ref orxonox::NotificationQueue "NotificationQueue" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueue" accepts). 48 A Notification represents a short message used to inform the player about something that just happened. With the @ref orxonox::NotificationManager "NotificationManager" a Notification can be sent from any part of orxonox and is then displayed by the proper @ref orxonox::NotificationQueue "NotificationQueue(s)" (depending on which senders the specific @ref orxonox::NotificationQueue "NotificationQueues" accepts). 49 50 A Notification is just a datastructure that is used internally by the Notifications module. 49 51 @author 50 52 Damian 'Mozork' Frick … … 53 55 { 54 56 public: 55 Notification();56 57 Notification(const std::string& message, const std::string& sender); 57 58 virtual ~Notification(); 58 59 59 60 /** 60 @brief Returnsthe message of the Notification.61 @brief Get the message of the Notification. 61 62 @return Returns the message of the Notification. 62 63 */ … … 64 65 { return this->message_; } 65 66 67 /** 68 @brief Get the sender of the Notification. 69 @return Returns the sender of the Notification. 70 */ 66 71 inline const std::string & getSender(void) const 67 72 { return this->sender_; } -
code/trunk/src/modules/notifications/NotificationDispatcher.cc
r7488 r7489 44 44 #include "worldentities/pawns/Pawn.h" 45 45 46 #include "Notification.h"47 46 #include "NotificationManager.h" 48 47 -
code/trunk/src/modules/notifications/NotificationManager.cc
r7488 r7489 104 104 // Destroys all NotificationQueues that have been registered with the NotificationManager. 105 105 for(std::map<const std::string, NotificationQueue*>::iterator it = this->queues_.begin(); it != this->queues_.end(); it++) 106 {107 106 it->second->destroy(true); 108 } 107 109 108 this->queues_.clear(); 110 109 } … … 343 342 void NotificationManager::enterEditMode(void) 344 343 { 345 GUIManager::getInstance().hideGUI("NotificationLayer"); 346 GUIManager::getInstance().showGUI("NotificationLayer", false, false); 347 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.enterEditMode()"); 344 if(GameMode::showsGraphics()) 345 { 346 GUIManager::getInstance().hideGUI("NotificationLayer"); 347 GUIManager::getInstance().showGUI("NotificationLayer", false, false); 348 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.enterEditMode()"); 349 } 348 350 } 349 351 -
code/trunk/src/modules/notifications/NotificationManager.h
r7486 r7489 52 52 The Singleton NotificationManager functions as a gateway between @ref orxonox::Notification "Notifications" and @ref orxonox::NotificationListener "NotificationListeners". 53 53 It receives, organizes @ref orxonox::Notification "Notifications" and the redistributes them to the specific @ref orxonox::NotificationListener "NotificationListeners". 54 It also provides a static function to send @ref orxonox::Notification "Notifications" and works as a liaison between the @ref orxonox >>NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer.54 It also provides a static function to send @ref orxonox::Notification "Notifications" and works as a liaison between the @ref orxonox::NotificationQueue "NotificationQueues" and the GUI that displays notification, called NotificationLayer. 55 55 @author 56 56 Damian 'Mozork' Frick -
code/trunk/src/modules/notifications/NotificationQueue.cc
r7488 r7489 90 90 this->create(); // Creates the NotificationQueue in lua. 91 91 92 // register the NotificationQueue as NotificationListener with the NotificationManager.92 // Register the NotificationQueue as NotificationListener with the NotificationManager. 93 93 bool listenerRegistered = NotificationManager::getInstance().registerListener(this); 94 94 if(!listenerRegistered) // If the registration has failed. … … 96 96 this->registered_ = false; 97 97 // Remove the NotificationQueue in lua. 98 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() + "\")"); 98 if(GameMode::showsGraphics()) 99 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() + "\")"); 99 100 NotificationManager::getInstance().unregisterQueue(this); 100 101 COUT(1) << "Error: NotificationQueue '" << this->getName() << "' could not be registered." << std::endl; … … 210 211 void NotificationQueue::update(Notification* notification, const std::time_t & time) 211 212 { 213 assert(notification); 214 212 215 this->push(notification, time); 213 216 … … 226 229 void NotificationQueue::push(Notification* notification, const std::time_t & time) 227 230 { 231 assert(notification); 232 228 233 NotificationContainer* container = new NotificationContainer; 229 234 container->notification = notification; … … 254 259 // Get all the NotificationContainers that were sent the same time the NotificationContainer we want to pop was sent. 255 260 std::pair<std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator, std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator> iterators = this->ordering_.equal_range(container); 256 // Iterate th ourgh all suspects and remove the container as soon as we find it.261 // Iterate through all suspects and remove the container as soon as we find it. 257 262 for(std::multiset<NotificationContainer*, NotificationContainerCompare>::iterator it = iterators.first; it != iterators.second; it++) 258 263 { … … 311 316 312 317 this->notifications_.clear(); 313 314 318 this->size_ = 0; 315 319 -
code/trunk/src/modules/notifications/NotificationQueue.h
r7488 r7489 43 43 #include <vector> 44 44 45 #include "NotificationManager.h" 46 45 47 #include "tools/interfaces/Tickable.h" 46 47 48 #include "interfaces/NotificationListener.h" 48 #include "NotificationManager.h"49 49 50 50 namespace orxonox // tolua_export … … 54 54 struct NotificationContainer 55 55 { 56 Notification* notification; // The Notification displayed.57 time_t time; // The time the Notification was sent and thus first displayed.56 Notification* notification; //!< The Notification displayed. 57 time_t time; //!< The time the Notification was sent and thus first displayed. 58 58 }; 59 59 … … 61 61 struct NotificationContainerCompare { 62 62 bool operator() (const NotificationContainer* const & a, const NotificationContainer* const & b) const 63 { return a->time < b->time; } // Orderedby time.63 { return a->time < b->time; } //!< Ordering by time. 64 64 }; 65 65 -
code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc
r7484 r7489 64 64 CommandNotification::~CommandNotification() 65 65 { 66 66 67 67 } 68 68 … … 114 114 Returns a human readable version of the input binding. 115 115 */ 116 //TODO: Move to KeyBinderManager... 116 117 const std::string& CommandNotification::bindingNiceifyer(const std::string& binding) 117 118 { -
code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
r7488 r7489 46 46 @brief 47 47 This class implements a method of displaying a Notification with information to an input command and the key the command is mapped to. 48 The message that is displayed is a string made out uf the concatenation of the preMessage, the key the specified command is mapped to and the postMessage.48 The message that is displayed is a string made out of the concatenation of the preMessage, the key the specified command is mapped to and the postMessage. 49 49 50 50 In use it would like this: … … 120 120 { this->postMessage_ = message; } 121 121 122 const std::string& bindingNiceifyer(const std::string& binding); 122 const std::string& bindingNiceifyer(const std::string& binding); //!< Transforms the input binding into a human readable form. 123 123 124 124 }; -
code/trunk/src/modules/questsystem/QuestEffectBeacon.h
r7456 r7489 56 56 @brief 57 57 A QuestEffectBeacon is a physical entity in the game which can (under some condition(s)) invoke a number of @ref orxonox::QuestEffect "QuestEffects" on players meeting the condition(s). 58 The conditions under which the @ref orxonox::QuestEffect "QuestEffects" are invoked on the player are defined by @ref orxonox::Trigger "Triggers" (or really any kind of entity firing events, e.g. @ref or oxnox::EventListener "EventListeners"). The trigger the event originates from, however has to be a @ref orxonox::PlayerTrigger PlayerTrigger.58 The conditions under which the @ref orxonox::QuestEffect "QuestEffects" are invoked on the player are defined by @ref orxonox::Trigger "Triggers" (or really any kind of entity firing events, e.g. @ref orxonox::EventListener "EventListeners"). The trigger the event originates from, however has to be a @ref orxonox::PlayerTrigger PlayerTrigger. 59 59 A QuestEffectBeacon can be executed a defined number of times. 60 60 A QuestEffectBeacon can be inactive or active. While inactive it can't be executed.
Note: See TracChangeset
for help on using the changeset viewer.