- Timestamp:
- Sep 24, 2010, 12:01:57 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk/src/modules/notifications/NotificationQueue.cc
r7484 r7488 38 38 39 39 #include "core/CoreIncludes.h" 40 #include "core/GameMode.h" 40 41 #include "core/GUIManager.h" 41 42 #include "core/LuaState.h" … … 112 113 this->targets_.clear(); 113 114 114 if(this->registered_) // If the 115 { 116 this->clear( );115 if(this->registered_) // If the NotificationQueue is registered. 116 { 117 this->clear(true); 117 118 118 119 // Unregister with the NotificationManager. 119 120 NotificationManager::getInstance().unregisterListener(this); 120 121 NotificationManager::getInstance().unregisterQueue(this); 121 122 // Remove the NotificationQueue in lua. 122 } 123 } 124 125 /** 126 @brief 127 Destroys the NotificationQueue. 128 Used in lua and NotificationManager. 129 @param noGraphics 130 If this is set to true (false is default), then the queue is not removed in lua. This is used to destroy the queue, after the GUIManager has been destroyed. 131 */ 132 void NotificationQueue::destroy(bool noGraphics) 133 { 134 // Remove the NotificationQueue in lua. 135 if(GameMode::showsGraphics() && !noGraphics) 123 136 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() + "\")"); 124 } 137 138 this->OrxonoxClass::destroy(); 125 139 } 126 140 … … 131 145 void NotificationQueue::create(void) 132 146 { 133 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.createQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->getMaxSize()) + ")"); 147 if(GameMode::showsGraphics()) 148 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.createQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->getMaxSize()) + ")"); 134 149 } 135 150 … … 226 241 227 242 // Push the Notification to the GUI. 228 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")"); 243 if(GameMode::showsGraphics()) 244 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")"); 229 245 } 230 246 … … 254 270 255 271 // Pops the Notification from the GUI. 256 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.popNotification(\"" + this->getName() + "\")"); 272 if(GameMode::showsGraphics()) 273 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.popNotification(\"" + this->getName() + "\")"); 257 274 } 258 275 … … 276 293 277 294 // Removes the Notification from the GUI. 278 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")"); 295 if(GameMode::showsGraphics()) 296 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")"); 279 297 } 280 298 … … 282 300 @brief 283 301 Clears the NotificationQueue by removing all NotificationContainers. 284 */ 285 void NotificationQueue::clear(void) 302 @param noGraphics 303 If this is eset to true the GUI is not informed of the clearing of the NotificationQueue. This is needed only internally. 304 */ 305 void NotificationQueue::clear(bool noGraphics) 286 306 { 287 307 this->ordering_.clear(); … … 295 315 296 316 // Clear the NotificationQueue in the GUI. 297 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.clearQueue(\"" + this->getName() + "\")"); 317 if(GameMode::showsGraphics() && !noGraphics) 318 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.clearQueue(\"" + this->getName() + "\")"); 298 319 } 299 320
Note: See TracChangeset
for help on using the changeset viewer.