static int FadeOut(IntPtr L) { try { ToLua.CheckArgsCount(L, 1); DragonBones.BoneTimelineState obj = (DragonBones.BoneTimelineState)ToLua.CheckObject(L, 1, typeof(DragonBones.BoneTimelineState)); obj.FadeOut(); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int Update(IntPtr L) { try { ToLua.CheckArgsCount(L, 2); DragonBones.BoneTimelineState obj = (DragonBones.BoneTimelineState)ToLua.CheckObject(L, 1, typeof(DragonBones.BoneTimelineState)); float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.Update(arg0); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int get_bone(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); DragonBones.BoneTimelineState obj = (DragonBones.BoneTimelineState)o; DragonBones.Bone ret = obj.bone; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index bone on a nil value" : e.Message)); } }
static int _init(IntPtr L) { try { ToLua.CheckArgsCount(L, 4); DragonBones.BoneTimelineState obj = (DragonBones.BoneTimelineState)ToLua.CheckObject(L, 1, typeof(DragonBones.BoneTimelineState)); DragonBones.Armature arg0 = (DragonBones.Armature)ToLua.CheckObject(L, 2, typeof(DragonBones.Armature)); DragonBones.AnimationState arg1 = (DragonBones.AnimationState)ToLua.CheckObject(L, 3, typeof(DragonBones.AnimationState)); DragonBones.BoneTimelineData arg2 = (DragonBones.BoneTimelineData)ToLua.CheckObject(L, 4, typeof(DragonBones.BoneTimelineData)); obj._init(arg0, arg1, arg2); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_bone(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); DragonBones.BoneTimelineState obj = (DragonBones.BoneTimelineState)o; DragonBones.Bone arg0 = (DragonBones.Bone)ToLua.CheckObject(L, 2, typeof(DragonBones.Bone)); obj.bone = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index bone on a nil value" : e.Message)); } }
private void _BlendBoneTimline(BoneTimelineState timeline) { var bone = timeline.bone; var bonePose = timeline.bonePose.result; var animationPose = bone.animationPose; var boneWeight = this._weightResult > 0.0f ? this._weightResult : -this._weightResult; if (!bone._blendDirty) { bone._blendDirty = true; bone._blendLayer = this.layer; bone._blendLayerWeight = boneWeight; bone._blendLeftWeight = 1.0f; animationPose.x = bonePose.x * boneWeight; animationPose.y = bonePose.y * boneWeight; animationPose.rotation = bonePose.rotation * boneWeight; animationPose.skew = bonePose.skew * boneWeight; animationPose.scaleX = (bonePose.scaleX - 1.0f) * boneWeight + 1.0f; animationPose.scaleY = (bonePose.scaleY - 1.0f) * boneWeight + 1.0f; } else { boneWeight *= bone._blendLeftWeight; bone._blendLayerWeight += boneWeight; animationPose.x += bonePose.x * boneWeight; animationPose.y += bonePose.y * boneWeight; animationPose.rotation += bonePose.rotation * boneWeight; animationPose.skew += bonePose.skew * boneWeight; animationPose.scaleX += (bonePose.scaleX - 1.0f) * boneWeight; animationPose.scaleY += (bonePose.scaleY - 1.0f) * boneWeight; } if (this._fadeState != 0 || this._subFadeState != 0) { bone._transformDirty = true; } }
static int _CreateDragonBones_BoneTimelineState(IntPtr L) { try { int count = LuaDLL.lua_gettop(L); if (count == 0) { DragonBones.BoneTimelineState obj = new DragonBones.BoneTimelineState(); ToLua.PushObject(L, obj); return(1); } else { return(LuaDLL.luaL_throw(L, "invalid arguments to ctor method: DragonBones.BoneTimelineState.New")); } } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
/** * @private * @internal */ internal void AdvanceTime(float passedTime, float cacheFrameRate) { // Update fade time. if (this._fadeState != 0 || this._subFadeState != 0) { this._AdvanceFadeTime(passedTime); } // Update time. if (this._playheadState == 3) { // 11 if (this.timeScale != 1.0f) { passedTime *= this.timeScale; } this._time += passedTime; } if (this._timelineDirty) { this._timelineDirty = false; this.UpdateTimelines(); } if (this.weight == 0.0f) { return; } var isCacheEnabled = this._fadeState == 0 && cacheFrameRate > 0.0f; var isUpdateTimeline = true; var isUpdateBoneTimeline = true; var time = this._time; this._weightResult = this.weight * this._fadeProgress; // Update main timeline. this._actionTimeline.Update(time); if (isCacheEnabled) { // Cache time internval. var internval = cacheFrameRate * 2.0f; this._actionTimeline.currentTime = (float)Math.Floor(this._actionTimeline.currentTime * internval) / internval; } if (this._zOrderTimeline != null) { // Update zOrder timeline. this._zOrderTimeline.Update(time); } if (isCacheEnabled) { // Update cache. var cacheFrameIndex = (int)Math.Floor(this._actionTimeline.currentTime * cacheFrameRate); // uint if (this._armature._cacheFrameIndex == cacheFrameIndex) { // Same cache. isUpdateTimeline = false; isUpdateBoneTimeline = false; } else { this._armature._cacheFrameIndex = cacheFrameIndex; if (this.animationData.cachedFrames[cacheFrameIndex]) { // Cached. isUpdateBoneTimeline = false; } else { // Cache. this.animationData.cachedFrames[cacheFrameIndex] = true; } } } if (isUpdateTimeline) { if (isUpdateBoneTimeline) { Bone bone = null; BoneTimelineState prevTimeline = null; // for (int i = 0, l = this._boneTimelines.Count; i < l; ++i) { var timeline = this._boneTimelines[i]; if (bone != timeline.bone) { if (bone != null) { this._BlendBoneTimline(prevTimeline); if (bone._blendDirty) { if (bone._blendLeftWeight > 0.0f) { if (bone._blendLayer != this.layer) { if (bone._blendLayerWeight >= bone._blendLeftWeight) { bone._blendLeftWeight = 0.0f; bone = null; } else { bone._blendLayer = this.layer; bone._blendLeftWeight -= bone._blendLayerWeight; bone._blendLayerWeight = 0.0f; } } } else { bone = null; } } } bone = timeline.bone; } if (bone != null) { timeline.Update(time); if (i == l - 1) { this._BlendBoneTimline(timeline); } else { prevTimeline = timeline; } } } } for (int i = 0, l = this._slotTimelines.Count; i < l; ++i) { var timeline = this._slotTimelines[i]; if (this._IsDisabled(timeline.slot)) { continue; } timeline.Update(time); } } if (this._fadeState == 0) { if (this._subFadeState > 0) { this._subFadeState = 0; } if (this._actionTimeline.playState > 0) { if (this.autoFadeOutTime >= 0.0f) { // Auto fade out. this.FadeOut(this.autoFadeOutTime); } } } }