Merge pull request #5 from liamcindy/MergeCocos2d_3.0

update coco action with correct coding rule
This commit is contained in:
cheng.zhang 2013-12-26 18:55:37 -08:00
commit 31e46b85d7
8 changed files with 213 additions and 216 deletions

View File

@ -35,20 +35,20 @@ static inline float bezieratFunction( float a, float b, float c, float d, float
EaseBezierAction* EaseBezierAction::create(cocos2d::ActionInterval* action)
{
EaseBezierAction *_ret = new EaseBezierAction();
if (_ret)
EaseBezierAction *ret = new EaseBezierAction();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
void EaseBezierAction::setBezierParamer( float p0, float p1, float p2, float p3)
@ -87,20 +87,20 @@ EaseBezierAction* EaseBezierAction::reverse() const
EaseQuadraticActionIn* EaseQuadraticActionIn::create(ActionInterval* action)
{
EaseQuadraticActionIn *_ret = new EaseQuadraticActionIn();
if (_ret)
EaseQuadraticActionIn *ret = new EaseQuadraticActionIn();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseQuadraticActionIn* EaseQuadraticActionIn::clone() const
@ -127,20 +127,20 @@ EaseQuadraticActionIn* EaseQuadraticActionIn::reverse() const
EaseQuadraticActionOut* EaseQuadraticActionOut::create(ActionInterval* action)
{
EaseQuadraticActionOut *_ret = new EaseQuadraticActionOut();
if (_ret)
EaseQuadraticActionOut *ret = new EaseQuadraticActionOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseQuadraticActionOut* EaseQuadraticActionOut::clone() const
@ -168,20 +168,20 @@ EaseQuadraticActionOut* EaseQuadraticActionOut::reverse() const
EaseQuadraticActionInOut* EaseQuadraticActionInOut::create(ActionInterval* action)
{
EaseQuadraticActionInOut *_ret = new EaseQuadraticActionInOut();
if (_ret)
EaseQuadraticActionInOut *ret = new EaseQuadraticActionInOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseQuadraticActionInOut* EaseQuadraticActionInOut::clone() const
@ -221,20 +221,20 @@ EaseQuadraticActionInOut* EaseQuadraticActionInOut::reverse() const
EaseQuarticActionIn* EaseQuarticActionIn::create(ActionInterval* action)
{
EaseQuarticActionIn *_ret = new EaseQuarticActionIn();
if (_ret)
EaseQuarticActionIn *ret = new EaseQuarticActionIn();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseQuarticActionIn* EaseQuarticActionIn::clone() const
@ -262,20 +262,20 @@ EaseQuarticActionIn* EaseQuarticActionIn::reverse() const
EaseQuarticActionOut* EaseQuarticActionOut::create(ActionInterval* action)
{
EaseQuarticActionOut *_ret = new EaseQuarticActionOut();
if (_ret)
EaseQuarticActionOut *ret = new EaseQuarticActionOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseQuarticActionOut* EaseQuarticActionOut::clone() const
@ -304,20 +304,20 @@ EaseQuarticActionOut* EaseQuarticActionOut::reverse() const
EaseQuarticActionInOut* EaseQuarticActionInOut::create(ActionInterval* action)
{
EaseQuarticActionInOut *_ret = new EaseQuarticActionInOut();
if (_ret)
EaseQuarticActionInOut *ret = new EaseQuarticActionInOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseQuarticActionInOut* EaseQuarticActionInOut::clone() const
@ -354,20 +354,20 @@ EaseQuarticActionInOut* EaseQuarticActionInOut::reverse() const
EaseQuinticActionIn* EaseQuinticActionIn::create(ActionInterval* action)
{
EaseQuinticActionIn *_ret = new EaseQuinticActionIn();
if (_ret)
EaseQuinticActionIn *ret = new EaseQuinticActionIn();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseQuinticActionIn* EaseQuinticActionIn::clone() const
@ -395,20 +395,20 @@ EaseQuinticActionIn* EaseQuinticActionIn::reverse() const
EaseQuinticActionOut* EaseQuinticActionOut::create(ActionInterval* action)
{
EaseQuinticActionOut *_ret = new EaseQuinticActionOut();
if (_ret)
EaseQuinticActionOut *ret = new EaseQuinticActionOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseQuinticActionOut* EaseQuinticActionOut::clone() const
@ -437,20 +437,20 @@ EaseQuinticActionOut* EaseQuinticActionOut::reverse() const
EaseQuinticActionInOut* EaseQuinticActionInOut::create(ActionInterval* action)
{
EaseQuinticActionInOut *_ret = new EaseQuinticActionInOut();
if (_ret)
EaseQuinticActionInOut *ret = new EaseQuinticActionInOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseQuinticActionInOut* EaseQuinticActionInOut::clone() const
@ -487,20 +487,20 @@ EaseQuinticActionInOut* EaseQuinticActionInOut::reverse() const
EaseCircleActionIn* EaseCircleActionIn::create(ActionInterval* action)
{
EaseCircleActionIn *_ret = new EaseCircleActionIn();
if (_ret)
EaseCircleActionIn *ret = new EaseCircleActionIn();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseCircleActionIn* EaseCircleActionIn::clone() const
@ -528,20 +528,20 @@ EaseCircleActionIn* EaseCircleActionIn::reverse() const
EaseCircleActionOut* EaseCircleActionOut::create(ActionInterval* action)
{
EaseCircleActionOut *_ret = new EaseCircleActionOut();
if (_ret)
EaseCircleActionOut *ret = new EaseCircleActionOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseCircleActionOut* EaseCircleActionOut::clone() const
@ -570,20 +570,20 @@ EaseCircleActionOut* EaseCircleActionOut::reverse() const
EaseCircleActionInOut* EaseCircleActionInOut::create(ActionInterval* action)
{
EaseCircleActionInOut *_ret = new EaseCircleActionInOut();
if (_ret)
EaseCircleActionInOut *ret = new EaseCircleActionInOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseCircleActionInOut* EaseCircleActionInOut::clone() const
@ -620,20 +620,20 @@ EaseCircleActionInOut* EaseCircleActionInOut::reverse() const
EaseCubicActionIn* EaseCubicActionIn::create(ActionInterval* action)
{
EaseCubicActionIn *_ret = new EaseCubicActionIn();
if (_ret)
EaseCubicActionIn *ret = new EaseCubicActionIn();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseCubicActionIn* EaseCubicActionIn::clone() const
@ -661,20 +661,20 @@ EaseCubicActionIn* EaseCubicActionIn::reverse() const
EaseCubicActionOut* EaseCubicActionOut::create(ActionInterval* action)
{
EaseCubicActionOut *_ret = new EaseCubicActionOut();
if (_ret)
EaseCubicActionOut *ret = new EaseCubicActionOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseCubicActionOut* EaseCubicActionOut::clone() const
@ -702,20 +702,20 @@ EaseCubicActionOut* EaseCubicActionOut::reverse() const
EaseCubicActionInOut* EaseCubicActionInOut::create(ActionInterval* action)
{
EaseCubicActionInOut *_ret = new EaseCubicActionInOut();
if (_ret)
EaseCubicActionInOut *ret = new EaseCubicActionInOut();
if (ret)
{
if (_ret->initWithAction(action))
if (ret->initWithAction(action))
{
_ret->autorelease();
ret->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(_ret);
CC_SAFE_RELEASE_NULL(ret);
}
}
return _ret;
return ret;
}
EaseCubicActionInOut* EaseCubicActionInOut::clone() const

View File

@ -33,7 +33,7 @@ ActionFrame::ActionFrame()
: _frameType(0)
, _frameIndex(0)
, _fTime(0.0f)
, _easingType(FrameEaseType::FrameEase_Linear)
, _easingType(FrameEaseType::Linear)
{
}
@ -107,116 +107,116 @@ ActionInterval* ActionFrame::getEasingAction(ActionInterval* action)
switch (_easingType)
{
case FrameEaseType::FrameEase_Custom:
case FrameEaseType::Custom:
{
EaseBezierAction* cAction = EaseBezierAction::create(action);
cAction->setBezierParamer(_Parameter[0],_Parameter[1],_Parameter[2],_Parameter[3]);
return cAction;
}
break;
case FrameEaseType::FrameEase_Linear:
case FrameEaseType::Linear:
return action;
break;
case FrameEaseType::FrameEase_Sine_EaseIn:
case FrameEaseType::Sine_EaseIn:
return EaseSineIn::create(action);
break;
case FrameEaseType::FrameEase_Sine_EaseOut:
case FrameEaseType::Sine_EaseOut:
return EaseSineOut::create(action);
break;
case FrameEaseType::FrameEase_Sine_EaseInOut:
case FrameEaseType::Sine_EaseInOut:
return EaseSineInOut::create(action);
break;
case FrameEaseType::FrameEase_Quad_EaseIn:
case FrameEaseType::Quad_EaseIn:
return EaseQuadraticActionIn::create(action);
break;
case FrameEaseType::FrameEase_Quad_EaseOut:
case FrameEaseType::Quad_EaseOut:
return EaseQuadraticActionOut::create(action);
break;
case FrameEaseType::FrameEase_Quad_EaseInOut:
case FrameEaseType::Quad_EaseInOut:
return EaseQuadraticActionInOut::create(action);
break;
case FrameEaseType::FrameEase_Cubic_EaseIn:
case FrameEaseType::Cubic_EaseIn:
return EaseCubicActionIn::create(action);
break;
case FrameEaseType::FrameEase_Cubic_EaseOut:
case FrameEaseType::Cubic_EaseOut:
return EaseCubicActionOut::create(action);
break;
case FrameEaseType::FrameEase_Cubic_EaseInOut:
case FrameEaseType::Cubic_EaseInOut:
return EaseCubicActionInOut::create(action);
break;
case FrameEaseType::FrameEase_Quart_EaseIn:
case FrameEaseType::Quart_EaseIn:
return EaseQuarticActionIn::create(action);
break;
case FrameEaseType::FrameEase_Quart_EaseOut:
case FrameEaseType::Quart_EaseOut:
return EaseQuadraticActionOut::create(action);
break;
case FrameEaseType::FrameEase_Quart_EaseInOut:
case FrameEaseType::Quart_EaseInOut:
return EaseQuarticActionInOut::create(action);
break;
case FrameEaseType::FrameEase_Quint_EaseIn:
case FrameEaseType::Quint_EaseIn:
return EaseQuinticActionIn::create(action);
break;
case FrameEaseType::FrameEase_Quint_EaseOut:
case FrameEaseType::Quint_EaseOut:
return EaseQuinticActionOut::create(action);
break;
case FrameEaseType::FrameEase_Quint_EaseInOut:
case FrameEaseType::Quint_EaseInOut:
return EaseQuinticActionInOut::create(action);
break;
case FrameEaseType::FrameEase_Expo_EaseIn:
case FrameEaseType::Expo_EaseIn:
return EaseExponentialIn::create(action);
break;
case FrameEaseType::FrameEase_Expo_EaseOut:
case FrameEaseType::Expo_EaseOut:
return EaseExponentialOut::create(action);
break;
case FrameEaseType::FrameEase_Expo_EaseInOut:
case FrameEaseType::Expo_EaseInOut:
return EaseExponentialInOut::create(action);
break;
case FrameEaseType::FrameEase_Circ_EaseIn:
case FrameEaseType::Circ_EaseIn:
return EaseCircleActionIn::create(action);
break;
case FrameEaseType::FrameEase_Circ_EaseOut:
case FrameEaseType::Circ_EaseOut:
return EaseCircleActionOut::create(action);
break;
case FrameEaseType::FrameEase_Circ_EaseInOut:
case FrameEaseType::Circ_EaseInOut:
return EaseCircleActionInOut::create(action);
break;
case FrameEaseType::FrameEase_Elastic_EaseIn:
case FrameEaseType::Elastic_EaseIn:
{
EaseElasticIn* cAction = EaseElasticIn::create(action);
cAction->setPeriod(_Parameter[0]);
return cAction;
}
break;
case FrameEaseType::FrameEase_Elastic_EaseOut:
case FrameEaseType::Elastic_EaseOut:
{
EaseElasticOut* cAction = EaseElasticOut::create(action);
cAction->setPeriod(_Parameter[0]);
return cAction;
}
break;
case FrameEaseType::FrameEase_Elastic_EaseInOut:
case FrameEaseType::Elastic_EaseInOut:
{
EaseElasticInOut* cAction = EaseElasticInOut::create(action);
cAction->setPeriod(_Parameter[0]);
return cAction;
}
break;
case FrameEaseType::FrameEase_Back_EaseIn:
case FrameEaseType::Back_EaseIn:
return EaseBackIn::create(action);
break;
case FrameEaseType::FrameEase_Back_EaseOut:
case FrameEaseType::Back_EaseOut:
return EaseBackOut::create(action);
break;
case FrameEaseType::FrameEase_Back_EaseInOut:
case FrameEaseType::Back_EaseInOut:
return EaseBackInOut::create(action);
break;
case FrameEaseType::FrameEase_Bounce_EaseIn:
case FrameEaseType::Bounce_EaseIn:
return EaseBounceIn::create(action);
break;
case FrameEaseType::FrameEase_Bounce_EaseOut:
case FrameEaseType::Bounce_EaseOut:
return EaseBounceOut::create(action);
break;
case FrameEaseType::FrameEase_Bounce_EaseInOut:
case FrameEaseType::Bounce_EaseInOut:
return EaseBounceInOut::create(action);
break;
default:

View File

@ -41,52 +41,51 @@ enum FrameType
enum class FrameEaseType
{
FrameEase_Custom = -1,
Custom = -1,
FrameEase_Linear = 0,
Linear = 0,
FrameEase_Sine_EaseIn,
FrameEase_Sine_EaseOut,
FrameEase_Sine_EaseInOut,
Sine_EaseIn,
Sine_EaseOut,
Sine_EaseInOut,
Quad_EaseIn,
Quad_EaseOut,
Quad_EaseInOut,
FrameEase_Quad_EaseIn,
FrameEase_Quad_EaseOut,
FrameEase_Quad_EaseInOut,
Cubic_EaseIn,
Cubic_EaseOut,
Cubic_EaseInOut,
FrameEase_Cubic_EaseIn,
FrameEase_Cubic_EaseOut,
FrameEase_Cubic_EaseInOut,
Quart_EaseIn,
Quart_EaseOut,
Quart_EaseInOut,
FrameEase_Quart_EaseIn,
FrameEase_Quart_EaseOut,
FrameEase_Quart_EaseInOut,
Quint_EaseIn,
Quint_EaseOut,
Quint_EaseInOut,
FrameEase_Quint_EaseIn,
FrameEase_Quint_EaseOut,
FrameEase_Quint_EaseInOut,
Expo_EaseIn,
Expo_EaseOut,
Expo_EaseInOut,
FrameEase_Expo_EaseIn,
FrameEase_Expo_EaseOut,
FrameEase_Expo_EaseInOut,
Circ_EaseIn,
Circ_EaseOut,
Circ_EaseInOut,
FrameEase_Circ_EaseIn,
FrameEase_Circ_EaseOut,
FrameEase_Circ_EaseInOut,
Elastic_EaseIn,
Elastic_EaseOut,
Elastic_EaseInOut,
FrameEase_Elastic_EaseIn,
FrameEase_Elastic_EaseOut,
FrameEase_Elastic_EaseInOut,
Back_EaseIn,
Back_EaseOut,
Back_EaseInOut,
FrameEase_Back_EaseIn,
FrameEase_Back_EaseOut,
FrameEase_Back_EaseInOut,
Bounce_EaseIn,
Bounce_EaseOut,
Bounce_EaseInOut,
FrameEase_Bounce_EaseIn,
FrameEase_Bounce_EaseOut,
FrameEase_Bounce_EaseInOut,
FrameEase_TWEEN_EASING_MAX = 10000
TWEEN_EASING_MAX = 10000
};
/**
* @js NA
@ -164,26 +163,26 @@ public:
int getEasingType();
/**
* Gets the CCAction of ActionFrame.
* Gets the ActionInterval of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
* @parame duration the duration time of ActionFrame
*
* @return CCAction
* @return ActionInterval
*/
virtual cocos2d::ActionInterval* getAction(float fDuration);
virtual cocos2d::ActionInterval* getAction(float duration);
/**
* Gets the CCAction of ActionFrame.
* Gets the ActionInterval of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
* @parame duration the duration time of ActionFrame
*
* @parame fDuration the source ActionFrame
* @parame duration the source ActionFrame
*
* @return CCAction
* @return ActionInterval
*/
virtual cocos2d::ActionInterval* getAction(float fDuration,ActionFrame* srcFrame);
virtual cocos2d::ActionInterval* getAction(float duration,ActionFrame* srcFrame);
/**
*Set the CCAction easing parameter.
*Set the ActionInterval easing parameter.
*
*@parame parameter the parameter for frame ease
*
@ -195,7 +194,7 @@ protected:
*
* @parame action the duration time of ActionFrame
*
* @return CCAction
* @return ActionInterval
*/
virtual cocos2d::ActionInterval* getEasingAction(cocos2d::ActionInterval* action);
protected:
@ -239,13 +238,13 @@ public:
cocos2d::Point getPosition();
/**
* Gets the CCAction of ActionFrame.
* Gets the ActionInterval of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
* @parame duration the duration time of ActionFrame
*
* @return CCAction
* @return ActionInterval
*/
virtual cocos2d::ActionInterval* getAction(float fDuration);
virtual cocos2d::ActionInterval* getAction(float duration);
protected:
cocos2d::Point _position;
};
@ -297,13 +296,13 @@ public:
float getScaleY();
/**
* Gets the CCAction of ActionFrame.
* Gets the ActionInterval of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
* @parame duration the duration time of ActionFrame
*
* @return CCAction
* @return ActionInterval
*/
virtual cocos2d::ActionInterval* getAction(float fDuration);
virtual cocos2d::ActionInterval* getAction(float duration);
protected:
float _scaleX;
float _scaleY;
@ -341,23 +340,23 @@ public:
float getRotation();
/**
* Gets the CCAction of ActionFrame.
* Gets the ActionInterval of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
* @parame duration the duration time of ActionFrame
*
* @return CCAction
* @return ActionInterval
*/
virtual cocos2d::ActionInterval* getAction(float fDuration);
virtual cocos2d::ActionInterval* getAction(float duration);
/**
* Gets the CCAction of ActionFrame.
* Gets the ActionInterval of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
* @parame duration the duration time of ActionFrame
*
* @parame fDuration the source ActionFrame
* @parame duration the source ActionFrame
*
* @return CCAction
* @return ActionInterval
*/
virtual cocos2d::ActionInterval* getAction(float fDuration,ActionFrame* srcFrame);
virtual cocos2d::ActionInterval* getAction(float duration,ActionFrame* srcFrame);
public:
float _rotation;
};
@ -394,13 +393,13 @@ public:
int getOpacity();
/**
* Gets the CCAction of ActionFrame.
* Gets the ActionInterval of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
* @parame duration the duration time of ActionFrame
*
* @return CCAction
* @return ActionInterval
*/
virtual cocos2d::ActionInterval* getAction(float fDuration);
virtual cocos2d::ActionInterval* getAction(float duration);
protected:
float _opacity;
};
@ -438,13 +437,13 @@ public:
cocos2d::Color3B getColor();
/**
* Gets the CCAction of ActionFrame.
* Gets the ActionInterval of ActionFrame.
*
* @parame fDuration the duration time of ActionFrame
* @parame duration the duration time of ActionFrame
*
* @return CCAction
* @return ActionInterval
*/
virtual cocos2d::ActionInterval* getAction(float fDuration);
virtual cocos2d::ActionInterval* getAction(float duration);
protected:
cocos2d::Color3B _color;
};

View File

@ -31,7 +31,7 @@ namespace cocostudio {
static ActionManagerEx* sharedActionManager = nullptr;
ActionManagerEx* ActionManagerEx::shareManager()
ActionManagerEx* ActionManagerEx::getInstance()
{
if (!sharedActionManager) {
sharedActionManager = new ActionManagerEx();
@ -50,7 +50,7 @@ ActionManagerEx::ActionManagerEx()
ActionManagerEx::~ActionManagerEx()
{
_pActionDic.clear();
_actionDic.clear();
}
void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::Value &dic,Object* root)
@ -68,14 +68,14 @@ void ActionManagerEx::initWithDictionary(const char* jsonName,const rapidjson::V
action->initWithDictionary(actionDic,root);
actionList.pushBack(action);
}
_pActionDic.insert(std::pair<std::string, cocos2d::Vector<ActionObject*>>(fileName, actionList));
_actionDic.insert(std::pair<std::string, cocos2d::Vector<ActionObject*>>(fileName, actionList));
}
ActionObject* ActionManagerEx::getActionByName(const char* jsonName,const char* actionName)
{
auto iterator = _pActionDic.find(jsonName);
if (iterator == _pActionDic.end())
auto iterator = _actionDic.find(jsonName);
if (iterator == _actionDic.end())
{
return nullptr;
}
@ -113,7 +113,7 @@ ActionObject* ActionManagerEx::playActionByName(const char* jsonName,const char*
void ActionManagerEx::releaseActions()
{
_pActionDic.clear();
_actionDic.clear();
}
}

View File

@ -53,7 +53,7 @@ public:
* @js getInstance
* @lua getInstance
*/
static ActionManagerEx* shareManager();
static ActionManagerEx* getInstance();
/**
* Purges ActionManager point.
@ -104,7 +104,7 @@ public:
void releaseActions();
protected:
std::unordered_map<std::string, cocos2d::Vector<ActionObject*>> _pActionDic;
std::unordered_map<std::string, cocos2d::Vector<ActionObject*>> _actionDic;
};
}

View File

@ -351,7 +351,7 @@ int ActionNode::getFirstFrameIndex()
for (int n = 0; n < _frameArrayNum; n++)
{
auto cArray = _frameArray.at(n);
if (cArray.size() <= 0)
if (cArray.empty())
{
continue;
}

View File

@ -71,11 +71,9 @@ bool ActionObject::getLoop()
void ActionObject::setUnitTime(float fTime)
{
_fUnitTime = fTime;
auto nodeNum = _actionNodeList.size();
for ( int i = 0; i < nodeNum; i++ )
for(const auto e : _actionNodeList)
{
auto actionNode = _actionNodeList.at(i);
actionNode->setUnitTime(_fUnitTime);
e->setUnitTime(_fUnitTime);
}
}
float ActionObject::getUnitTime()

View File

@ -193,11 +193,11 @@ Widget* WidgetPropertiesReader0250::createWidget(const rapidjson::Value& data, c
// widget->setFileDesignSize(Size(fileDesignWidth, fileDesignHeight));
const rapidjson::Value& actions = DICTOOL->getSubDictionary_json(data, "animation");
/* *********temp********* */
// ActionManager::shareManager()->releaseActions();
// ActionManager::getInstance()->releaseActions();
/* ********************** */
CCLOG("file name == [%s]",fileName);
Object* rootWidget = (Object*) widget;
ActionManagerEx::shareManager()->initWithDictionary(fileName,actions,rootWidget);
ActionManagerEx::getInstance()->initWithDictionary(fileName,actions,rootWidget);
return widget;
}
@ -893,11 +893,11 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, c
// widget->setFileDesignSize(Size(fileDesignWidth, fileDesignHeight));
const rapidjson::Value& actions = DICTOOL->getSubDictionary_json(data, "animation");
/* *********temp********* */
// ActionManager::shareManager()->releaseActions();
// ActionManager::getInstance()->releaseActions();
/* ********************** */
CCLOG("file name == [%s]",fileName);
Object* rootWidget = (Object*) widget;
ActionManagerEx::shareManager()->initWithDictionary(fileName,actions,rootWidget);
ActionManagerEx::getInstance()->initWithDictionary(fileName,actions,rootWidget);
return widget;
}