博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
CEffectMgr类
阅读量:5009 次
发布时间:2019-06-12

本文共 3601 字,大约阅读时间需要 12 分钟。

#ifndef __EFFECTMGR_H__#define __EFFECTMGR_H__#include "GameFrameHead.h"namespace cocos2d{    class CCFiniteTimeAction;}class GAMEFRAME_API CEffectMgr{public:    enum ActionType    {        _Act_Sequence = 0,    //顺序执行        _Act_Spawn = 1,        //同时执行    };    enum Action    {        _CCMoveTo = 10,        _CCMoveBy = 11,        _CCJumpTo = 12,        _CCJumpBy = 13,        _CCBezierBy  = 14,        _CCScaleTo = 15,        _CCScaleBy = 16,        _CCRotateTo = 17,        _CCRotateBy = 18,        _CCBlink = 19,        _CCTintTo = 20,        _CCTintBy = 21,        _CCFadeTo = 22,        _CCFadeIn = 23,        _CCFadeOut = 24,    };public:    ~CEffectMgr();    static CEffectMgr* getInstance();    static void destroy();    cocos2d::CCFiniteTimeAction* getAction(const char* psKey);private:    CEffectMgr();private:    static CEffectMgr* g_pEffectMgr;};#endif //__EFFECTMGR_H__
#include "EffectMgr.h"#include "Config.h"#include "XCommon.h"CEffectMgr* CEffectMgr::g_pEffectMgr = NULL;CEffectMgr::CEffectMgr(){}CEffectMgr::~CEffectMgr(){}CEffectMgr* CEffectMgr::getInstance(){    if (!g_pEffectMgr)    {        g_pEffectMgr = new CEffectMgr();    }    return g_pEffectMgr;}void CEffectMgr::destroy(){    SAFE_DELETE(g_pEffectMgr);}cocos2d::CCFiniteTimeAction* CEffectMgr::getAction( const char* psKey ){    ActionInfo& actionInfo = *CConfig::getInstance()->getActionInfoByKey(psKey);    vector
vecParam; vector
vecBuf; CXCommon::split(actionInfo.strParm, string(" "), vecBuf); for (int i = 0; i < vecBuf.size(); i++) { vecParam.push_back(atof(vecBuf[i].c_str())); } CCFiniteTimeAction* pAct = NULL; switch(actionInfo.nAction) { case _CCMoveTo: { pAct = CCMoveTo::create(vecParam[0], ccp(vecParam[1], vecParam[2])); } break; case _CCMoveBy: { pAct = CCMoveBy::create(vecParam[0], ccp(vecParam[1], vecParam[2])); } break; case _CCJumpBy: { pAct = CCJumpBy::create(vecParam[0], ccp(vecParam[1], vecParam[2]), vecParam[3], vecParam[4]); } break; case _CCJumpTo: { pAct = CCJumpTo::create(vecParam[0], ccp(vecParam[1], vecParam[2]), vecParam[3], vecParam[4]); } break; case _CCBezierBy: { //暂未实现 } break; case _CCScaleTo: { pAct = CCScaleTo::create(vecParam[0], vecParam[1], vecParam[2]); } break; case _CCScaleBy: { pAct = CCScaleBy::create(vecParam[0], vecParam[1], vecParam[2]); } break; case _CCRotateTo: { pAct = CCRotateTo::create(vecParam[0], vecParam[1]); } break; case _CCBlink: { pAct = CCBlink::create(vecParam[0], vecParam[1]); } break; case _CCTintTo: { pAct = CCTintTo::create(vecParam[0], vecParam[1], vecParam[2], vecParam[3]); } break; case _CCTintBy: { pAct = CCTintBy::create(vecParam[0], vecParam[1], vecParam[2], vecParam[3]); } break; case _CCFadeTo: { pAct = CCFadeTo::create(vecParam[0], vecParam[1]); } break; case _CCFadeIn: { pAct = CCFadeIn::create(vecParam[0]); } break; case _CCFadeOut: { pAct = CCFadeOut::create(vecParam[0]); } default: { CCLog("error: action creation fails!"); } break; } ASSERT(pAct); return pAct;}

 

转载于:https://www.cnblogs.com/newlist/p/3176830.html

你可能感兴趣的文章
Leetcode 23. Merge k Sorted Lists(python)
查看>>
Java进阶知识点6:并发容器背后的设计理念 - 锁分段、写时复制和弱一致性
查看>>
Makefile ===> Makefile 快速学习
查看>>
face detection[HR]
查看>>
java性能调优工具
查看>>
C# 其他的Url 文件的路径转化为二进制流
查看>>
cmake使用
查看>>
ios7上隐藏status bar
查看>>
构造方法和全局变量的关系
查看>>
python3基础05(有关日期的使用1)
查看>>
ArrayList的使用方法
查看>>
面向对象高级
查看>>
Bitwise And Queries
查看>>
打印Ibatis最终的SQL语句
查看>>
HBase之八--(3):Hbase 布隆过滤器BloomFilter介绍
查看>>
oracle连接问题ORA-00604,ORA-12705
查看>>
NOI 2019 退役记
查看>>
java的几个日志框架log4j、logback、common-logging
查看>>
Java从零开始学十三(封装)
查看>>
Python2和Python3中的rang()不同之点
查看>>