本文整理汇总了C++中CCNode::getChildrenCount方法的典型用法代码示例。如果您正苦于以下问题:C++ CCNode::getChildrenCount方法的具体用法?C++ CCNode::getChildrenCount怎么用?C++ CCNode::getChildrenCount使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCNode
的用法示例。
在下文中一共展示了CCNode::getChildrenCount方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Attack
void GamePan::Attack(int direct)
{
CCNode* fieldNode = m_pCcbNode->getChildByTag(kTagGamePanField);
for(int i =0;i<fieldNode->getChildrenCount();i++)
{
fieldNode->getChildByTag(i);
}
std::string pinyinStr = Utils::getPinyinStr(answer);//GET_STRING(TEXT_JUQING_SPLASH_BEGIN2);
std::string answerPinyin = Utils::getPinyinLetter(pinyinStr);
vector<string> answerArr = Utils::split(answerPinyin);
vector<string> pinyinArr = Utils::split(_pinyinStr);
for(int i =0;i<pinyinArr.size();i++)
{
string letter = pinyinArr.at(i);
int pos = -1;
for(int j =0;j<answerArr.size();j++)
{
string tmp = answerArr.at(j);
if(tmp.compare(letter) == 0)
{
pos = i;
}
}
if(i>0 && pos>0)
{
CCNode* bar = fieldNode->getChildByTag(i);
CCMoveTo* moveTo = NULL;
switch (direct)
{
case NPC_ATTACK:
{
moveTo = CCMoveTo::create(0.3f,ccp(bar->getPositionX(),bar->getPositionY()-MOVE_STEP));
}
break;
case PLAYER_ATTACK:
{
moveTo = CCMoveTo::create(0.3f,ccp(bar->getPositionX(),bar->getPositionY()+MOVE_STEP));
}
break;
}
bool isMoveAble = true;
float dis = bar->getPositionY();
if(dis>=MAX_DISTANCE)
{
isMoveAble = false;
}
else if(dis<= -MAX_DISTANCE)
{
isMoveAble = false;
}
if(isMoveAble)
{
bar->runAction(moveTo);
}
}
}
this->runAction(CCSequence::create(CCDelayTime::create(0.35f),CCCallFunc::create(this,callfunc_selector(GamePan::checkWhoWin)),NULL));
}
示例2: runMovePreAction
void CMainCityUI::runMovePreAction(int tag)
{
CCNode *sBtn = dynamic_cast<CCNode*>( m_ui->getChildByTag(tag));
sBtn->setVisible(true);
CCArray *children = sBtn->getChildren();
for (int i = 0; i < sBtn->getChildrenCount(); i++)
{
CCNode *child = (CCNode*)children->objectAtIndex(i);
CCMoveBy *move = CCMoveBy::create(0.3f,ccp(-m_moveX[tag-1],0));
child->runAction(move);
child->setAnchorPoint(CCPointCenter);
child->setVisible(true);
}
}
示例3: runMoveAction
void CMainCityUI::runMoveAction(int fromTag, int toTag,float moveTime)
{
CCNode *sBtn = m_ui->getChildByTag(fromTag);
CButton *dBtn = dynamic_cast<CButton*>( m_ui->getChildByTag(toTag));
CCArray *children = sBtn->getChildren();
CCNode *child = nullptr;
for (int i = 0; i < sBtn->getChildrenCount(); i++)
{
child = (CCNode*)children->objectAtIndex(i);
CCMoveBy *move = CCMoveBy::create(moveTime,ccp(dBtn->getPositionX() -child->getPositionX(),0));
CCCallFuncN *hideCall = CCCallFuncN::create(this,callfuncN_selector(CMainCityUI::hideBtn));
CCSequence *ccseque = CCSequence::create(move,hideCall,nullptr);
child->runAction(ccseque);
}
m_moveX[fromTag-1] = dBtn->getPositionX() - child->getPositionX();
}
示例4: resetPriority
void GUIBase::resetPriority(CCNode* pNode, int priority)
{
CCArray* pChildren = pNode->getChildren();
CCObject* pObj = NULL;
CCARRAY_FOREACH(pChildren, pObj)
{
CCNode* pChild = (CCNode*)pObj;
if (pChild->getChildrenCount() > 0)
{
resetPriority(pChild, priority);
}
// CCMenu
CCMenu* pMenu = dynamic_cast<CCMenu*>(pChild);
if (pMenu)
{
pMenu->setTouchPriority(priority - 1);
continue;
}
// CCScrollView
CCScrollView* pCCScrollView = dynamic_cast<CCScrollView*>(pChild);
if (pCCScrollView)
{
pCCScrollView->setTouchPriority(priority - 1);
continue;
}
// CCControlButton
CCControlButton* pCCControlButton = dynamic_cast<CCControlButton*>(pChild);
if (pCCControlButton)
{
pCCControlButton->setTouchPriority(priority - 1);
continue;
}
}
示例5: init
//.........这里部分代码省略.........
}
label->setDimensions(Size(580, 0));
if (CCCommonUtils::isIosAndroidPad()) {
label->setDimensions(Size(1300, 0));
}
label->setAnchorPoint(Vec2(0.5, 1));
label->setColor({85, 62, 31});
label->setPosition(0, height);
label->setHorizontalAlignment(TextHAlignment::CENTER);
label->setVerticalAlignment(TextVAlignment::TOP);
node->addChild(label);
height -= label->getContentSize().height * label->getOriginScaleY();
}
ScrollView* view = ScrollView::create(m_listNode->getContentSize());
if (abs(height) < m_listNode->getContentSize().height) {
node->setPositionY(m_listNode->getContentSize().height / 2.0 + abs(height) / 2.0);
height = -m_listNode->getContentSize().height;
} else {
node->setPositionY(abs(height));
}
view->setContentSize(Size(m_listNode->getContentSize().width, abs(height)));
view->addChild(node);
node->setPositionX(view->getContentSize().width / 2);
// node->setPositionY(abs(height));
view->setContentOffset(Vec2(0, m_listNode->getContentSize().height - view->getContentSize().height));
view->setDirection(ScrollView::Direction::VERTICAL);
m_listNode->addChild(view);
view->setDelegate(this);
bool st = false;
if (LuaController::getInstance()->checkActLuaValid(m_obj))
{
CCNode* node = LuaController::getInstance()->createActivityAdCell(m_obj);
if (node && node->getChildrenCount()) {
m_picNode->addChild(node);
if (CCCommonUtils::isIosAndroidPad())
{
float w = (1536.0 - 1156.0) / 2.0;
float h = 645;
node->setContentSize(CCSize(0, 0));
node->setScaleX(1156.0 / 640.0);
node->setScaleY(645.0 / 357.0);
auto layer1 = CCModelLayerColor::create();
layer1->setAnchorPoint(ccp(0, 0));
layer1->setContentSize(CCSize(w, h));
layer1->setPosition(-w, 0);
layer1->setOpacity(255);
layer1->setColor(ccBLACK);
// layer1->setTouchPriority(-999);
m_picNode->addChild(layer1);
layer1 = CCModelLayerColor::create();
layer1->setAnchorPoint(CCPointZero);
layer1->setPosition(ccp(1156, 0));
layer1->setContentSize(CCSize(w, h));
layer1->setOpacity(255);
layer1->setColor(ccBLACK);
// layer1->setTouchPriority(-999);
m_picNode->addChild(layer1);
}
} else {
st = true;
}
}
else
{