Ask for confirmation when selecting 'New Game'

actorid
scrawl 11 years ago
parent ecfaa41e93
commit 5562c78ac4

@ -13,6 +13,7 @@
#include "../mwstate/character.hpp"
#include "savegamedialog.hpp"
#include "confirmationdialog.hpp"
namespace MWGui
{
@ -62,6 +63,11 @@ namespace MWGui
OEngine::GUI::Layout::setVisible (visible);
}
void MainMenu::onNewGameConfirmed()
{
MWBase::Environment::get().getStateManager()->newGame();
}
void MainMenu::onButtonClicked(MyGUI::Widget *sender)
{
std::string name = *sender->getUserData<std::string>();
@ -77,7 +83,16 @@ namespace MWGui
MWBase::Environment::get().getStateManager()->requestQuit();
else if (name == "newgame")
{
MWBase::Environment::get().getStateManager()->newGame();
if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame)
onNewGameConfirmed();
else
{
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
dialog->open("#{sNotifyMessage54}");
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onNewGameConfirmed);
dialog->eventCancelClicked.clear();
}
}
else

@ -32,6 +32,7 @@ namespace MWGui
std::map<std::string, MWGui::ImageButton*> mButtons;
void onButtonClicked (MyGUI::Widget* sender);
void onNewGameConfirmed();
void updateMenu();

Loading…
Cancel
Save