本文整理汇总了C++中CCArmature类的典型用法代码示例。如果您正苦于以下问题:C++ CCArmature类的具体用法?C++ CCArmature怎么用?C++ CCArmature使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CCArmature类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: comCallBack
void SceneRender::comCallBack(cocos2d::CCObject *tar, void *dict)
{
if (dict == NULL || tar == NULL)
{
return;
}
CCArmature *pAr = dynamic_cast<CCArmature*>(tar);
if (pAr == NULL)
{
return;
}
rapidjson::Value *v = (rapidjson::Value *)dict;
bool isShowColliderRect = DICTOOL->getBooleanValue_json(*v, "isShowColliderRect");
if (isShowColliderRect == false)
{
return;
}
ColliderRectDrawer *drawer = ColliderRectDrawer::create(pAr);
if (pAr->getParent())
{
pAr->getParent()->addChild(drawer);
}
drawer->setVisible(true);
}
示例2: arriveKeyFrame
void CCTween::arriveKeyFrame(CCFrameData *keyFrameData)
{
if(keyFrameData)
{
CCDisplayManager *displayManager = m_pBone->getDisplayManager();
//! Change bone's display
int displayIndex = keyFrameData->displayIndex;
if (!displayManager->getForceChangeDisplay())
{
displayManager->changeDisplayByIndex(displayIndex, false);
}
//! Update bone zorder, bone's zorder is determined by frame zorder and bone zorder
m_pTweenData->zOrder = keyFrameData->zOrder;
m_pBone->updateZOrder();
//! Update blend type
m_pBone->setBlendFunc(keyFrameData->blendFunc);
//! Update child armature's movement
CCArmature *childAramture = m_pBone->getChildArmature();
if(childAramture)
{
if(keyFrameData->strMovement.length() != 0)
{
childAramture->getAnimation()->play(keyFrameData->strMovement.c_str());
}
}
}
}
示例3: createUI
//-----------------------------------------------------------------------------------------------------------------------------
void PersonView::createUI(void)
{
mInfo->hp = mInfo->maxHp = mConfig->hp();
mInfo->defense = mConfig->defe();
mInfo->attack = mConfig->att();
mInfo->maxattack = mConfig->maxatt();
mInfo->attackDelay = (float)mConfig->delay() / 1000;
CCArmature* armature = CCArmature::create(mConfig->name().c_str());
setAvatar(armature);
//if (id == 3)
//{
// CCBone* bone = armature->getBone("staff");
// CCSpriteDisplayData displayData;
// displayData.setParam("Pastor-weapon-pastor_staff_1.png");
// bone->addDisplay(&displayData, 1);
// bone->changeDisplayByIndex(1, true);
//}
if (mBloodBar == NULL)
{
mBloodBar = BloodBar::create();
CCRect trect = CCRectApplyAffineTransform(armature->boundingBox(), armature->nodeToParentTransform()); // 获取模型的大小
mBloodBar->setPositionY(trect.getMaxY());
addChild(mBloodBar, 1);
}
}
示例4: createAnimationOneTime
CCArmature* AnimLoader::createAnimationOneTime(const char *resName, const char *animName)
{
CCArmature *armature = CCArmature::create(resName);
armature->getAnimation()->play(animName, 0, 0, 1, 0);
armature->getAnimation()->setMovementEventCallFunc(armature, movementEvent_selector(AnimLoader::removeAnim));
return armature;
}
示例5: getFish
cocos2d::CCNode* SceneEditorTestLayer::createGameScene()
{
CCNode *pNode = CCSSceneReader::sharedSceneReader()->createNodeWithSceneFile("scenetest/FishJoy2.json");
if (pNode == NULL)
{
return NULL;
}
m_pCurNode = pNode;
//fishes
CCArmature *pBlowFish = getFish(10008, "blowFish");
CCArmature *pButterFlyFish = getFish(10009, "butterFlyFish");
pBlowFish->getAnimation()->playByIndex(0);
pButterFlyFish->getAnimation()->playByIndex(0);
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(SceneEditorTestLayer::toExtensionsMainLayer));
itemBack->setColor(ccc3(255, 255, 255));
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
menuBack->setPosition(CCPointZero);
menuBack->setZOrder(4);
pNode->addChild(menuBack);
//ui action
cocos2d::extension::UIActionManager::shareManager()->PlayActionByName("startMenu_1.json","Animation1");
return pNode;
}
示例6: getFish
cocos2d::CCNode* SceneEditorTestLayer::createGameScene()
{
CCNode *pNode = CCJsonReader::sharedJsonReader()->createNodeWithJsonFile("FishJoy2.json");
if (pNode == NULL)
{
return NULL;
}
m_pCurNode = pNode;
//play back music
CCComAudio *pAudio = (CCComAudio*)(pNode->getComponent("Audio"));
pAudio->playBackgroundMusic(pAudio->getFile(), pAudio->getIsLoop());
//fishes
CCArmature *pBlowFish = getFish(5, "blowFish");
CCArmature *pButterFlyFish = getFish(6, "butterFlyFish");
pBlowFish->getAnimation()->playByIndex(0);
pButterFlyFish->getAnimation()->playByIndex(0);
CCMenuItemFont *itemBack = CCMenuItemFont::create("Back", this, menu_selector(SceneEditorTestLayer::toExtensionsMainLayer));
itemBack->setColor(ccc3(255, 255, 255));
itemBack->setPosition(ccp(VisibleRect::rightBottom().x - 50, VisibleRect::rightBottom().y + 25));
CCMenu *menuBack = CCMenu::create(itemBack, NULL);
menuBack->setPosition(CCPointZero);
menuBack->setZOrder(4);
pNode->addChild(menuBack);
//ui action
cocos2d::extension::UIActionManager::shareManager()->PlayActionByName("startMenu_1.json","Animation1");
return pNode;
}
示例7: RunAction
void PlayScene::RunAction(CCPoint pos, const char* name) {
CCArmatureDataManager::sharedArmatureDataManager()->addArmatureFileInfo("Action/Action.ExportJson");
CCArmature *armature = CCArmature::create("Action");
armature->getAnimation()->play(name);
armature->setPosition(pos);
this->addChild(armature, 2, 102);
armature->getAnimation()->setMovementEventCallFunc(this,movementEvent_selector(PlayScene::ArmatureCallBack));
}
示例8: addChild
void CCBatchNode::addChild(CCNode *child, int zOrder, int tag)
{
CCNode::addChild(child, zOrder, tag);
CCArmature *armature = dynamic_cast<CCArmature *>(child);
if (armature != NULL)
{
armature->setBatchNode(this);
}
}
示例9: updateArmatureDisplay
void CCDisplayFactory::updateArmatureDisplay(CCBone *bone, CCNode *display, float dt, bool dirty)
{
CCArmature *armature = (CCArmature *)display;
if(armature)
{
armature->sortAllChildren();
armature->update(dt);
}
}
示例10: CCSize
LayerChanToast::LayerChanToast(string message){
vector<string> lstRegex;
for( int i = 1; i <= 16; i++ ){
lstRegex.push_back( CCString::createWithFormat("(%d)", i)->getCString() );
}
this->setAnchorPoint(ccp(0, 0));
// text
cocos2d::ui::RichText* label = cocos2d::ui::RichText::create();
label->setAnchorPoint(ccp(0, 0));
label->setPosition(ccp(0, HEIGHT_DESIGN / 3.5));
vector<string> lstContents = mUtils::splitStringByListRegex(message, lstRegex);
int wLabel = 0, hLabel = 0;
for( int i = 0; i < lstContents.size(); i++ ){
bool check = false;
int j = 0;
for( j = 0; j < lstRegex.size(); j++ )
if( lstRegex.at(j) == lstContents.at(i) ){
check = true;
break;
}
if( check ){
CCArmature *armature = CCArmature::create(CCString::createWithFormat("onion%d", 1)->getCString());
armature->getAnimation()->playByIndex(j);
cocos2d::ui::RichElementCustomNode* recustom = cocos2d::ui::RichElementCustomNode::create(1, ccWHITE, 255, armature);
label->pushBackElement(recustom);
wLabel += 50;
hLabel = 55;
}else{
CCLabelTTF *l = CCLabelTTF::create(lstContents.at(i).c_str(), "Arial", 16);
l->setColor(ccc3(204, 16, 85));
cocos2d::ui::RichElementText* re1 = cocos2d::ui::RichElementText::create(1, ccWHITE, 255, lstContents.at(i).c_str(), "Arial", 16);
label->pushBackElement(re1);
wLabel += l->getContentSize().width;
hLabel = hLabel > 50 ? 55 : l->getContentSize().height;
}
}
this->addChild(label, 1, 0);
CCSize sizeDesign = CCSize(169, 30);
CCSpriteBatchNode *batchNode = CCSpriteBatchNode::create("chats/framechat_a.png");
CCScale9Sprite *blocks = CCScale9Sprite::create();
blocks ->updateWithBatchNode(batchNode , CCRect(0, 0, sizeDesign.width, sizeDesign.height), false, CCRect(10, 10, sizeDesign.width - 20, sizeDesign.height - 20));
CCSize size = CCSizeMake(wLabel + 10, hLabel + 5);
blocks ->setContentSize(size);
blocks->setAnchorPoint(ccp(0.5, 0.5));
blocks->setPosition(ccp(label->getPositionX() + wLabel / 2, label->getPositionY() + hLabel / 2));
blocks->setColor(ccc3(84, 81, 69));
blocks->setOpacity(200);
this->setPosition(ccp((WIDTH_DESIGN - size.width) / 2, 100));
// add
this->addChild(blocks);
}
示例11: CCArmature
CCArmature *CCArmature::create()
{
CCArmature *armature = new CCArmature();
if (armature && armature->init())
{
armature->autorelease();
return armature;
}
CC_SAFE_DELETE(armature);
return NULL;
}
示例12:
Player::Player(CCNode* playerNode)
:CCObject()
{
this->playerNode = playerNode;
CCArmature* animationNode = (CCArmature*)playerNode->getComponent("CCArmature")->getNode();
this->animation = animationNode->getAnimation();
this->animation->setMovementEventCallFunc(this, movementEvent_selector(Player::onAnimationEvent));
currentState = IDLE;
newState = IDLE;
lockState = false;
}
示例13: CCArmature
CCArmature *CCArmature::create(const char *name)
{
CCArmature *armature = new CCArmature();
if (armature && armature->init(name))
{
CC_SAFE_AUTORELEASE(armature);
return armature;
}
CC_SAFE_DELETE(armature);
return NULL;
}
示例14: animationEvent
void HelloWorld::animationEvent(CCArmature *pArmature,
MovementEventType movementType, const char *movementID)
{
CCArmature *pEnemy = (CCArmature*)(m_pGameScene->getChildByTag(10006)->getComponent("CCArmature")->getNode());
if (movementType == COMPLETE)
{
pEnemy->getAnimation()->play("death");
pArmature->getAnimation()->setMovementEventCallFunc(NULL, NULL);
m_bDead = true;
}
}
示例15: CC_BREAK_IF
void ArmaturePlayAction::done()
{
do
{
CCNode *pNode = SceneReader::sharedSceneReader()->getNodeByTag(_nTag);
CC_BREAK_IF(pNode == NULL);
CCComRender *pRender = (CCComRender*)(pNode->getComponent(_comName.c_str()));
CC_BREAK_IF(pRender == NULL);
CCArmature *pAr = (CCArmature *)(pRender->getNode());
CC_BREAK_IF(pAr == NULL);
pAr->getAnimation()->play(_aniname.c_str());
} while (0);
}