C++ PlayerProfile::hasSavedSession方法代码示例

您所在的位置:网站首页 logouterror C++ PlayerProfile::hasSavedSession方法代码示例

C++ PlayerProfile::hasSavedSession方法代码示例

#C++ PlayerProfile::hasSavedSession方法代码示例| 来源: 网络整理| 查看: 265

本文整理汇总了C++中PlayerProfile::hasSavedSession方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerProfile::hasSavedSession方法的具体用法?C++ PlayerProfile::hasSavedSession怎么用?C++ PlayerProfile::hasSavedSession使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PlayerProfile的用法示例。

在下文中一共展示了PlayerProfile::hasSavedSession方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: makeEntryFieldsVisible /** Make the entry fields either visible or invisible. * \param online Online state, which dicates if the entry fields are * visible (true) or not. */ void BaseUserScreen::makeEntryFieldsVisible() { #ifdef GUEST_ACCOUNTS_ENABLED getWidget("label_guest")->setVisible(online); getWidget("guest")->setVisible(online); #endif bool online = m_online_cb->getState(); getWidget("label_username")->setVisible(online); m_username_tb->setVisible(online); getWidget("label_remember")->setVisible(online); getWidget("remember-user")->setVisible(online); PlayerProfile *player = getSelectedPlayer(); if(player && player->hasSavedSession() && online) { // If we show the online login fields, but the player has a // saved session, don't show the password field. getWidget("label_password")->setVisible(false); m_password_tb->setVisible(false); } else { getWidget("label_password")->setVisible(online); m_password_tb->setVisible(online); } } // makeEntryFieldsVisible开发者ID:shantanusingh10,项目名称:stk-code,代码行数:29,代码来源:user_screen.cpp 示例2: makeEntryFieldsVisible /** Make the entry fields either visible or invisible. * \param online Online state, which dicates if the entry fields are * visible (true) or not. */ void BaseUserScreen::makeEntryFieldsVisible() { #ifdef GUEST_ACCOUNTS_ENABLED getWidget("label_guest")->setVisible(online); getWidget("guest")->setVisible(online); #endif bool online = m_online_cb->getState(); getWidget("label_username")->setVisible(online); m_username_tb->setVisible(online); getWidget("label_remember")->setVisible(online); getWidget("remember-user")->setVisible(online); PlayerProfile *player = getSelectedPlayer(); // Don't show the password fields if the player wants to be online // and either is the current player and logged in (no need to enter a // password then) or has a saved session. if(player && online && (player->hasSavedSession() || (player==PlayerManager::getCurrentPlayer() && player->isLoggedIn() ) ) ) { // If we show the online login fields, but the player has a // saved session, don't show the password field. getWidget("label_password")->setVisible(false); m_password_tb->setVisible(false); } else { getWidget("label_password")->setVisible(online); m_password_tb->setVisible(online); } } // makeEntryFieldsVisible开发者ID:kunal-d,项目名称:stk-code,代码行数:37,代码来源:user_screen.cpp 示例3: selectUser /** Called when a user is selected. It updates the online checkbox and * entry fields. */ void BaseUserScreen::selectUser(int index) { PlayerProfile *profile = PlayerManager::get()->getPlayer(index); assert(profile); // Only set focus in case of non-tabbed version (so that keyboard // or gamepad navigation with tabs works as expected, i.e. you can // select the next tab without having to go up to the tab list first. bool focus_it = !getWidget("options_choice"); m_players->setSelection(StringUtils::toString(index), PLAYER_ID_GAME_MASTER, focus_it); if (!m_new_registered_data) m_username_tb->setText(profile->getLastOnlineName(true/*ignoreRTL*/)); if (!m_new_registered_data) { // Delete a password that might have been typed for another user m_password_tb->setText(""); } getWidget("remember-user")->setState( profile->rememberPassword()); // Last game was not online, so make the offline settings the default // (i.e. unckeck online checkbox, and make entry fields invisible). if (!profile->wasOnlineLastTime() || profile->getLastOnlineName() == "") { if (!m_new_registered_data) m_online_cb->setState(false); makeEntryFieldsVisible(); return; } // Now last use was with online --> Display the saved data if (UserConfigParams::m_internet_status == Online::RequestManager::IPERM_NOT_ALLOWED) m_online_cb->setState(false); else m_online_cb->setState(true); makeEntryFieldsVisible(); m_username_tb->setActive(profile->getLastOnlineName().size() == 0); // And make the password invisible if the session is saved (i.e // the user does not need to enter a password). if (profile->hasSavedSession()) { m_password_tb->setVisible(false); getWidget("label_password")->setVisible(false); getWidget("password_reset")->setVisible(false); } } // selectUser开发者ID:devnexen,项目名称:stk-code,代码行数:56,代码来源:user_screen.cpp 示例4: logoutError /** Callback from player profile if login was unsuccessful. * \param error_message Contains the error message. */ void BaseUserScreen::logoutError(const irr::core::stringw & error_message) { m_state = (UserScreenState) (m_state & ~STATE_LOGOUT); PlayerProfile *player = getSelectedPlayer(); // Clear information about saved session in case of a problem, // which allows the player to enter a new password. if(player && player->hasSavedSession()) player->clearSession(); makeEntryFieldsVisible(); SFXManager::get()->quickSound("anvil"); m_info_widget->setErrorColor(); m_info_widget->setText(error_message, false); m_options_widget->setActive(true); } // logoutError开发者ID:Elderme,项目名称:stk-code,代码行数:17,代码来源:user_screen.cpp 示例5: selectUser /** Called when a user is selected. It updates the online checkbox and * entrye fields. */ void BaseUserScreen::selectUser(int index) { PlayerProfile *profile = PlayerManager::get()->getPlayer(index); assert(profile); m_players->setSelection(StringUtils::toString(index), PLAYER_ID_GAME_MASTER, /*focusIt*/ true); m_username_tb->setText(profile->getLastOnlineName()); // Delete a password that might have been typed for another user m_password_tb->setText(""); // Last game was not online, so make the offline settings the default // (i.e. unckeck online checkbox, and make entry fields invisible). if (!profile->wasOnlineLastTime() || profile->getLastOnlineName() == "") { m_online_cb->setState(false); makeEntryFieldsVisible(); return; } // Now last use was with online --> Display the saved data m_online_cb->setState(true); makeEntryFieldsVisible(); getWidget("remember-user")->setState( profile->rememberPassword()); if(profile->getLastOnlineName().size()>0) m_username_tb->setDeactivated(); else m_username_tb->setActivated(); // And make the password invisible if the session is saved (i.e // the user does not need to enter a password). if (profile->hasSavedSession()) { m_password_tb->setVisible(false); getWidget("label_password")->setVisible(false); } } // selectUser开发者ID:kunal-d,项目名称:stk-code,代码行数:43,代码来源:user_screen.cpp 示例6: login /** Called when OK or OK-and-save is clicked. * This will trigger the actual login (if requested) etc. * \param remember_me True if the login details should be remembered, * so that next time this menu can be skipped. */ void BaseUserScreen::login() { // If an error occurs, the callback informing this screen about the // problem will activate the widget again. m_options_widget->setActive(false); m_state = STATE_NONE; PlayerProfile *player = getSelectedPlayer(); PlayerProfile *current = PlayerManager::getCurrentPlayer(); core::stringw new_username = m_username_tb->getText(); // If a different player is connecting, or the same local player with // a different online account, log out the current player. if(current && current->isLoggedIn() && (player!=current || current->getLastOnlineName(true/*ignoreRTL*/)!=new_username) ) { m_sign_out_name = current->getLastOnlineName(true/*ignoreRTL*/); current->requestSignOut(); m_state = (UserScreenState)(m_state | STATE_LOGOUT); // If the online user name was changed, reset the save data // for this user (otherwise later the saved session will be // resumed, not logging the user with the new account). if(player==current && current->getLastOnlineName(true/*ignoreRTL*/)!=new_username) current->clearSession(); } PlayerManager::get()->setCurrentPlayer(player); assert(player); // If no online login requested, log the player out (if necessary) // and go to the main menu screen (though logout needs to finish first) if(!m_online_cb->getState()) { if(player->isLoggedIn()) { m_sign_out_name =player->getLastOnlineName(true/*ignoreRTL*/); player->requestSignOut(); m_state =(UserScreenState)(m_state| STATE_LOGOUT); } player->setWasOnlineLastTime(false); if(m_state==STATE_NONE) { closeScreen(); } return; } // Player wants to be online, and is already online - nothing to do if(player->isLoggedIn()) { player->setWasOnlineLastTime(true); closeScreen(); return; } m_state = (UserScreenState) (m_state | STATE_LOGIN); // Now we need to start a login request to the server // This implies that this screen will wait till the server responds, so // that error messages ('invalid password') can be shown, and the user // can decide what to do about them. if (player->hasSavedSession()) { m_sign_in_name = player->getLastOnlineName(true/*ignoreRTL*/); // Online login with saved token player->requestSavedSession(); } else { // Online login with password --> we need a valid password if (m_password_tb->getText() == "") { m_info_widget->setText(_("You need to enter a password."), true); SFXManager::get()->quickSound("anvil"); m_options_widget->setActive(true); return; } m_sign_in_name = m_username_tb->getText(); player->requestSignIn(m_username_tb->getText(), m_password_tb->getText()); } // !hasSavedSession } // login开发者ID:Elderme,项目名称:stk-code,代码行数:88,代码来源:user_screen.cpp

注:本文中的PlayerProfile::hasSavedSession方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。



【本文地址】


今日新闻


推荐新闻


CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3