关于cocosbuilder,引入ccbfile后,播放的问题。
2013-10-31 15:56
459 查看
如果,你用cocosbuilder,肯定会遇到一个问题。
当我引入了ccbfile,然后给他设置position。发现要不就是ccbfile不动,要不就是场景不播放。
我的方法是修改引擎。很简单的修改。
其中这两个是,修改的内容。
然后把autoplay 全部取消掉。
播放的时候,先播放场景,再播放ccbfile,就可以完成了。
当我引入了ccbfile,然后给他设置position。发现要不就是ccbfile不动,要不就是场景不播放。
我的方法是修改引擎。很简单的修改。
void CCBAnimationManager::runAnimationsForSequenceIdTweenDuration(int nSeqId, float fTweenDuration) { CCAssert(nSeqId != -1, "Sequence id couldn't be found"); //mRootNode->stopAllActions(); mRootNode->stopActionByTag(100); CCDictElement* pElement = NULL; CCDICT_FOREACH(mNodeSequences, pElement) { CCNode *node = (CCNode*)pElement->getIntKey(); node->stopAllActions(); // Refer to CCBReader::readKeyframe() for the real type of value CCDictionary *seqs = (CCDictionary*)pElement->getObject(); CCDictionary *seqNodeProps = (CCDictionary*)seqs->objectForKey(nSeqId); set<string> seqNodePropNames; if (seqNodeProps) { // Reset nodes that have sequence node properties, and run actions on them CCDictElement* pElement1 = NULL; CCDICT_FOREACH(seqNodeProps, pElement1) { const char *propName = pElement1->getStrKey(); CCBSequenceProperty *seqProp = (CCBSequenceProperty*)seqNodeProps->objectForKey(propName); seqNodePropNames.insert(propName); setFirstFrame(node, seqProp, fTweenDuration); runAction(node, seqProp, fTweenDuration); } } // Reset the nodes that may have been changed by other timelines CCDictionary *nodeBaseValues = (CCDictionary*)mBaseValues->objectForKey(pElement->getIntKey()); if (nodeBaseValues) { CCDictElement* pElement2 = NULL; CCDICT_FOREACH(nodeBaseValues, pElement2) { if (seqNodePropNames.find(pElement2->getStrKey()) == seqNodePropNames.end()) { CCObject *value = pElement2->getObject(); if (value) { setAnimatedProperty(pElement2->getStrKey(), node, value, fTweenDuration); } } } } } // Make callback at end of sequence CCBSequence *seq = getSequence(nSeqId); CCAction *completeAction = CCSequence::createWithTwoActions(CCDelayTime::create(seq->getDuration() + fTweenDuration), CCCallFunc::create(this, callfunc_selector(CCBAnimationManager::sequenceCompleted))); completeAction->setTag(100); mRootNode->runAction(completeAction); // Set the running scene if(seq->getCallbackChannel() != NULL) { CCAction* action = (CCAction *)actionForCallbackChannel(seq->getCallbackChannel()); if(action != NULL) { mRootNode->runAction(action); } } if(seq->getSoundChannel() != NULL) { CCAction* action = (CCAction *)actionForSoundChannel(seq->getSoundChannel()); if(action != NULL) { mRootNode->runAction(action); } } mRunningSequence = getSequence(nSeqId); }
mRootNode->stopActionByTag(100);
completeAction->setTag(100);
其中这两个是,修改的内容。
然后把autoplay 全部取消掉。
z_FourthLevel:runAnimationsForSequenceNamedTweenDuration("xiangyu",0) z_JennyBody:runAnimationsForSequenceNamedTweenDuration("zou",0) z_TargetBody:runAnimationsForSequenceNamedTweenDuration("zou",0)
播放的时候,先播放场景,再播放ccbfile,就可以完成了。
相关文章推荐
- cocos2d-x tips(二)关于cocosbuilder中的动画和2dx的action同时正常运行的问题
- Cocos-2d 关于多个CCSprite精灵播放同一个CCAction动画问题
- Cocos-2d 关于多个CCSprite精灵播放同一个CCAction动画问题
- 关于iOS中用AudioFile相关API解码或播放AAC_HE_V2时仅仅能识别单声首22.05k採样率的问题
- 关于iOS中用AudioFile相关API解码或播放AAC_HE_V2时只能识别单声首22.05k采样率的问题
- 关于coursera视频无法播放的问题
- saltstack:关于在多环境中top file查找顺序的问题
- windos 2008 IIS7 关于mp3 手机无法播放的问题
- 关于在IISserver上执行asp.net Web程序出现以下 “Could not load file or assembly。。。”问题的
- 关于STM32头文件包含出现No such file or directory和 invalid redeclaration of type name...的问题
- 关于FileInputStream,FileReader和FileOutputStream,FileWriter区别问题
- 关于FileInputStream,FileReader和FileOutputStream,FileWriter区别问题
- 关于flash builder sdk 4.0,4.1 切到4.5 报错的问题的解决方案
- 关于web项目播放AMR格式音频的问题
- 关于在Gruntfile中配置compass的问题
- 关于 ICTCLAS 2015 / NLPIR 出现的证书过期以及Cannot open Configure file 问题
- Android studio 导入layoutlib.jar 关于项目引入核心库(core-library)异常的问题
- 关于error file: /boot/grub/i386-pc/normal.mod not found. Grub Rescue的修复问题
- 关于FileSystemXmlApplicationContext和ClassPathXmlApplicationContext路径问题
- 关于node.js中引入文件的问题