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


C++ PlayerState::getNetworkPlayerState方法代码示例

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


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

示例1: process

    virtual T process()
    {
        ObjectiveInterface::syncObjectives( connect_client );

        PowerUpInterface::syncPowerUps( connect_client );

        
        PlayerState * player = PlayerInterface::getPlayer(connect_client->getPlayerIndex());

        player->setStateSelectingFlag();

        PlayerFlagSync pfs;
        pfs.player_id = connect_client->player_id;
        ResourceManager::getFlag(connect_client->player_id)->frameToBuffer(pfs.player_flag, sizeof(pfs.player_flag));
        SERVER->broadcastMessage(&pfs, sizeof(pfs));

        PlayerStateSync player_state_update
            (player->getNetworkPlayerState());

        SERVER->broadcastMessage( &player_state_update, sizeof(PlayerStateSync));

        ConnectProcessStateMessage state_mesg;
        state_mesg.setMessageEnum(_connect_state_sync_complete);
        connect_client->sendMessage( &state_mesg,
                                     sizeof(ConnectProcessStateMessage));


        sendConnectionAlert( connect_client );
        if (GameControlRulesDaemon::getGameState() == _game_state_prepare_team)
        {
            GameControlCyclePrepareTeam prepare_team_mesg;
            SERVER->sendMessage(connect_client->player_id, &prepare_team_mesg, sizeof(GameControlCyclePrepareTeam));
        }
        return connect_state_idle;
    }
开发者ID:LucasVini,项目名称:OldNetPanzer,代码行数:35,代码来源:ServerConnectDaemon.cpp

示例2: updatemsg

Uint16
BotManager::addBot()
{
    PlayerState *p = PlayerInterface::allocateNewPlayer();
    if ( p )
    {
        Bot * b = new BotPlayer(p->getID());
        bot_list.push_back(b);

        ResourceManagerSyncFlagMessage flagmsg;
        ResourceManager::getFlagData("bot.bmp",(Uint8*)&flagmsg.flagdata);
        flagmsg.setFlagID(ResourceManager::registerFlagFromData((Uint8*)&flagmsg.flagdata));

        p->setName("Bot");
        p->setFlag(flagmsg.getFlagID());
        p->setStatus(_player_state_active);

        NetworkServer::broadcastMessage(&flagmsg, sizeof(flagmsg));

        PlayerStateSync updatemsg(p->getNetworkPlayerState());
        NetworkServer::broadcastMessage( &updatemsg, sizeof(updatemsg));

        SystemConnectAlert connect_alert;
        connect_alert.set( p->getID(), _connect_alert_mesg_connect );
        NetworkServer::broadcastMessage( &connect_alert, sizeof(SystemConnectAlert));
        NetworkClient::sendMessage(&connect_alert, sizeof(SystemConnectAlert));
        
        return p->getID();
    }
    return 0xffff;
}
开发者ID:BackupTheBerlios,项目名称:netpanzer-svn,代码行数:31,代码来源:BotManager.cpp

示例3: enter

    virtual void enter()
    {
        player = PlayerInterface::getPlayer(connect_client->getPlayerIndex());

        sync_count = 0;
        sync_done = 0;
        sync_end = 0;
        sync_total = UnitInterface::getTotalUnitCount();

        if ( sync_total )
        {
            sync_end = UnitInterface::getUnits().rbegin()->first;
        }

        sync_end += 1;

        ConnectProcessStateMessage state_mesg;
        state_mesg.setMessageEnum(_connect_state_message_sync_units);
        connect_client->sendMessage( &state_mesg,
                                     sizeof(ConnectProcessStateMessage));

        SERVER->addClientToSendList( connect_client );

        PlayerState *p = PlayerInterface::getPlayer(connect_client->getPlayerIndex());
        PlayerStateSync player_state_update( p->getNetworkPlayerState() );
        SERVER->broadcastMessage(&player_state_update, sizeof(PlayerStateSync));

        sendunitpercent_timer.reset();
        time_out_timer.reset();
    }
开发者ID:LucasVini,项目名称:OldNetPanzer,代码行数:30,代码来源:ServerConnectDaemon.cpp


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