Show confir dialog before aborting GP

git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@12492 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
auria 2013-02-17 00:20:40 +00:00
parent 020fc76df3
commit 61bcdffb64
2 changed files with 25 additions and 12 deletions

View File

@ -23,6 +23,7 @@
#include "challenges/unlock_manager.hpp"
#include "graphics/material.hpp"
#include "guiengine/engine.hpp"
#include "guiengine/modaldialog.hpp"
#include "guiengine/scalable_font.hpp"
#include "guiengine/widget.hpp"
#include "guiengine/widgets/icon_button_widget.hpp"
@ -225,17 +226,8 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
}
else if (name == "bottom") // Abort
{
cleanupGPProgress();
StateManager::get()->popMenu();
race_manager->exitRace();
race_manager->setAIKartOverride("");
StateManager::get()->resetAndGoToScreen(
MainMenuScreen::getInstance());
if (race_manager->raceWasStartedFromOverworld())
{
OverWorld::enterOverWorld();
}
new MessageDialog(_("Do you really want to abort the Grand Prix?"),
MessageDialog::MESSAGE_DIALOG_CONFIRM, this, false);
}
else if (!getWidget(name.c_str())->isVisible())
{
@ -281,6 +273,24 @@ void RaceResultGUI::eventCallback(GUIEngine::Widget* widget,
return;
} // eventCallback
//-----------------------------------------------------------------------------
void RaceResultGUI::onConfirm()
{
GUIEngine::ModalDialog::dismiss();
cleanupGPProgress();
StateManager::get()->popMenu();
race_manager->exitRace();
race_manager->setAIKartOverride("");
StateManager::get()->resetAndGoToScreen(
MainMenuScreen::getInstance());
if (race_manager->raceWasStartedFromOverworld())
{
OverWorld::enterOverWorld();
}
}
//-----------------------------------------------------------------------------
/** This determines the layout, i.e. the size of all columns, font size etc.
*/

View File

@ -25,6 +25,7 @@
#include <vector>
#include "guiengine/screen.hpp"
#include "states_screens/dialogs/message_dialog.hpp"
#include "states_screens/state_manager.hpp"
namespace irr
@ -43,7 +44,8 @@ class SFXBase;
*/
class RaceResultGUI : public RaceGUIBase,
public GUIEngine::Screen,
public GUIEngine::ScreenSingleton<RaceResultGUI>
public GUIEngine::ScreenSingleton<RaceResultGUI>,
public MessageDialog::IConfirmDialogListener
{
private:
/** Timer variable for animations. */
@ -250,6 +252,7 @@ public:
void setHighscore(const std::string &kart,
StateManager::ActivePlayer* player, int rank, int time);
virtual void onConfirm();
}; // RaceResultGUI
#endif