Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 9969


Ignore:
Timestamp:
Jan 4, 2014, 2:14:06 PM (11 years ago)
Author:
jo
Message:

Automatically show the menu for gametypes that call Gametype::end() - after a 3 second delay.

Location:
code/trunk/src/orxonox/gametypes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/gametypes/Gametype.cc

    r9939 r9969  
    3535#include "core/GameMode.h"
    3636#include "core/command/ConsoleCommand.h"
     37#include "gamestates/GSLevel.h"
    3738
    3839#include "infos/PlayerInfo.h"
     
    6162        this->bAutoStart_ = false;
    6263        this->bForceSpawn_ = false;
     64        this->bAutoEnd_ = true;
    6365        this->numberOfBots_ = 0;
    6466
     
    104106        SetConfigValue(bAutoStart_, false);
    105107        SetConfigValue(bForceSpawn_, false);
     108        SetConfigValue(bAutoEnd_, true);
    106109        SetConfigValue(numberOfBots_, 0);
    107110        SetConfigValue(scoreboardTemplate_, "defaultScoreboard");
     
    144147    {
    145148        this->addBots(this->numberOfBots_);
    146 
    147149        this->gtinfo_->start();
    148 
    149150        this->spawnPlayersIfRequested();
    150151    }
     
    153154    {
    154155        this->gtinfo_->end();
     156        if (this->bAutoEnd_)
     157            this->showMenuTimer_.setTimer(2.5f, true, createExecutor(createFunctor(&Gametype::showMenu, this)));
    155158
    156159        for (std::map<PlayerInfo*, Player>::iterator it = this->players_.begin(); it != this->players_.end(); ++it)
     
    515518        this->time_ = t;
    516519    }
     520
     521    void Gametype::showMenu()
     522    {
     523        GSLevel::startMainMenu();
     524    }
    517525}
  • code/trunk/src/orxonox/gametypes/Gametype.h

    r9667 r9969  
    4040#include "tools/interfaces/Tickable.h"
    4141#include "infos/GametypeInfo.h"
     42#include "tools/Timer.h"
    4243
    4344namespace orxonox
     
    158159            inline unsigned int getNumberOfPlayers() const
    159160                { return this->players_.size(); }
    160 
     161            void showMenu();
    161162
    162163
     
    175176            bool bAutoStart_;
    176177            bool bForceSpawn_;
     178            bool bAutoEnd_;
    177179
    178180            float time_;
     
    197199            ConsoleCommand* dedicatedKillBots_;
    198200            /* HACK HACK HACK */
    199 
     201            Timer showMenuTimer_;
    200202    };
    201203}
Note: See TracChangeset for help on using the changeset viewer.