/// <summary> /// Updates this player. /// This means the current time gets increased by <seealso cref="Speed"/> and is applied to the current animation. /// </summary> public virtual void Update() { if (OnPreProcess != null) { OnPreProcess(this); } if (dirty) { this.UpdateRoot(); } this.Animation.Update(Time, Root); this.currentKey = this.Animation.CurrentKey; if (prevKey != currentKey) { if (OnMainlineKeyChanged != null) { OnMainlineKeyChanged(prevKey, currentKey); } prevKey = currentKey; } if (copyObjects) { TweenedKeys = tempTweenedKeys; UnmappedTweenedKeys = tempUnmappedTweenedKeys; this.CopyObjects(); } else { TweenedKeys = Animation.TweenedKeys; UnmappedTweenedKeys = Animation.UnmappedTweenedKeys; } foreach (Attachment attach in Attachments) { attach.Update(); } if (OnPostProcess != null) { OnPostProcess(this); } this.IncreaseTime(); }
private void LoadMainlineKeys(ContentReader input, Mainline mainline, int count) { for (int id = 0; id < count; id++) { int time = input.ReadInt32(); int objectRefCount = input.ReadInt32(); int boneRefCount = input.ReadInt32(); string curveType = input.ReadString(); float[] cs = new[] { input.ReadSingle(), input.ReadSingle(), input.ReadSingle(), input.ReadSingle(), }; Curve curve = new Curve(); curve.Type = SpriterUtils.GetType(curveType); curve.Constraints.Set(cs[0], cs[1], cs[2], cs[3]); Mainline.Key key = new Mainline.Key(id, time, curve, boneRefCount, objectRefCount); mainline.AddKey(key); LoadRefs(input, objectRefCount, boneRefCount, key); } }
private void LoadRefs(ContentReader input, int objectRefCount, int boneRefCount, Mainline.Key _key) { for (int id = 0; id < boneRefCount; id++) { int parent = input.ReadInt32(); int timeline = input.ReadInt32(); int key = input.ReadInt32(); Mainline.Key.BoneRef boneRef = new Mainline.Key.BoneRef(id, timeline, key, _key.GetBoneRef(parent)); _key.AddBoneRef(boneRef); } for (int id = 0; id < objectRefCount; id++) { int parent = input.ReadInt32(); int timeline = input.ReadInt32(); int key = input.ReadInt32(); int z = input.ReadInt32(); Mainline.Key.ObjectRef objref = new Mainline.Key.ObjectRef(id, timeline, key, _key.GetBoneRef(parent), z); _key.AddObjectRef(objref); } // TODO sort? }