头文件
#include "cocostudio/cocoStudio.h"
资源预加载
cocostudio::ArmatureDataManager::getInstance()->addArmatureFileInfo("M_JM_XZA.png", "M_JM_XZA.plist", "M_JM_XZA.xml");
动画播放
arm->getAnimation()->play(str);
设置回调
arm->getAnimation()->setMovementEventCallFunc([=](cocostudio::Armature* ar,cocostudio::MovementEventType type,const std::string str){
if (type==cocostudio::MovementEventType::COMPLETE) {
}
});
换装
void changeZbWithArm(cocostudio::Armature *arm, const char *boneName, const char *newBoneName)
{
std::string boname = boneName;
boname+=".png";
cocostudio::Bone* bone = arm->getBone(boneName);
int index = bone->getDisplayManager()->getCurrentDisplayIndex();
cocostudio::Skin* skin = cocostudio::Skin::create(newBoneName);
bone->addDisplay(skin, index);
bone->changeDisplayWithIndex(index, true);
}