| 229 | } |
| 230 | |
| 231 | void GameEditorModeBase::updateMessages(Ogre::Real update_time) |
| 232 | { |
| 233 | float maxChatTimeDisplay = ODFrameListener::getSingleton().getEventMaxTimeDisplay(); |
| 234 | |
| 235 | // Update the event message seen if necessary. |
| 236 | CEGUI::Window* shortNoticeText = mRootWindow->getChild("GameEventText"); |
| 237 | CEGUI::Scrollbar* scrollBar = static_cast<CEGUI::Scrollbar*>(shortNoticeText->getChild("__auto_vscrollbar__")); |
| 238 | float scrollPosition = scrollBar->getScrollPosition(); |
| 239 | |
| 240 | // Update the chat message seen if necessary. |
| 241 | bool messageDisplayUpdate = false; |
| 242 | CEGUI::String ceguiStr; |
| 243 | for (auto it = mEventMessages.begin(); it != mEventMessages.end();) |
| 244 | { |
| 245 | EventMessage* event = *it; |
| 246 | if (event->isMessageTooOld(maxChatTimeDisplay)) |
| 247 | { |
| 248 | delete event; |
| 249 | it = mEventMessages.erase(it); |
| 250 | messageDisplayUpdate = true; |
| 251 | } |
| 252 | else |
| 253 | { |
| 254 | ceguiStr += reinterpret_cast<const CEGUI::utf8*>(event->getMessageAsString().c_str()); |
| 255 | ++it; |
| 256 | } |
| 257 | } |
| 258 | |
| 259 | if (messageDisplayUpdate) |
| 260 | { |
| 261 | shortNoticeText->setText(ceguiStr); |
| 262 | scrollBar->setScrollPosition(scrollPosition); |
| 263 | } |
| 264 | |
| 265 | if(mChatMessageDisplayTime > 0) |
| 266 | { |
| 267 | // The chat box is displayed |
| 268 | if(update_time < mChatMessageDisplayTime) |
| 269 | { |
| 270 | mChatMessageDisplayTime -= update_time; |
| 271 | } |
| 272 | else |
| 273 | { |
| 274 | mChatMessageDisplayTime = 0; |
| 275 | mChatMessageBoxDisplay &= ~ChatMessageBoxDisplay::showMessageReceived; |
| 276 | refreshChatDisplay(); |
| 277 | } |
| 278 | } |
| 279 | } |
| 280 | |
| 281 | void GameEditorModeBase::refreshChatDisplay() |
| 282 | { |
nothing calls this directly
no test coverage detected