private TimelineData _ParseBinaryTimeline(TimelineType type, uint offset, TimelineData timelineData = null) { var timeline = timelineData != null ? timelineData : BaseObject.BorrowObject <TimelineData>(); timeline.type = type; timeline.offset = offset; this._timeline = timeline; var keyFrameCount = this._timelineArrayBuffer[timeline.offset + (int)BinaryOffset.TimelineKeyFrameCount]; if (keyFrameCount == 1) { timeline.frameIndicesOffset = -1; } else { // One more frame than animation. var totalFrameCount = this._animation.frameCount + 1; var frameIndices = this._data.frameIndices; timeline.frameIndicesOffset = frameIndices.Count; frameIndices.ResizeList(frameIndices.Count + (int)totalFrameCount); for (int i = 0, iK = 0, frameStart = 0, frameCount = 0; i < totalFrameCount; ++i) { if (frameStart + frameCount <= i && iK < keyFrameCount) { frameStart = this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[timeline.offset + (int)BinaryOffset.TimelineFrameOffset + iK]]; if (iK == keyFrameCount - 1) { frameCount = (int)this._animation.frameCount - frameStart; } else { frameCount = this._frameArrayBuffer[this._animation.frameOffset + this._timelineArrayBuffer[timeline.offset + (int)BinaryOffset.TimelineFrameOffset + iK + 1]] - frameStart; } iK++; } frameIndices[timeline.frameIndicesOffset + i] = (uint)(iK - 1); } } this._timeline = null; // return(timeline); }
protected override void _OnClear() { foreach (var pair in boneTimelines) { for (int i = 0; i < pair.Value.Count; ++i) { pair.Value[i].ReturnToPool(); } } foreach (var pair in slotTimelines) { for (int i = 0; i < pair.Value.Count; ++i) { pair.Value[i].ReturnToPool(); } } if (this.actionTimeline != null) { this.actionTimeline.ReturnToPool(); } if (this.zOrderTimeline != null) { this.zOrderTimeline.ReturnToPool(); } this.frameIntOffset = 0; this.frameFloatOffset = 0; this.frameOffset = 0; this.frameCount = 0; this.playTimes = 0; this.duration = 0.0f; this.scale = 1.0f; this.fadeInTime = 0.0f; this.cacheFrameRate = 0.0f; this.name = ""; this.boneTimelines.Clear(); this.slotTimelines.Clear(); this.boneCachedFrameIndices.Clear(); this.slotCachedFrameIndices.Clear(); this.cachedFrames.Clear(); this.actionTimeline = null; this.zOrderTimeline = null; this.parent = null; }
static int AddBoneTimeline(IntPtr L) { try { ToLua.CheckArgsCount(L, 3); DragonBones.AnimationData obj = (DragonBones.AnimationData)ToLua.CheckObject <DragonBones.AnimationData>(L, 1); DragonBones.BoneData arg0 = (DragonBones.BoneData)ToLua.CheckObject <DragonBones.BoneData>(L, 2); DragonBones.TimelineData arg1 = (DragonBones.TimelineData)ToLua.CheckObject <DragonBones.TimelineData>(L, 3); obj.AddBoneTimeline(arg0, arg1); return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e)); } }
static int set_offset(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); DragonBones.TimelineData <DragonBones.AnimationFrameData> obj = (DragonBones.TimelineData <DragonBones.AnimationFrameData>)o; float arg0 = (float)LuaDLL.luaL_checknumber(L, 2); obj.offset = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index offset on a nil value" : e.Message)); } }
static int get_frames(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); DragonBones.TimelineData <DragonBones.AnimationFrameData> obj = (DragonBones.TimelineData <DragonBones.AnimationFrameData>)o; System.Collections.Generic.List <DragonBones.AnimationFrameData> ret = obj.frames; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index frames on a nil value" : e.Message)); } }
static int get_offset(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); DragonBones.TimelineData <DragonBones.AnimationFrameData> obj = (DragonBones.TimelineData <DragonBones.AnimationFrameData>)o; float ret = obj.offset; LuaDLL.lua_pushnumber(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o == null ? "attempt to index offset on a nil value" : e.Message)); } }
static int set_zOrderTimeline(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); DragonBones.AnimationData obj = (DragonBones.AnimationData)o; DragonBones.TimelineData arg0 = (DragonBones.TimelineData)ToLua.CheckObject <DragonBones.TimelineData>(L, 2); obj.zOrderTimeline = arg0; return(0); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index zOrderTimeline on a nil value")); } }
static int get_zOrderTimeline(IntPtr L) { object o = null; try { o = ToLua.ToObject(L, 1); DragonBones.AnimationData obj = (DragonBones.AnimationData)o; DragonBones.TimelineData ret = obj.zOrderTimeline; ToLua.PushObject(L, ret); return(1); } catch (Exception e) { return(LuaDLL.toluaL_exception(L, e, o, "attempt to index zOrderTimeline on a nil value")); } }
/// <private/> public void AddConstraintTimeline(ConstraintData constraint, TimelineData timeline) { if (constraint == null || timeline == null) { return; } if (!this.constraintTimelines.ContainsKey(constraint.name)) { this.constraintTimelines[constraint.name] = new List <TimelineData>(); } var timelines = this.constraintTimelines[constraint.name]; if (!timelines.Contains(timeline)) { timelines.Add(timeline); } }
/// <private/> public void AddSlotTimeline(SlotData slot, TimelineData timeline) { if (slot == null || timeline == null) { return; } if (!this.slotTimelines.ContainsKey(slot.name)) { this.slotTimelines[slot.name] = new List <TimelineData>(); } var timelines = this.slotTimelines[slot.name]; if (!timelines.Contains(timeline)) { timelines.Add(timeline); } }
/// <private/> public void AddBoneTimeline(BoneData bone, TimelineData tiemline) { if (bone == null || tiemline == null) { return; } if (!this.boneTimelines.ContainsKey(bone.name)) { this.boneTimelines[bone.name] = new List <TimelineData>(); } var timelines = this.boneTimelines[bone.name]; if (!timelines.Contains(tiemline)) { timelines.Add(tiemline); } }