本文整理汇总了C++中CCMenuItemImage::getUserData方法的典型用法代码示例。如果您正苦于以下问题:C++ CCMenuItemImage::getUserData方法的具体用法?C++ CCMenuItemImage::getUserData怎么用?C++ CCMenuItemImage::getUserData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCMenuItemImage
的用法示例。
在下文中一共展示了CCMenuItemImage::getUserData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: menuEnterGroupGameRoomCallback
void CGroupInfoScene::menuEnterGroupGameRoomCallback(CCObject* pSender)
{
CCMenuItemImage *pItem = (CCMenuItemImage*)pSender;
if( !pItem )
{
CCLog("ERROR, item is null");
return ;
}
CGameRoomInfo *room = (CGameRoomInfo*)pItem->getUserData();
CCLog( "room: %s:%d %d", room->ip.c_str(), room->port, room->roomid );
CGameManager::Instance().SetCurGameRoom( room );
if( CNetManager::Instance().Start( room->ip.c_str(), room->port ) )
{
CNetManager::Instance().SetState( CNetManager::E_State_Connecting_GameServer_ByGroup );
CCLog( "++++++ connect to game server" );
// 播放loading动画
CCSize visibleSize = CCDirector::sharedDirector()->getVisibleSize();
cocos2d::CCSprite *pSpriteLoading = CCSprite::create( PATCH_RES_DIR("loading.png") );
float w = (visibleSize.width) / 2;
float h = (visibleSize.height) / 2;
pSpriteLoading->setPosition( ccp(w, h) );
CCActionInterval *actionBy = CCRotateBy::create( 0.8, 360 );
CCActionInterval *seq = (CCActionInterval*)( CCSequence::create(actionBy, NULL) );
CCAction *act = CCRepeatForever::create( seq );
addChild( pSpriteLoading, 1 );
pSpriteLoading->runAction( act );
}
else
{
CGameManager::Instance().SetCurGameRoom( NULL );
}
}