/** Makes the correct buttons visible again, and gives them the right label. * 1) If something was unlocked, only a 'next' button is displayed. */ void RaceResultGUI::enableAllButtons() { GUIEngine::Widget *top = getWidget("top"); GUIEngine::Widget *middle = getWidget("middle"); GUIEngine::Widget *bottom = getWidget("bottom"); // If something was unlocked // ------------------------- int n = unlock_manager->getRecentlyUnlockedFeatures().size(); if(n>0) { top->setText(n==1 ? _("See unlocked feature") : _("See unlocked features")); top->setVisible(true); } else if (race_manager->getMajorMode() == RaceManager::MAJOR_MODE_GRAND_PRIX) { // In case of a GP: // ---------------- top->setText( _("Continue") ); top->setVisible(true); middle->setText( _("Restart") ); middle->setVisible(true); bottom->setText( _("Abort Grand Prix") ); bottom->setVisible(true); } else { // Normal race // ----------- top->setText( _("Setup New Race") ); top->setVisible(true); middle->setText( _("Restart") ); middle->setVisible(true); bottom->setText( _("Back to the menu") ); bottom->setVisible(true); } // Make sure that when 'fire' is pressed accidentally (e.g. pressing fire // very often to skip all results) that a good default is chosen (to // avoid aborting a GP by accident). for(int i=0; i<MAX_PLAYER_COUNT; i++) top->setFocusForPlayer(i); } // enableAllButtons
/** Makes the correct buttons visible again, and gives them the right label. * 1) If something was unlocked, only a 'next' button is displayed. */ void RaceResultGUI::enableAllButtons() { GUIEngine::Widget *top = getWidget("top"); GUIEngine::Widget *middle = getWidget("middle"); GUIEngine::Widget *bottom = getWidget("bottom"); if (race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX) { enableGPProgress(); } // If we're in a network world, change the buttons text if (World::getWorld()->isNetworkWorld()) { Log::info("This work was networked", "This is a network world."); top->setVisible(false); middle->setText( _("Continue.") ); middle->setVisible(true); middle->setFocusForPlayer(PLAYER_ID_GAME_MASTER); bottom->setText( _("Quit the server.") ); bottom->setVisible(true); if (race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX) { middle->setVisible(false); // you have to wait the server to start again bottom->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } return; } Log::info("This work was NOT networked", "This is NOT a network world."); // If something was unlocked // ------------------------- int n = unlock_manager->getCurrentSlot()->getRecentlyCompletedChallenges().size(); if(n>0) { top->setText(n==1 ? _("You completed a challenge!") : _("You completed challenges!")); top->setVisible(true); top->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } else if (race_manager->getMajorMode()==RaceManager::MAJOR_MODE_GRAND_PRIX) { // In case of a GP: // ---------------- top->setVisible(false); middle->setText( _("Continue") ); middle->setVisible(true); bottom->setText( _("Abort Grand Prix") ); bottom->setVisible(true); middle->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } else { // Normal race // ----------- middle->setText( _("Restart") ); middle->setVisible(true); if (race_manager->raceWasStartedFromOverworld()) { top->setVisible(false); bottom->setText( _("Back to challenge selection") ); } else { top->setText( _("Setup New Race") ); top->setVisible(true); bottom->setText( _("Back to the menu") ); } bottom->setVisible(true); bottom->setFocusForPlayer(PLAYER_ID_GAME_MASTER); } } // enableAllButtons