CCBAnimationManager
#ifndef __CCB_CCBANIMATION_MANAGER_H__
#define __CCB_CCBANIMATION_MANAGER_H__
#include "cocos2d.h"
#include "ExtensionMacros.h"
#include "CCBSequence.h"
#include "CCBValue.h"
#include "CCBSequenceProperty.h"
NS_CC_EXT_BEGIN
class CCBAnimationManagerDelegate
{
public:
virtual void completedAnimationSequenceNamed(const char *name) = 0;
};
class CCBAnimationManager : public CCObject
{
private:
CCArray *mSequences;
CCDictionary *mNodeSequences;
CCDictionary *mBaseValues;
int mAutoPlaySequenceId;
CCNode *mRootNode;
CCSize mRootContainerSize;
CCBAnimationManagerDelegate *mDelegate;
CCBSequence *mRunningSequence;
CCArray *mDocumentOutletNames;
CCArray *mDocumentOutletNodes;
CCArray *mDocumentCallbackNames;
CCArray *mDocumentCallbackNodes;
CCArray *mKeyframeCallbacks;
CCDictionary *mKeyframeCallFuncs;
std::string mDocumentControllerName;
std::string lastCompletedSequenceName;
SEL_CallFunc mAnimationCompleteCallbackFunc;
CCObject *mTarget;
public:
bool jsControlled;
CCBAnimationManager();
~CCBAnimationManager();
CCObject *mOwner;
virtual bool init();
CCArray* getSequences();
void setSequences(CCArray* seq);
int getAutoPlaySequenceId();
void setAutoPlaySequenceId(int autoPlaySequenceId);
CCNode* getRootNode();
void setRootNode(CCNode* pRootNode); // weak reference
void addDocumentCallbackNode(CCNode *node);
void addDocumentCallbackName(std::string name);
void addDocumentOutletNode(CCNode *node);
void addDocumentOutletName(std::string name);
void setDocumentControllerName(const std::string &name);
std::string getDocumentControllerName();
CCArray* getDocumentCallbackNames();
CCArray* getDocumentCallbackNodes();
CCArray* getDocumentOutletNames();
CCArray* getDocumentOutletNodes();
std::string getLastCompletedSequenceName();
CCArray* getKeyframeCallbacks();
const CCSize& getRootContainerSize();
void setRootContainerSize(const CCSize &rootContainerSize);
CCBAnimationManagerDelegate* getDelegate();
void setDelegate(CCBAnimationManagerDelegate* pDelegate); // retain
const char* getRunningSequenceName();
const CCSize& getContainerSize(CCNode* pNode);
void addNode(CCNode *pNode, CCDictionary *pSeq);
void setBaseValue(CCObject *pValue, CCNode *pNode, const char *pPropName);
void moveAnimationsFromNode(CCNode* fromNode, CCNode* toNode);
/** @deprecated This interface will be deprecated sooner or later.*/
CC_DEPRECATED_ATTRIBUTE void runAnimations(const char *pName, float fTweenDuration);
/** @deprecated This interface will be deprecated sooner or later.*/
CC_DEPRECATED_ATTRIBUTE void runAnimations(const char *pName);
/** @deprecated This interface will be deprecated sooner or later.*/
CC_DEPRECATED_ATTRIBUTE void runAnimations(int nSeqId, float fTweenDuraiton);
void runAnimationsForSequenceNamedTweenDuration(const char *pName, float fTweenDuration);
void runAnimationsForSequenceNamed(const char *pName);
void runAnimationsForSequenceIdTweenDuration(int nSeqId, float fTweenDuraiton);
void setAnimationCompletedCallback(CCObject *target, SEL_CallFunc callbackFunc);
void debug();
void setCallFunc(CCCallFunc *callFunc, const std::string &callbackNamed);
CCObject* actionForCallbackChannel(CCBSequenceProperty* channel);
CCObject* actionForSoundChannel(CCBSequenceProperty* channel);
private:
CCObject* getBaseValue(CCNode *pNode, const char* pPropName);
int getSequenceId(const char* pSequenceName);
CCBSequence* getSequence(int nSequenceId);
CCActionInterval* getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const char *pPropName, CCNode *pNode);
void setAnimatedProperty(const char *pPropName, CCNode *pNode, CCObject *pValue, float fTweenDuraion);
void setFirstFrame(CCNode *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
CCActionInterval* getEaseAction(CCActionInterval *pAction, int nEasingType, float fEasingOpt);
void runAction(CCNode *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
void sequenceCompleted();
};
class CCBSetSpriteFrame : public CCActionInstant
{
private:
CCSpriteFrame *mSpriteFrame;
public:
~CCBSetSpriteFrame();
/** creates a Place action with a position */
static CCBSetSpriteFrame* create(CCSpriteFrame *pSpriteFrame);
bool initWithSpriteFrame(CCSpriteFrame *pSpriteFrame);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone *pZone);
};
class CCBSoundEffect : public CCActionInstant
{
private:
std::string mSoundFile;
float mPitch, mPan, mGain;
public:
~CCBSoundEffect();
static CCBSoundEffect* actionWithSoundFile(const std::string &file, float pitch, float pan, float gain);
bool initWithSoundFile(const std::string &file, float pitch, float pan, float gain);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone *pZone);
};
class CCBRotateTo : public CCActionInterval
{
private:
float mStartAngle;
float mDstAngle;
float mDiffAngle;
public:
static CCBRotateTo* create(float fDuration, float fAngle);
bool initWithDuration(float fDuration, float fAngle);
virtual void update(float time);
virtual CCObject* copyWithZone(CCZone *pZone);
virtual void startWithTarget(CCNode *pNode);
};
class CCBRotateXTo: public CCActionInterval {
private:
float mStartAngle;
float mDstAngle;
float mDiffAngle;
public:
static CCBRotateXTo* create(float fDuration, float fAngle);
bool initWithDuration(float fDuration, float fAngle);
virtual void startWithTarget(CCNode *pNode);
virtual CCObject* copyWithZone(CCZone *pZone);
virtual void update(float time);
};
class CCBRotateYTo: public CCActionInterval {
private:
float mStartAngle;
float mDstAngle;
float mDiffAngle;
public:
static CCBRotateYTo* create(float fDuration, float fAngle);
bool initWithDuration(float fDuration, float fAngle);
virtual void startWithTarget(CCNode *pNode);
virtual CCObject* copyWithZone(CCZone *pZone);
virtual void update(float time);
};
class CCBEaseInstant : public CCActionEase
{
public:
static CCBEaseInstant* create(CCActionInterval *pAction);
virtual void update(float dt);
};
NS_CC_EXT_END
#endif // __CCB_CCBANIMATION_MANAGER_H__
CCBAnimationManager的更多相关文章
- Cocos2d-x游戏开发CCBAnimationManager控制动画
CocosBuilder能方便的编辑各种动画.大部分动画都是以独立片段的形式存在的. 须要由程序来控制何时播放. 管理ccbi文件的动画播放有个专门的类:CCBAnimationManager 大致的 ...
- 当编译CCBReader时出现 “ CCBAnimationManager.m Use of undeclared identifier 'other‘ ” 解决方法
第一种解决方法是去github上下载最新的CCBReader 第二种解决方法是把other替换成self.inner 建议用新版本的
- Cocos2d-x——CocosBuilder官方帮助文档翻译3 动画
Working with Animations 动画 You can use CocosBuilder for creating character animations, animating com ...
- CCBReader
#ifndef _CCB_CCBREADER_H_ #define _CCB_CCBREADER_H_ #include "cocos2d.h" #include "Ex ...
- cocosBuilder使用总结
原创,转载请注明出处! 基本流程 >=-. 准备工作 #. 把一个项目场景相关的,相对独立(别的场景用不到)的碎图,用TexturePack拼接成大的png图片文件及plist数据字处理文件 # ...
- cocos2d-x绑定ccb文件
首先,ccb文件是如何生成的,我就不多说了,大家可以搜下cocosbuilder,就能找的相关的教程,而通过cocosbuilder,我们可以省去了很多设计的麻烦,比如设计一个精灵的位置啥的,而通过c ...
- SpriteBuilder中音频波长超过Timeline结尾的情况
见如下图: 注意最后一个音频波长延续到Timeline结尾之后.表明这个音频文件播放长度超过Timeline(动画)播放的长度.这是否成为一个问题要视情况而定.而在这里无所谓. 如果节点所拥有的Tim ...
- cocos2d-x开发记录:二,基本概念(骨骼动画)
九,骨骼动画 1.骨骼动画vs Sprite sheets 你能使用sprite sheets 创建动画,它很快又容易.直到你意识到你的游戏需要大量的动画并且内存消耗越来越高,并且需要时间载入全部数据 ...
- 改进cocos2dx中lua读ccb的方法
cocos2dx自带的CCBProxy真弱,还好提供了一个CCBReaderLoader.lua,但是也不好用, 于是修改了一下CCBReaderLoader,下面直接贴代码了. function N ...
随机推荐
- 转:Vue-cli proxyTable 解决开发环境的跨域问题
转:http://www.jianshu.com/p/95b2caf7e0da 和后端联调时总是会面对恼人的跨域问题,最近基于Vue开发项目时也遇到了这个问题,两边各自想了一堆办法,查了一堆资料,加了 ...
- fedroa20中将ssh,ssl升级到当前最新版本
Fedroa20下手工安装openssh-server 本例以Fedroa20为例,需要下载:zlib-1.2.8.tar.openssl-1.0.2e.tar. openssh-7.1p1.tar. ...
- HttpClient 详解一《C#高级编程(第9版)》
1.异步调用 Web 服务 static void Main(string[] args) { Console.WriteLine("In main before call to GetDa ...
- Spring Boot 实战与原理分析视频课程
Spring Boot 实战与原理分析视频课程 链接:https://pan.baidu.com/share/init?surl=PeykcoeqZtd1d9lN9V_F-A 提取码: 关注公众号[G ...
- Vue.js开始第一个项目
前端架构之路:使用Vue.js开始第一个项目 Vue.js做为目前前端最热门的库之一,为快速构建并开发前端项目多了一种思维模式.本文通过一个简单的实例开始上手Vue.js开发. 一.技术准备 使用 ...
- SpringBoot中使用纯scala进行开发 配置教程 非常简单的案例
新建项目 建好之后 建一个叫scala的文件夹 并把它标记为root文件夹 修改pom.xml文件 复制粘贴如下内容: 添加的插件的作用,如果不添加,在新建文件的时候右键只能新建java的文件,无法创 ...
- 查询物理表字段(mysql)
SELECT t.COLUMN_NAME AS NAME, ( CASE WHEN t.IS_NULLABLE = 'YES' THEN '1' ELSE '0' END ) AS ISNULL, ( ...
- 一个ScheduledExecutorService启动的Java线程无故挂掉引发的思考
2018年12月12日18:44:53 一个ScheduledExecutorService启动的Java线程无故挂掉引发的思考 案件现场 不久前,在开发改造公司一个端到端监控日志系统的时候,出现了一 ...
- sublime安装package control 的方法
1.安装sublime3后,点击菜单 view>show console,复制以下代码按回车即可,安装时稍微有些卡,需要耐心等待. import urllib.request,os; pf = ...
- java List/ArrayList 解惑
导读:祖传挖坟派学习方法(宝儿姐友情支持) 第一部分 List简介 第二部分 何为ArrayList 第三部分 代码示例 第四部分 吹牛 如果你急需想搞清楚一些问题可以先看这里的总结 再后续看 ...