static int Update(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); DragonBones.AnimationTimelineState obj = (DragonBones.AnimationTimelineState)ToLua.CheckObject(L, 1, typeof(DragonBones.AnimationTimelineState)); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.Update(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/** * @private */ internal void _advanceTime(float passedTime, float weightLeft, int index) { // Update fade time. (Still need to be update even if the passedTime is zero) if (_fadeState != 0) { _advanceFadeTime(passedTime); } // Update time. passedTime *= timeScale; if (passedTime != 0.0f && _isPlaying && !_isPausePlayhead) { _time += passedTime; } // Blend weight. _weightResult = weight * _fadeProgress * weightLeft; if (_weightResult > 0.0f) { var isCacheEnabled = _fadeProgress >= 1.0f && index == 0 && _armature.cacheFrameRate > 0; var cacheTimeToFrameScale = _animationData.cacheTimeToFrameScale; var isUpdatesTimeline = true; var isUpdatesBoneTimeline = true; var time = cacheTimeToFrameScale * 2.0f; time = isCacheEnabled ? ((float)Math.Floor(_time * time) / time) : _time; // Cache time internval. // Update main timeline. _timeline.Update(time); if (!_animationData.hasAsynchronyTimeline) { time = _timeline._currentTime; } if (_zOrderTimeline != null) { _zOrderTimeline.Update(time); } if (isCacheEnabled) { var cacheFrameIndex = (int)Math.Floor(_timeline._currentTime * cacheTimeToFrameScale); // int if (_armature._cacheFrameIndex == cacheFrameIndex) // Same cache. { isUpdatesTimeline = false; isUpdatesBoneTimeline = false; } else { _armature._cacheFrameIndex = cacheFrameIndex; if (_armature._animation._animationStateDirty) // Update _cacheFrames. { _armature._animation._animationStateDirty = false; for (int i = 0, l = _boneTimelines.Count; i < l; ++i) { var boneTimelineState = _boneTimelines[i]; boneTimelineState.bone._cacheFrames = (boneTimelineState._timeline).cachedFrames; } for (int i = 0, l = _slotTimelines.Count; i < l; ++i) { var slotTimelineState = _slotTimelines[i]; slotTimelineState.slot._cacheFrames = (slotTimelineState._timeline).cachedFrames; } } if (_animationData.cachedFrames[cacheFrameIndex]) // Cached. { isUpdatesBoneTimeline = false; } else // Cache. { _animationData.cachedFrames[cacheFrameIndex] = true; } } } else { _armature._cacheFrameIndex = -1; } if (isUpdatesTimeline) { if (isUpdatesBoneTimeline) { for (int i = 0, l = _boneTimelines.Count; i < l; ++i) { var boneTimelineState = _boneTimelines[i]; boneTimelineState.Update(time); } } for (int i = 0, l = _slotTimelines.Count; i < l; ++i) { var slotTimelineState = _slotTimelines[i]; slotTimelineState.Update(time); } for (int i = 0, l = _ffdTimelines.Count; i < l; ++i) { var ffdTimelineState = _ffdTimelines[i]; ffdTimelineState.Update(time); } } } if (autoFadeOutTime >= 0.0f && _fadeProgress >= 1.0f && _timeline._isCompleted) { FadeOut(autoFadeOutTime); } }
/** * @private */ internal void _advanceTime(float passedTime, float cacheFrameRate) { // Update fade time. if (_fadeState != 0 || _subFadeState != 0) { _advanceFadeTime(passedTime); } // Update time. if (timeScale != 1.0f) { passedTime *= timeScale; } if (passedTime != 0.0f && _playheadState == 3) // 11 { _time += passedTime; } // weight. _weightResult = weight * _fadeProgress; if (_weightResult != 0.0f) { var isCacheEnabled = _fadeState == 0 && cacheFrameRate > 0.0f; var isUpdatesTimeline = true; var isUpdatesBoneTimeline = true; var time = _time; // Update main timeline. _timeline.Update(time); // Cache time internval. if (isCacheEnabled) { _timeline._currentTime = (float)Math.Floor(_timeline._currentTime * cacheFrameRate) / cacheFrameRate; } // Update zOrder timeline. if (_zOrderTimeline != null) { _zOrderTimeline.Update(time); } // Update cache. if (isCacheEnabled) { var cacheFrameIndex = (int)Math.Floor(_timeline._currentTime * cacheFrameRate); // uint if (_armature.animation._cacheFrameIndex == cacheFrameIndex) // Same cache. { isUpdatesTimeline = false; isUpdatesBoneTimeline = false; } else { _armature.animation._cacheFrameIndex = cacheFrameIndex; if (_animationData.cachedFrames[cacheFrameIndex]) // Cached. { isUpdatesBoneTimeline = false; } else // Cache. { _animationData.cachedFrames[cacheFrameIndex] = true; } } } // Update timelines. if (isUpdatesTimeline) { if (isUpdatesBoneTimeline) { for (int i = 0, l = _boneTimelines.Count; i < l; ++i) { _boneTimelines[i].Update(time); } } for (int i = 0, l = _slotTimelines.Count; i < l; ++i) { _slotTimelines[i].Update(time); } for (int i = 0, l = _ffdTimelines.Count; i < l; ++i) { _ffdTimelines[i].Update(time); } } } if (_fadeState == 0) { if (_subFadeState > 0) { _subFadeState = 0; } // Auto fade out. if (autoFadeOutTime >= 0.0f) { if (_timeline._playState > 0) { FadeOut(autoFadeOutTime); } } } }