本文整理汇总了C++中CCScene::getChildByTag方法的典型用法代码示例。如果您正苦于以下问题:C++ CCScene::getChildByTag方法的具体用法?C++ CCScene::getChildByTag怎么用?C++ CCScene::getChildByTag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCScene
的用法示例。
在下文中一共展示了CCScene::getChildByTag方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setVisible
void HSGameShopLayer::setVisible(bool visible)
{
#define HS_Shop_Tag 0x75699
CCLayer::setVisible(visible);
if(visible)
{
Shop_FlyIn(*m_p_shop_frame,m_shop_frame_Position);
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
if (!pScene->getChildByTag(HS_Shop_Tag))
{
pScene->addChild(this,HS_Shop_Tag,HS_Shop_Tag);
}
}
else
{
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
if (pScene->getChildByTag(HS_Shop_Tag))
{
pScene->removeChildByTag(HS_Shop_Tag);
}
}
}
示例2: setVisible
void HSLoadingLayer::setVisible(bool visible)
{
#define HS_Loadong_Tag 0x75698
if (visible)
{
if(!this->isVisible())
{
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
if (pScene && !pScene->getChildByTag(HS_Loadong_Tag))
{
this->schedule(schedule_selector(HSLoadingLayer::Updata), 1.f);
m_time = 15;
pScene->addChild(this, HS_Loadong_Tag, HS_Loadong_Tag);
}
}
}
else
{
this->SetTipsUp("");
this->m_pTipsTTFUp->setString("");
this->removeFromParent();
}
CCLayer::setVisible(visible);
}
示例3: singlePlayerScene
cocos2d::CCScene* BYGameScene::singlePlayerScene() {
CCScene* scene = BYGameScene::scene();
BYGameScene* layer = (BYGameScene*) scene->getChildByTag(GUI_MainLayer);
layer->initWithSinglePlayer();
return scene;
}
示例4: layerWithTag
CCLayer* Utils::layerWithTag(int tag) {
CCScene *sc = CCDirector::sharedDirector()->getRunningScene();
if (sc->getTag() == TAG_GAME_SCENE) {
CCLayer *layer = (CCLayer *)sc->getChildByTag(tag);
return layer;
}
return NULL;
}
示例5: GameInToSectionLayer
void LevelManager::GameInToSectionLayer()
{
setNext(false);
ResManager::getManager()->removeAllArmatureInfo();
CCScene* pScene = Starseneui::scene();
Starseneui* pLayer = (Starseneui*)pScene->getChildByTag(Starseneui_tag);
pLayer->Goxiaogk(Smalllayer_tag);
CCTransitionFade* pTran = CCTransitionFade::create(0.5f, pScene, ccWHITE);
CCDirector::sharedDirector()->replaceScene(pTran);
}
示例6: setVisible
void HSDailyRewardSystemLayer::setVisible( bool visible )
{
#define HS_DailyRewardSystemLayer_Tag 0x75699
if (visible)
{
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
if (!pScene->getChildByTag(HS_DailyRewardSystemLayer_Tag))
{
pScene->addChild(this,HS_DailyRewardSystemLayer_Tag);
}
}else{
CCScene* pScene = CCDirector::sharedDirector()->getRunningScene();
if (pScene->getChildByTag(HS_DailyRewardSystemLayer_Tag))
{
pScene->removeChildByTag(HS_DailyRewardSystemLayer_Tag);
}
}
CCLayer::setVisible(visible);
}
示例7: applicationDidEnterBackground
// This function will be called when the app is inactive. When comes a phone call,it's be invoked too
void AppDelegate::applicationDidEnterBackground() {
CCDirector::sharedDirector()->stopAnimation();
//Retrieve HelloWorld scene by using the tag and call the pauseGame method
CCScene* scene = (CCDirector::sharedDirector()->getRunningScene());
if (scene !=NULL) {
HelloWorld* helloWorldScene = dynamic_cast <HelloWorld*>(scene->getChildByTag(100));
if (helloWorldScene != NULL) {
helloWorldScene->pauseGame();
}
}
}
示例8: getGameLayer
InGameScene* InGameScene::getGameLayer() {
CCDirector* pDirector = CCDirector::sharedDirector();
CCScene* pScene = pDirector->getRunningScene();
int tag = pScene->getTag();
if(tag == TAG_INGAMESCENE) {
CCNode* pNode = pScene->getChildByTag(TAG_INGAMELAYER);
if(pNode != NULL) {
return (InGameScene*)pNode;
} else {
return NULL;
}
} else {
return NULL;
}
}
示例9: GetBattleLayer
BattleLayer* CommonLookUpUtils::GetBattleLayer()
{
CCScene* pRunningScene = CCDirector::sharedDirector()->getRunningScene();
if (pRunningScene)
{
CCNode* pNode = pRunningScene->getChildByTag(TAG_LAYER_BATTLE);
if (pNode)
{
BattleLayer* pBattleLayer = dynamic_cast<BattleLayer*>(pNode);
return pBattleLayer;
}
}
return NULL;
}
示例10: happen
void DuelEvent::happen()
{
CCScene* pScene = Combat::scene();
Combat* pLayer = (Combat*)pScene->getChildByTag(COMBATLAYER);
//pass args(defined in CSV) here
CCInteger* intg = (CCInteger*) this->args->lastObject();
if(intg!=NULL && pLayer!=NULL)
pLayer->setMonsterType( intg->getValue() );
else if(intg==NULL && pLayer!=NULL)
pLayer->setMonsterType( 1 );
else
CCLog("Combat Layer get fail. ");
CCTransitionFade *scenetrans = CCTransitionFade::create(0.7, pScene);
CCDirector::sharedDirector()->pushScene(scenetrans);
}
示例11:
void Java_org_cocos2dx_hellocpp_HelloCpp_controllerMotion(JNIEnv* env, jobject thiz, jint player, jfloat LS_X, jfloat LS_Y, jfloat RS_X, jfloat RS_Y)
{
CCDirector *pDirector = CCDirector::sharedDirector();
if(pDirector != NULL)
{
CCScene *scene = pDirector->getRunningScene();
if(scene != NULL)
{
Game* layer = (Game*)scene->getChildByTag(1001);
if(layer != NULL)
{
layer->controllerMotion(player, LS_X, LS_Y, RS_X, RS_Y);
}
}
}
}
示例12: screenshot
void ConfigMenu::screenshot()
{
std::string sdcard = getSDCard();
CCSize size = CCDirector::sharedDirector()->getWinSize();
const char* imgName = "/bug_screenshot.jpg";
sdcard = sdcard.append(imgName);
CCRenderTexture* pScreen = CCRenderTexture::create(size.width, size.height);
CCScene* pTempScene = CCDirector::sharedDirector()->getRunningScene();
pScreen->begin();
//pTempScene->visit();
pTempScene->getChildByTag(TAG_RUNNING_LAYER)->visit();
pScreen->end();
pScreen->saveToFile(sdcard.c_str());
CC_SAFE_DELETE(pScreen);
share();
CCLOG("sdcard %s", sdcard.c_str());
}
示例13: loadResource
void LoadingScene::loadResource()
{
unloadResource();
AnimationLoader::loadData();
CCScene* scene = TestScene::scene();
CCDirector::sharedDirector()->popToRootScene();
CCDirector::sharedDirector()->pushScene(scene);
for(int i=0; i<DataCollector::getInstance()->getMatchData()->resourcePackList.size(); i++)
{
ResourceLoader::loadResourcePack(DataCollector::getInstance()->getMatchData()->resourcePackList[i]);
}
((TestScene*)scene->getChildByTag(1))->loadResource();
((TestScene*)scene->getChildByTag(1))->initScene();
}
示例14: onMessageCallBack
/**
@brief 消息回调
@param uMsgId 消息ID
@param wParam
@param lParam
@param nTouchID
@return true 表示可以忽略后面调用 false 则表示还要继续执行
*/
bool WareAppDelegate::onMessageCallBack( unsigned long uMsgId, unsigned long wParam, unsigned long lParam, int nTouchID )
{
IRenderSystem* pRenderSystem = getRenderSystem();
if( pRenderSystem == NULL )
{
return false;
}
CCScene* pRootScene = pRenderSystem->getRootScene();
/// 10000 系统定义的UILayerID
ui::TouchGroup* pUILayer = (ui::TouchGroup*)pRootScene->getChildByTag( EGameLayerDepth_GUI );
if( pUILayer == NULL )
{
return false;
}
return pUILayer->onMessageProc(uMsgId,wParam,lParam,nTouchID);
}
示例15: starNewGame
void Game::starNewGame(Player* player1, Player* player2, bool restart)
{
CCScene *pScene = GameLayer::scene();
GameLayer* gameLayer = (GameLayer*)pScene->getChildByTag(1337);
if(!restart) {
addPlayer(player1);
addPlayer(player2);
}
gameLayer->startGame(player1, player2);
if(CCDirector::sharedDirector()->getRunningScene()){
CCDirector::sharedDirector()->replaceScene(pScene);
}else{
CCDirector::sharedDirector()->runWithScene(pScene);
}
setCurrentScreen(GAME_SCREEN);
currentGameType = player2->isAI() ? VS_AI : VS_HUMAN;
}