// ---------------------------------------------------------------------------- void MainMenuScreen::onUpdate(float delta, irr::video::IVideoDriver* driver) { IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons"); if (addons_icon != NULL) { if (addons_manager->wasError()) { addons_icon->setActivated(); addons_icon->resetAllBadges(); addons_icon->setBadge(BAD_BADGE); } else if (addons_manager->isLoading() && UserConfigParams::m_internet_status == INetworkHttp::IPERM_ALLOWED) { // Addons manager is still initialising/downloading. addons_icon->setDeactivated(); addons_icon->resetAllBadges(); addons_icon->setBadge(LOADING_BADGE); } else { addons_icon->setActivated(); addons_icon->resetAllBadges(); } // maybe add a new badge when not allowed to access the net } LabelWidget* w = getWidget<LabelWidget>("info_addons"); w->update(delta); if(w->scrolledOff()) { const core::stringw &news_text = news_manager->getNextNewsMessage(); w->setText(news_text, true); } } // onUpdate
// ---------------------------------------------------------------------------- void MainMenuScreen::onUpdate(float delta) { PlayerProfile *player = PlayerManager::getCurrentPlayer(); if(PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_GUEST || PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_IN) { m_user_id->setText(player->getLastOnlineName() + "@stk"); m_online->setActivated(); m_online->setLabel( _("Online")); } else if (PlayerManager::getCurrentOnlineState() == PlayerProfile::OS_SIGNED_OUT) { m_online->setActivated(); m_online->setLabel( _("Login" )); m_user_id->setText(player->getName()); } else { // now must be either logging in or logging out m_online->setDeactivated(); m_user_id->setText(player->getName()); } m_online->setLabel(PlayerManager::getCurrentOnlineId() ? _("Online") : _("Login" ) ); IconButtonWidget* addons_icon = getWidget<IconButtonWidget>("addons"); if (addons_icon != NULL) { if (addons_manager->wasError()) { addons_icon->setActivated(); addons_icon->resetAllBadges(); addons_icon->setBadge(BAD_BADGE); } else if (addons_manager->isLoading() && UserConfigParams::m_internet_status == Online::RequestManager::IPERM_ALLOWED) { // Addons manager is still initialising/downloading. addons_icon->setDeactivated(); addons_icon->resetAllBadges(); addons_icon->setBadge(LOADING_BADGE); } else { addons_icon->setActivated(); addons_icon->resetAllBadges(); } // maybe add a new badge when not allowed to access the net } LabelWidget* w = getWidget<LabelWidget>("info_addons"); w->update(delta); if(w->scrolledOff()) { const core::stringw &news_text = NewsManager::get()->getNextNewsMessage(); w->setText(news_text, true); } } // onUpdate