12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- using System;
- using System.Collections.Generic;
- namespace Spine
- {
- public class AttachmentTimeline : Timeline
- {
- public AttachmentTimeline(int frameCount)
- {
- this.frames = new float[frameCount];
- this.attachmentNames = new string[frameCount];
- }
- public int SlotIndex
- {
- get
- {
- return this.slotIndex;
- }
- set
- {
- this.slotIndex = value;
- }
- }
- public float[] Frames
- {
- get
- {
- return this.frames;
- }
- set
- {
- this.frames = value;
- }
- }
- public string[] AttachmentNames
- {
- get
- {
- return this.attachmentNames;
- }
- set
- {
- this.attachmentNames = value;
- }
- }
- public int FrameCount
- {
- get
- {
- return this.frames.Length;
- }
- }
- public void SetFrame(int frameIndex, float time, string attachmentName)
- {
- this.frames[frameIndex] = time;
- this.attachmentNames[frameIndex] = attachmentName;
- }
- public void Apply(Skeleton skeleton, float lastTime, float time, List<Event> firedEvents, float alpha)
- {
- float[] array = this.frames;
- if (time < array[0])
- {
- if (lastTime > time)
- {
- this.Apply(skeleton, lastTime, 2.14748365E+09f, null, 0f);
- }
- return;
- }
- if (lastTime > time)
- {
- lastTime = -1f;
- }
- int num = ((time < array[array.Length - 1]) ? Animation.binarySearch(array, time) : array.Length) - 1;
- if (array[num] < lastTime)
- {
- return;
- }
- string text = this.attachmentNames[num];
- skeleton.slots[this.slotIndex].Attachment = ((text != null) ? skeleton.GetAttachment(this.slotIndex, text) : null);
- }
- internal int slotIndex;
- internal float[] frames;
- private string[] attachmentNames;
- }
- }
|