- Timestamp:
- May 11, 2011, 12:21:32 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/tutoriallevel2/src/modules/notifications/NotificationQueue.cc
r8445 r8446 38 38 39 39 #include "core/CoreIncludes.h" 40 #include "core/GameMode.h"41 #include "core/GUIManager.h"42 #include "core/LuaState.h"43 #include "util/Convert.h"44 40 #include "util/SubString.h" 45 41 … … 88 84 } 89 85 90 this->create(); // Creates the NotificationQueue in lua.91 92 86 COUT(3) << "NotificationQueue '" << this->getName() << "' created." << std::endl; 93 87 } … … 108 102 NotificationManager::getInstance().unregisterQueue(this); 109 103 } 110 } 111 112 /** 113 @brief 114 Destroys the NotificationQueue. 115 Used in lua and NotificationManager. 116 @param noGraphics 117 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. 118 */ 119 void NotificationQueue::destroy(bool noGraphics) 120 { 121 // Remove the NotificationQueue in lua. 122 if(GameMode::showsGraphics() && !noGraphics) 123 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeQueue(\"" + this->getName() + "\")"); 124 104 125 105 COUT(3) << "NotificationQueue '" << this->getName() << "' destroyed." << std::endl; 126 127 this->OrxonoxClass::destroy();128 }129 130 /**131 @brief132 Creates the NotificationQueue in lua.133 */134 void NotificationQueue::create(void)135 {136 if(GameMode::showsGraphics())137 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.createQueue(\"" + this->getName() + "\", " + multi_cast<std::string>(this->getMaxSize()) + ")");138 106 } 139 107 … … 236 204 this->notifications_.insert(this->notifications_.begin(), container); 237 205 238 // Push the Notification to the GUI. 239 if(GameMode::showsGraphics()) 240 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.pushNotification(\"" + this->getName() + "\", \"" + notification->getMessage() + "\")"); 206 // Inform that a Notification was pushed. 207 this->notificationPushed(notification); 241 208 242 209 COUT(5) << "Notification \"" << notification->getMessage() << "\" pushed to NotificationQueue '" << this->getName() << "'" << endl; … … 269 236 delete container; 270 237 271 // Pops the Notification from the GUI. 272 if(GameMode::showsGraphics()) 273 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.popNotification(\"" + this->getName() + "\")"); 238 // Inform that a Notification was popped. 239 this->notificationPopped(); 274 240 } 275 241 … … 295 261 delete *containerIterator; 296 262 297 // Removes the Notification from the GUI.298 if(GameMode::showsGraphics())299 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.removeNotification(\"" + this->getName() + "\", " + multi_cast<std::string>(index) + ")");263 // TODO: index automatically cast? 264 // Inform that a Notification was removed. 265 this->notificationRemoved(index); 300 266 } 301 267 … … 316 282 this->notifications_.clear(); 317 283 this->size_ = 0; 318 319 // Clear the NotificationQueue in the GUI.320 if(GameMode::showsGraphics() && !noGraphics)321 GUIManager::getInstance().getLuaState()->doString("NotificationLayer.clearQueue(\"" + this->getName() + "\")");322 284 } 323 285
Note: See TracChangeset
for help on using the changeset viewer.