一、读取csb文件
播放csb先pNode->runAction(pTimeAction);
然后设置播放开始和结束位置,是否循环
pTimeAction->gotoFrameAndPlay(0, pTimeAction->getDuration(), false);
设置播放时的事件
//设置播放中的回调函数
pTimeAction->setFrameEventCallFunc(CC_CALLBACK_1(onFrameEvent/*回调函数*/, this));
/*void onFrameEvent(Frame* frame);//固定的格式
{
EventFrame* evnt = dynamic_cast<EventFrame*>(frame);
if (!evnt)
return;
std::string str = evnt->getEvent();
if (str == "xxx")
{
CCLOG("xxx");
}
}*/
设置播放结束事件
//设置播放结束的回调函数
pTimeAction->setLastFrameCallFunc([=]() {
//xxx
});