Merge pull request #11442 from xiaofeng11/v3

Fix action timeline bug
This commit is contained in:
minggo 2015-04-16 09:34:45 +08:00
commit 2b82c0c837
1 changed files with 13 additions and 8 deletions

View File

@ -199,22 +199,27 @@ void ActionTimeline::step(float delta)
} }
_time += delta * _timeSpeed; _time += delta * _timeSpeed;
if(_time < _endFrame * _frameInternal)
{
_currentFrame = (int)(_time / _frameInternal); _currentFrame = (int)(_time / _frameInternal);
stepToFrame(_currentFrame); stepToFrame(_currentFrame);
}
if(_time > _endFrame * _frameInternal) else
{ {
if(_lastFrameListener != nullptr) if(_lastFrameListener != nullptr)
_lastFrameListener(); _lastFrameListener();
_playing = _loop; _playing = _loop;
if(!_playing) if(!_playing)
{
_time = _endFrame * _frameInternal; _time = _endFrame * _frameInternal;
_currentFrame = (int)(_time / _frameInternal);
stepToFrame(_currentFrame);
}
else else
gotoFrameAndPlay(_startFrame, _endFrame, _loop); gotoFrameAndPlay(_startFrame, _endFrame, _loop);
} }
} }
typedef std::function<void(Node*)> tCallBack; typedef std::function<void(Node*)> tCallBack;