change play arguments

This commit is contained in:
yinkaile 2013-12-18 22:57:18 +08:00
parent 57c33e0604
commit 7be834ea37
2 changed files with 9 additions and 24 deletions

View File

@ -163,7 +163,7 @@ float ArmatureAnimation::getSpeedScale() const
}
void ArmatureAnimation::play(const char *animationName, int durationTo, int durationTween, int loop, int tweenEasing)
void ArmatureAnimation::play(const char *animationName, int durationTo, int loop)
{
CCASSERT(_animationData, "_animationData can not be null");
@ -180,10 +180,9 @@ void ArmatureAnimation::play(const char *animationName, int durationTo, int dura
//! Further processing parameters
durationTo = (durationTo == -1) ? _movementData->durationTo : durationTo;
durationTween = (durationTween == -1) ? _movementData->durationTween : durationTween;
durationTween = (durationTween == 0) ? _movementData->duration : durationTween;
int durationTween = _movementData->durationTween == 0 ? _rawDuration : _movementData->durationTween;
tweenEasing = (tweenEasing == TWEEN_EASING_MAX) ? _movementData->tweenEasing : tweenEasing;
TweenType tweenEasing = _movementData->tweenEasing;
loop = (loop < 0) ? _movementData->loop : loop;
_onMovementList = false;
@ -247,13 +246,13 @@ void ArmatureAnimation::play(const char *animationName, int durationTo, int dura
}
void ArmatureAnimation::playByIndex(int animationIndex, int durationTo, int durationTween, int loop, int tweenEasing)
void ArmatureAnimation::playByIndex(int animationIndex, int durationTo, int loop)
{
std::vector<std::string> &movName = _animationData->movementNames;
CC_ASSERT((animationIndex > -1) && ((unsigned int)animationIndex < movName.size()));
std::string animationName = movName.at(animationIndex);
play(animationName.c_str(), durationTo, durationTween, loop, tweenEasing);
play(animationName.c_str(), durationTo, loop);
}
@ -512,7 +511,7 @@ void ArmatureAnimation::updateMovementList()
{
if (_movementListLoop)
{
play(_movementList.at(_movementIndex).c_str(), -1, -1, 0);
play(_movementList.at(_movementIndex).c_str(), -1, 0);
_movementIndex++;
if (_movementIndex >= _movementList.size())
@ -524,7 +523,7 @@ void ArmatureAnimation::updateMovementList()
{
if (_movementIndex < _movementList.size())
{
play(_movementList.at(_movementIndex).c_str(), -1, -1, 0);
play(_movementList.at(_movementIndex).c_str(), -1, 0);
_movementIndex++;
}
else

View File

@ -117,33 +117,19 @@ public:
* It's meaning is changing to this animation need how many frames
*
* -1 : use the value from MovementData get from flash design panel
* @param durationTween The frame count you want to play in the game.
* if _durationTween is 80, then the animation will played 80 frames in a loop
*
* -1 : use the value from MovementData get from flash design panel
*
* @param loop Whether the animation is loop
*
* loop < 0 : use the value from MovementData get from flash design panel
* loop = 0 : this animation is not loop
* loop > 0 : this animation is loop
*
* @param tweenEasing Tween easing is used for calculate easing effect
*
* TWEEN_EASING_MAX : use the value from MovementData get from flash design panel
* -1 : fade out
* 0 : line
* 1 : fade in
* 2 : fade in and out
*
*/
virtual void play(const char *animationName, int durationTo = -1, int durationTween = -1, int loop = -1, int tweenEasing = TWEEN_EASING_MAX);
virtual void play(const char *animationName, int durationTo = -1, int loop = -1);
/**
* Play animation by index, the other param is the same to play.
* @param animationIndex the animation index you want to play
*/
virtual void playByIndex(int animationIndex, int durationTo = -1, int durationTween = -1, int loop = -1, int tweenEasing = TWEEN_EASING_MAX);
virtual void playByIndex(int animationIndex, int durationTo = -1, int loop = -1);
virtual void play(bool loop, const std::string *movementNames, int movementNumber);