本文整理汇总了C++中PlayerProfile::isGuestAccount方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerProfile::isGuestAccount方法的具体用法?C++ PlayerProfile::isGuestAccount怎么用?C++ PlayerProfile::isGuestAccount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerProfile
的用法示例。
在下文中一共展示了PlayerProfile::isGuestAccount方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: enforceCurrentPlayer
/** This function makes sure that a current player is defined. This is called
* when a screen skipping command line option is given (-N, -R, ...), in
* which case there might not be a current player (if no default player is
* set in players.xml, i.e. the 'remember be' option was not picked ). Since
* a lot of code depends on having a local player, just set the most
* frequently used non-guest to be the current player.
*/
void PlayerManager::enforceCurrentPlayer()
{
if (m_current_player) return;
PlayerProfile* player;
for_in(player, m_all_players)
{
if (!player->isGuestAccount())
{
Log::info("PlayerManager", "Enfocring current player '%ls'.",
player->getName().c_str() );
m_current_player = player;
return;
}
} // for player in m_all_players
// This shouldn't happen - but just in case: add the default players
// again, and search again for a non-guest player.
addDefaultPlayer();
for_in(player, m_all_players)
{
if (!player->isGuestAccount())
{
Log::info("PlayerManager", "Enfocring current player '%s'.",
player->getName().c_str());
m_current_player = player;
return;
}
} // for player in m_all_players
// Now this really really should not happen.
Log::fatal("PlayerManager", "Failed to find a non-guest player.");
} // enforceCurrentPlayer
示例2: eventCallback
void OptionsScreenPlayers::eventCallback(Widget* widget, const std::string& name, const int playerID)
{
if (name == "options_choice")
{
std::string selection = ((RibbonWidget*)widget)->getSelectionIDString(PLAYER_ID_GAME_MASTER).c_str();
if (selection == "tab_audio") StateManager::get()->replaceTopMostScreen(OptionsScreenAudio::getInstance());
else if (selection == "tab_video") StateManager::get()->replaceTopMostScreen(OptionsScreenVideo::getInstance());
else if (selection == "tab_players") StateManager::get()->replaceTopMostScreen(OptionsScreenPlayers::getInstance());
else if (selection == "tab_controls") StateManager::get()->replaceTopMostScreen(OptionsScreenInput::getInstance());
else if (selection == "tab_ui") StateManager::get()->replaceTopMostScreen(OptionsScreenUI::getInstance());
}
else if (name == "back")
{
StateManager::get()->escapePressed();
}
else if (name == "addplayer")
{
new EnterPlayerNameDialog(this, 0.5f, 0.4f);
}
else if (name == "players")
{
// Find which player in the list was clicked
ListWidget* players = this->getWidget<ListWidget>("players");
assert(players != NULL);
core::stringw selectedPlayer = players->getSelectionLabel();
const int player_amount = PlayerManager::get()->getNumPlayers();
for (int i=0; i<player_amount; i++)
{
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
if (selectedPlayer == translations->fribidize(player->getName()))
{
if (!(player->isGuestAccount()))
{
new PlayerInfoDialog( player, 0.5f, 0.6f );
}
return;
}
} // end for
}
else if (name == "playername")
{
race_manager->clearKartLastPositionOnOverworld();
PlayerManager::get()->setCurrentPlayer(NULL,false);
StateManager::get()->pushScreen(StoryModeLobbyScreen::getInstance());
}
} // eventCallback
示例3: doDeletePlayer
/** Callback when the user confirms to delete a player. This function actually
* deletes the player, discards the dialog, and re-initialised the BaseUserScreen
* to display only the available players.
*/
void BaseUserScreen::doDeletePlayer()
{
PlayerProfile *player = getSelectedPlayer();
PlayerManager::get()->deletePlayer(player);
GUIEngine::ModalDialog::dismiss();
// Special case: the current player was deleted. We have to make sure
// that there is still a current player (all of STK depends on that).
if(!PlayerManager::getCurrentPlayer())
{
for(unsigned int i=0; i<PlayerManager::get()->getNumPlayers(); i++)
{
PlayerProfile *player = PlayerManager::get()->getPlayer(i);
if(!player->isGuestAccount())
{
PlayerManager::get()->setCurrentPlayer(player);
break;
}
}
}
init();
} // doDeletePlayer