Disable online flag in register screen if user did not enable
internet in the dialog. Removed unused function.
This commit is contained in:
@@ -89,17 +89,11 @@ void RegisterScreen::init()
|
||||
|
||||
getWidget<CheckBoxWidget>("online")->setVisible(true);
|
||||
getWidget<LabelWidget>("label_online")->setVisible(true);
|
||||
// Check if online is allowed
|
||||
if (UserConfigParams::m_internet_status != Online::RequestManager::IPERM_NOT_ALLOWED)
|
||||
{
|
||||
getWidget<CheckBoxWidget>("online")->setState(true);
|
||||
makeEntryFieldsVisible(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
getWidget<CheckBoxWidget>("online")->setState(false);
|
||||
makeEntryFieldsVisible(false);
|
||||
}
|
||||
onDialogClose();
|
||||
bool online = UserConfigParams::m_internet_status
|
||||
!= Online::RequestManager::IPERM_NOT_ALLOWED;
|
||||
getWidget<CheckBoxWidget>("online")->setState(online);
|
||||
makeEntryFieldsVisible(online);
|
||||
} // init
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
@@ -108,6 +102,19 @@ void RegisterScreen::setRename(PlayerProfile *player)
|
||||
m_existing_player = player;
|
||||
} // setRename
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Will be called first time STK is started, when the 'internet yes/no' dialog
|
||||
* is closed. Adjust the state of the online checkbox depending on that
|
||||
* answer.
|
||||
*/
|
||||
void RegisterScreen::onDialogClose()
|
||||
{
|
||||
bool online = UserConfigParams::m_internet_status
|
||||
!= Online::RequestManager::IPERM_NOT_ALLOWED;
|
||||
getWidget<CheckBoxWidget>("online")->setState(online);
|
||||
makeEntryFieldsVisible(online);
|
||||
} // onDialogClose
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
/** Shows or hides the entry fields for online registration, depending on
|
||||
* online mode.
|
||||
|
||||
@@ -64,6 +64,7 @@ public:
|
||||
virtual void loadedFromFile() OVERRIDE {};
|
||||
virtual void onUpdate(float dt) OVERRIDE;
|
||||
virtual bool onEscapePressed() OVERRIDE;
|
||||
virtual void onDialogClose() OVERRIDE;
|
||||
void setRename(PlayerProfile *player);
|
||||
|
||||
void acceptTerms();
|
||||
|
||||
@@ -560,34 +560,6 @@ void BaseUserScreen::unloaded()
|
||||
} // unloaded
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
/** Gets called when a dialog closes. At a first time start of STK the
|
||||
* internet dialog is shown first. Only when this dialog closes is it possible
|
||||
* to open the next dialog, which is the one to create a new player (which
|
||||
* is conventient on a first start).
|
||||
*/
|
||||
void BaseUserScreen::onDialogClose()
|
||||
{
|
||||
return;
|
||||
// To allow players to exit the game without creating a player, we count
|
||||
// how often this function was called. The first time is after the
|
||||
// internet allowed dialog, the 2nd time
|
||||
static int number_of_calls = 0;
|
||||
number_of_calls++;
|
||||
if(PlayerManager::get()->getNumPlayers() == 0)
|
||||
{
|
||||
// Still 0 players after the enter player dialog was shown
|
||||
// --> User wanted to abort, so pop this menu, which will
|
||||
// trigger the end of STK.
|
||||
if (number_of_calls > 1)
|
||||
{
|
||||
StateManager::get()->popMenu();
|
||||
return;
|
||||
}
|
||||
StateManager::get()->pushScreen(RegisterScreen::getInstance());
|
||||
} // getNumPlayers == 0
|
||||
} // onDialogClose
|
||||
|
||||
|
||||
// ============================================================================
|
||||
/** In the tab version, make sure the right tab is selected.
|
||||
|
||||
@@ -89,7 +89,6 @@ private:
|
||||
void deletePlayer();
|
||||
void doDeletePlayer();
|
||||
PlayerProfile* getSelectedPlayer();
|
||||
virtual void onDialogClose();
|
||||
virtual void onUpdate(float dt) OVERRIDE;
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user