Changeset 7484 for code/trunk/src
- Timestamp:
- Sep 23, 2010, 1:00:42 PM (14 years ago)
- Location:
- code/trunk/src
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/notifications/Notification.cc
r7474 r7484 50 50 RegisterRootObject(Notification); 51 51 this->initialize(); 52 this->registerVariables();53 52 } 54 53 … … 122 121 bool Notification::setMessage(const std::string & message) 123 122 { 124 if(this->isSent()) // !<The message cannot be changed if the message has already been sent.123 if(this->isSent()) // The message cannot be changed if the message has already been sent. 125 124 return false; 126 125 this->message_ = message; -
code/trunk/src/modules/notifications/Notification.h
r7474 r7484 47 47 /** 48 48 @brief 49 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 NotificationQueue (depending on which senders the specific NotificationQueueaccepts).49 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). 50 50 @author 51 51 Damian 'Mozork' Frick … … 83 83 bool sent_; //!< Whether Notification has been sent, if so it cannot be changed. 84 84 85 void initialize(void); 86 void registerVariables(void); 85 void initialize(void); //!< Registers the object and sets some default values. 87 86 88 87 }; -
code/trunk/src/modules/notifications/NotificationDispatcher.cc
r7474 r7484 93 93 } 94 94 95 /** 96 @brief 97 Registers variables for synchronisation. 98 */ 95 99 void NotificationDispatcher::registerVariables(void) 96 100 { … … 113 117 else if(GameMode::isServer()) 114 118 { 119 //TODO: This may fail if the object has not been synchronized, yet. 115 120 callMemberNetworkFunction(NotificationDispatcher, dispatch, this->getObjectID(), clientId, clientId); 116 121 } -
code/trunk/src/modules/notifications/NotificationDispatcher.h
r7474 r7484 47 47 /** 48 48 @brief 49 A NotificationDispatcher is an entity that, upon being triggered, dispatches (or sends) a specified Notification. 49 A NotificationDispatcher is an entity that, upon being triggered, dispatches (or sends) a specified @ref orxonox::Notification "Notification". 50 51 Its standard usage is: 52 @code 53 <NotificationDispatcher> 54 <events> 55 <trigger> 56 <PlayerTrigger /> 57 </trigger> 58 </event> 59 </NotificationDispatcher> 60 @endcode 61 But keep in mind, that NotificationDispatcher is an abstract class and in this example @ref orxonox::PlayerTrigger "PlayerTrigger" stands for any event that is caused by a @ref orxonox::PlayerTrigger "PlayerTrigger", so instead of @ref orxonox::PlayerTrigger "PlayerTrigger", there could be a @ref orxonox::DistanceTrigger "DistanceTrigger", or a @ref orxonox::DistanceMultiTrigger "DistanceMutliTrigger", or even an @ref orxonox::EventListener "EventListener" that waits for an event coming from any kind of @ref orxonox::PlayerTrigger "PlayerTrigger". 50 62 @author 51 63 Damian 'Mozork' Frick … … 73 85 std::string sender_; //!< The name of the sender of the Notification dispatched by this NotificationDispatcher. 74 86 75 void registerVariables(void);87 void registerVariables(void); //!< Register some variables for synchronisation. 76 88 77 89 /** -
code/trunk/src/modules/notifications/NotificationManager.cc
r7474 r7484 60 60 ManageScopedSingleton(NotificationManager, ScopeID::Graphics, false); 61 61 62 // Setting console command to enter the edit mode. 62 63 SetConsoleCommand("enterEditMode", &NotificationManager::enterEditMode); 63 64 … … 106 107 } 107 108 109 /** 110 @brief 111 Sends a Notification with the specified message to the specified client from the specified sender. 112 @param message 113 The message that should be sent. 114 @param clientId 115 The id of the client the notification should be sent to. 116 @param sender 117 The sender that sent the notification. 118 */ 108 119 /*static*/ void NotificationManager::sendNotification(const std::string& message, unsigned int clientId, const std::string& sender) 109 120 { 121 // If we're in standalone mode or we're already no the right client we create and send the Notification. 110 122 if(GameMode::isStandalone() || Host::getPlayerID() == clientId) 111 123 { … … 113 125 notification->send(sender); 114 126 } 127 // If we're on the server (and the server is not the intended recipient of the Notification) we send it over the network. 115 128 else if(GameMode::isServer()) 116 129 { -
code/trunk/src/modules/notifications/NotificationManager.h
r7474 r7484 50 50 /** 51 51 @brief 52 The Singleton NotificationManager functions as a gateway between Notifications and NotificationListeners. 53 It receives, organizes Notifications and the redistributes them to the specific NotificationListeners. 52 The Singleton NotificationManager functions as a gateway between @ref orxonox::Notification "Notifications" and @ref orxonox::NotificationListener "NotificationListeners". 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 55 @author 55 56 Damian 'Mozork' Frick … … 65 66 virtual void preDestroy(void); //!< Is called before the object is destroyed. 66 67 68 /** 69 @brief Get the instance of the NotificationManager Singleton. 70 @return Returns a reference to the NotificationManager. 71 */ 67 72 static NotificationManager& getInstance() { return Singleton<NotificationManager>::getInstance(); } // tolua_export 68 73 … … 70 75 static const std::string NONE; //!< Static string to indicare a sender that sends to no specific NotificationListener. 71 76 77 //! Sends a Notification with the specified message to the specified client from the specified sender. 72 78 static void sendNotification(const std::string& message, unsigned int clientId, const std::string& sender = NotificationManager::NONE); 73 79 -
code/trunk/src/modules/notifications/NotificationQueue.cc
r7417 r7484 52 52 Constructor. Creates and initializes the object. 53 53 @param name 54 The name of the new NotificationQueue. 54 The name of the new NotificationQueue. It needs to be unique 55 55 @param senders 56 56 The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays. -
code/trunk/src/modules/notifications/NotificationQueue.h
r7456 r7484 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; } // !<Ordered by time.63 { return a->time < b->time; } // Ordered by time. 64 64 }; 65 65 66 66 /** 67 67 @brief 68 Displays Notifications from specific senders. 68 Displays @ref orxonox::Notification "Notifications" from specific senders. 69 70 There are quite some parameters that influence the behaviour of the NotificationQueue: 71 - 'name': The name of the NotificationQueue. It needs to be unique. 72 - 'senders': The senders that are targets of this NotificationQueue, i.e. the names of senders whose Notifications this NotificationQueue displays. 73 - 'size': The size of the NotificationQueue, it specifies how many @ref orxonox::Notification "Notifications" are displayed at once at the most. 74 - 'displayTime': The time a @ref orxonox::Notification "Notification" is displayed with this NotificationQueue. 69 75 @author 70 76 Damian 'Mozork' Frick -
code/trunk/src/modules/notifications/dispatchers/CommandNotification.cc
r7474 r7484 80 80 } 81 81 82 /** 83 @brief 84 Register some variables for synchronisation. 85 */ 82 86 void CommandNotification::registerVariables(void) 83 87 { -
code/trunk/src/modules/notifications/dispatchers/CommandNotification.h
r7474 r7484 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 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. 49 50 In use it would like this: 51 @code 52 <CommandNotification preMessage="Please press " command="someCommand" postMessage=" to do something." > 53 <events> 54 <trigger> 55 <PlayerTrigger /> 56 </trigger> 57 </events> 58 </CommandNotification> 59 @endcode 60 Upon being triggered this would display the @ref orxonox::Notification "Notification" "Please press {the binding of the specified command} to do something". 61 For more information on what can be used for @code <PlayerTrigger /> @endcode see the @ref orxonox::NotificationDispatcher "NotificationDispatcher" documentation. 49 62 @author 50 63 Damian 'Mozork' Frick … … 86 99 std::string postMessage_; //!< The last part of the displayed message. 87 100 88 void registerVariables(void); 101 void registerVariables(void); //!< Register some variables for synchronisation. 89 102 90 103 /** -
code/trunk/src/modules/notifications/dispatchers/SimpleNotification.h
r7456 r7484 46 46 @brief 47 47 The SimpleNotification class enables the sending of (in XML) predefined Notifications upon some kind of triggering event. 48 49 In use it would like this: 50 @code 51 <SimpleNotification message="some message..." > 52 <events> 53 <trigger> 54 <PlayerTrigger /> 55 </trigger> 56 </events> 57 </SimpleNotification> 58 @endcode 59 For more information on what can be used for @code <PlayerTrigger /> @endcode see the @ref orxonox::NotificationDispatcher "NotificationDispatcher" documentation. 48 60 @author 49 61 Damian 'Mozork' Frick -
code/trunk/src/modules/objects/Script.h
r7483 r7484 81 81 @author 82 82 Benjamin Knecht 83 @author 83 84 Damian 'Mozork' Frick 84 85 */ -
code/trunk/src/modules/questsystem/QuestEffectBeacon.cc
r7456 r7484 52 52 Constructor. Registers the object and initializes defaults. 53 53 */ 54 //TODO: Make just BaseObject?55 54 QuestEffectBeacon::QuestEffectBeacon(BaseObject* creator) : StaticEntity(creator) 56 55 { -
code/trunk/src/modules/questsystem/QuestManager.h
r7456 r7484 50 50 @brief 51 51 Is a Singleton and manages @ref orxonox::Quest "Quests", by registering every @ref orxonox::Quest "Quest" / @ref orxonox::QuestHint "QuestHint" (through registerX()) and making them globally accessible (through findX()). 52 @ref orxonox::Quest "Quests" (and @ref orxonox::QuestHint 2) are registered in the QuestManager with their id, and can be accessed in the same way.52 @ref orxonox::Quest "Quests" (and @ref orxonox::QuestHint "QuestHints") are registered in the QuestManager with their id, and can be accessed in the same way. 53 53 @author 54 54 Damian 'Mozork' Frick -
code/trunk/src/orxonox/interfaces/NotificationListener.h
r7417 r7484 28 28 29 29 /** 30 @file 30 @file NotificationListener.h 31 31 @brief Definition of the NotificationListener class. 32 @ingroup Notifications 32 33 */ 33 34 … … 52 53 @brief 53 54 NotificationListener interface. 55 56 The NotificationListener interface presents a means to being informed when @ref orxonox::Notification "Notifications" in the target set of this NotificationListener change. (e.g. @ref orxonox::Notification "Notifications" were added or removed) 57 When inheriting from a NotificationListener it is important to register (in the constructor) and unregister (in the destructor) it to and from the @ref orxonox::NotificationManager "NotificationManager". 54 58 @author 55 59 Fabian 'x3n' Landau 56 60 */ 61 //TODO: Needed? Remove or move some NotificationQueue things over here. 57 62 class _OrxonoxExport NotificationListener : virtual public OrxonoxClass 58 63 { … … 61 66 virtual ~NotificationListener() {} 62 67 63 virtual const std::set<std::string> & getTargetsSet() = 0; 68 /** 69 @brief Get the senders that are targets of this NotificationListener. 70 @return Returns the set of senders that are targets of this NotificationListener. 71 */ 72 virtual const std::set<std::string> & getTargetsSet(void) = 0; 73 74 /** 75 @brief Updates the whole NotificationListener. 76 This is called by the @ref orxonox::NotificationManager "NotificationManager" when the @ref orxonox::Notification "Notifications" have changed so much, that the NotificationListener may have to re-initialize his operations. 77 */ 64 78 virtual void update(void) = 0; 79 /** 80 @brief Updates the NotificationListener, when a new Notification has come in at the specified time. 81 @param notification A pointer to the @ref orxonox::Notification "Notification". 82 @param time The time the @ref orxonox::Notification "Notification" has come in. 83 */ 65 84 virtual void update(Notification* notification, const std::time_t & time) = 0; 66 85 };
Note: See TracChangeset
for help on using the changeset viewer.