Pre-fill online username with local username.

This commit is contained in:
hiker 2015-01-21 08:14:56 +11:00
parent 7725a26dfb
commit b6c26651e0
2 changed files with 17 additions and 1 deletions

View File

@ -137,6 +137,19 @@ void RegisterScreen::onDialogClose()
makeEntryFieldsVisible();
} // onDialogClose
// -----------------------------------------------------------------------------
void RegisterScreen::onFocusChanged(GUIEngine::Widget* previous,
GUIEngine::Widget* focus, int playerID)
{
TextBoxWidget *online_name = getWidget<TextBoxWidget>("username");
if (focus == online_name)
{
TextBoxWidget *local_name = getWidget<TextBoxWidget>("local_username");
if (online_name->getText() == "")
online_name->setText(local_name->getText());
}
} // onFocusChanged
// -----------------------------------------------------------------------------
/** Shows or hides the entry fields for online registration, depending on
* online mode.

View File

@ -78,7 +78,10 @@ public:
virtual void loadedFromFile() OVERRIDE {};
virtual void onUpdate(float dt) OVERRIDE;
virtual bool onEscapePressed() OVERRIDE;
virtual void onDialogClose() OVERRIDE;
virtual void onDialogClose() OVERRIDE;
virtual void onFocusChanged(GUIEngine::Widget *previous,
GUIEngine::Widget *focus,
int playerID);
void setRename(PlayerProfile *player);
void acceptTerms();