Пример #1
0
 /** Updates all widgets that need to be updated.
  *  \param dt Time step size.
  */
 void update(float dt)
 {
     // Just to mark the begin/end scene block
     GUIEngine::GameState state = StateManager::get()->getGameState();
     if (state != GUIEngine::GAME)
     {
         // This code needs to go outside beginScene() / endScene() since
         // the model view widget will do off-screen rendering there
         GUIEngine::Widget* widget;
         for_in (widget, GUIEngine::needsUpdate)
         {
             widget->update(dt);
         }
Пример #2
0
/** 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
Пример #3
0
/** 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