Change "Cancel" to 'Exit game' and make the back arrow invisible if

the login screen is shown before the race start.
This commit is contained in:
hiker 2014-10-10 16:19:25 +11:00
parent 8d587ab8f1
commit 6dc18a3557
2 changed files with 14 additions and 1 deletions

View File

@ -167,6 +167,10 @@ namespace GUIEngine
virtual void onTopMostScreenChanged() = 0;
// --------------------------------------------------------------------
/** Returns the number of screens on the stack. Is used to decide
* if exiting a screen would cause STK to end or not. */
unsigned int getMenuStackSize() const { return m_menu_stack.size(); }
}; // Class AbstractStateManager
} // GUIEngine

View File

@ -73,6 +73,15 @@ void BaseUserScreen::init()
m_info_widget = getWidget<LabelWidget>("message");
assert(m_info_widget);
// The behaviour of the screen is slightly different at startup, i.e.
// when it is the first screen: cancel will exit the game, and in
// this case no 'back' error should be shown.
bool is_first_screen = StateManager::get()->getMenuStackSize()==1;
getWidget<IconButtonWidget>("back")->setVisible(!is_first_screen);
getWidget<IconButtonWidget>("cancel")->setLabel(is_first_screen
? _("Exit game")
: _("Cancel") );
m_sign_out_name = "";
m_sign_in_name = "";
@ -293,7 +302,7 @@ void BaseUserScreen::eventCallback(Widget* widget,
}
else if (button == "cancel")
{
StateManager::get()->popMenu();
// EscapePressed will pop this screen.
StateManager::get()->escapePressed();
}
else if (button == "recover")