当前位置: 首页>>代码示例>>C++>>正文


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

本文整理汇总了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
开发者ID:ChristophHaag,项目名称:stk-code,代码行数:40,代码来源:player_manager.cpp

示例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
开发者ID:PalashBansal,项目名称:stk-code,代码行数:49,代码来源:options_screen_players.cpp

示例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
开发者ID:Elderme,项目名称:stk-code,代码行数:26,代码来源:user_screen.cpp


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