Changeset 7341 for code/branches
- Timestamp:
- Sep 3, 2010, 4:53:51 PM (14 years ago)
- Location:
- code/branches/notifications
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/notifications/data/gui/scripts/SheetManager.lua
r7340 r7341 210 210 211 211 -- If the first sheet that needs input is the MainMenu. 212 if counter > 0 and activeMenuSheets.size == counter and activeMenuSheets[counter].sheet.name == "MainMenu" then212 if counter == 1 and activeMenuSheets[1].sheet.name == "MainMenu" then 213 213 orxonox.execute("exit") 214 214 -- If there is at least one sheet that needs input. -
code/branches/notifications/src/modules/notifications/NotificationManager.cc
r7338 r7341 61 61 this->highestIndex_ = 0; 62 62 63 //TODO: What if no graphics? 64 GUIManager::getInstance().loadGUI("NotificationLayer"); 65 // Create first queue: 66 NotificationQueue* queue = new NotificationQueue("general"); 63 if(GameMode::showsGraphics()) 64 { 65 GUIManager::getInstance().loadGUI("NotificationLayer"); 66 67 // Create first queue: 68 NotificationQueue* queue = new NotificationQueue("all"); 69 } 67 70 } 68 71 … … 94 97 this->allNotificationsList_.insert(std::pair<std::time_t,Notification*>(time,notification)); 95 98 96 if(notification->getSender() == NONE) // !<If the sender has no specific name, then the Notification is only added to the list of all Notifications.99 if(notification->getSender() == NONE) // If the sender has no specific name, then the Notification is only added to the list of all Notifications. 97 100 return true; 98 101 99 102 bool all = false; 100 if(notification->getSender() == ALL) // !<If all are the sender, then the Notifications is added to every NotificationListener.103 if(notification->getSender() == ALL) // If all are the sender, then the Notifications is added to every NotificationListener. 101 104 all = true; 102 105 103 // !<Insert the notification in all listeners that have its sender as target.104 for(std::map<NotificationListener*,int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) // !<Iterate through all listeners.106 // Insert the notification in all listeners that have its sender as target. 107 for(std::map<NotificationListener*,int>::iterator it = this->listenerList_.begin(); it != this->listenerList_.end(); it++) // Iterate through all listeners. 105 108 { 106 109 std::set<std::string> set = it->first->getTargetsSet(); 107 110 if(all || set.find(notification->getSender()) != set.end() || set.find(ALL) != set.end()) //TODO: Make sure this works. 108 111 { 109 this->notificationLists_[it->second]->insert(std::pair<std::time_t,Notification*>(time,notification)); // !<Insert the Notification in the Notifications list of the current NotificationListener.110 it->first->update(notification, time); // !<Update the listener.112 this->notificationLists_[it->second]->insert(std::pair<std::time_t,Notification*>(time,notification)); // Insert the Notification in the Notifications list of the current NotificationListener. 113 it->first->update(notification, time); // Update the listener. 111 114 std::map<Notification*, unsigned int>::iterator counterIt = this->listenerCounter_.find(notification); 112 115 if(counterIt == this->listenerCounter_.end()) … … 160 163 Returns true if successful. 161 164 */ 165 //TODO: Needed? 162 166 bool NotificationManager::removeNotification(Notification* notification, std::multimap<std::time_t, Notification*>& map) 163 167 { … … 188 192 int index = this->highestIndex_; 189 193 190 this->listenerList_[listener] = index; // !<Add the NotificationListener to the list of listeners.194 this->listenerList_[listener] = index; // Add the NotificationListener to the list of listeners. 191 195 192 196 std::set<std::string> set = listener->getTargetsSet(); //TODO: Does this work? 193 197 194 // !If all senders are the target of the listener, then the list of notification for that specific listener is te same as the list of all Notifications.198 // If all senders are the target of the listener, then the list of notification for that specific listener is te same as the list of all Notifications. 195 199 if(set.find(ALL) != set.end()) 196 200 { … … 203 207 std::multimap<std::time_t,Notification*> map = *this->notificationLists_[index]; 204 208 205 // !Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationListener.209 // Iterate through all Notifications to determine whether any of them should belong to the newly registered NotificationListener. 206 210 for(std::multimap<std::time_t,Notification*>::iterator it = this->allNotificationsList_.begin(); it != this->allNotificationsList_.end(); it++) 207 211 { 208 if(set.find(it->second->getSender()) != set.end()) // !<Checks whether the overlay has the sender of the current notification as target.212 if(set.find(it->second->getSender()) != set.end()) // Checks whether the overlay has the sender of the current notification as target. 209 213 { 210 214 map.insert(std::pair<std::time_t, Notification*>(it->first, it->second)); … … 217 221 } 218 222 219 listener->update(); // !<Update the listener.223 listener->update(); // Update the listener. 220 224 221 225 COUT(4) << "NotificationListener registered with the NotificationManager." << std::endl; … … 272 276 return false; 273 277 274 std::multimap<std::time_t,Notification*>* notifications = this->notificationLists_[this->listenerList_[listener]]; // !<The Notifications for the input NotificationListener.275 276 if(notifications == NULL) // !<Returns NULL, if there are no Notifications.278 std::multimap<std::time_t,Notification*>* notifications = this->notificationLists_[this->listenerList_[listener]]; // The Notifications for the input NotificationListener. 279 280 if(notifications == NULL) // Returns NULL, if there are no Notifications. 277 281 return true; 278 282 … … 281 285 itHighest = notifications->upper_bound(timeFrameStart); 282 286 283 for(it = itLowest; it != itHighest; it++) // !<Iterate through the Notifications from the start of the time Frame to the end of it.284 { 285 map->insert(std::pair<std::time_t,Notification*>(it->first,it->second)); // !<Add the found Notifications to the map.287 for(it = itLowest; it != itHighest; it++) // Iterate through the Notifications from the start of the time Frame to the end of it. 288 { 289 map->insert(std::pair<std::time_t,Notification*>(it->first,it->second)); // Add the found Notifications to the map. 286 290 } 287 291
Note: See TracChangeset
for help on using the changeset viewer.