Ask for confirmation to exit OpenMW

actorid
scrawl 11 years ago
parent a5598e9c2e
commit e5e1e84c52

@ -68,6 +68,11 @@ namespace MWGui
MWBase::Environment::get().getStateManager()->newGame();
}
void MainMenu::onExitConfirmed()
{
MWBase::Environment::get().getStateManager()->requestQuit();
}
void MainMenu::onButtonClicked(MyGUI::Widget *sender)
{
std::string name = *sender->getUserData<std::string>();
@ -82,7 +87,18 @@ namespace MWGui
else if (name == "credits")
MWBase::Environment::get().getWorld()->playVideo("mw_credits.bik", true);
else if (name == "exitgame")
MWBase::Environment::get().getStateManager()->requestQuit();
{
if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame)
onExitConfirmed();
else
{
ConfirmationDialog* dialog = MWBase::Environment::get().getWindowManager()->getConfirmationDialog();
dialog->open("#{sMessage2}");
dialog->eventOkClicked.clear();
dialog->eventOkClicked += MyGUI::newDelegate(this, &MainMenu::onExitConfirmed);
dialog->eventCancelClicked.clear();
}
}
else if (name == "newgame")
{
if (MWBase::Environment::get().getStateManager()->getState() == MWBase::StateManager::State_NoGame)

@ -33,6 +33,7 @@ namespace MWGui
void onButtonClicked (MyGUI::Widget* sender);
void onNewGameConfirmed();
void onExitConfirmed();
void updateMenu();

Loading…
Cancel
Save