1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- using System;
- using System.Collections.Generic;
- namespace Spine
- {
- public class DrawOrderTimeline : Timeline
- {
- public DrawOrderTimeline(int frameCount)
- {
- this.frames = new float[frameCount];
- this.drawOrders = new int[frameCount][];
- }
- public float[] Frames
- {
- get
- {
- return this.frames;
- }
- set
- {
- this.frames = value;
- }
- }
- public int[][] DrawOrders
- {
- get
- {
- return this.drawOrders;
- }
- set
- {
- this.drawOrders = value;
- }
- }
- public int FrameCount
- {
- get
- {
- return this.frames.Length;
- }
- }
- public void SetFrame(int frameIndex, float time, int[] drawOrder)
- {
- this.frames[frameIndex] = time;
- this.drawOrders[frameIndex] = drawOrder;
- }
- public void Apply(Skeleton skeleton, float lastTime, float time, List<Event> firedEvents, float alpha)
- {
- float[] array = this.frames;
- if (time < array[0])
- {
- return;
- }
- int num;
- if (time >= array[array.Length - 1])
- {
- num = array.Length - 1;
- }
- else
- {
- num = Animation.binarySearch(array, time) - 1;
- }
- List<Slot> drawOrder = skeleton.drawOrder;
- List<Slot> slots = skeleton.slots;
- int[] array2 = this.drawOrders[num];
- if (array2 == null)
- {
- drawOrder.Clear();
- drawOrder.AddRange(slots);
- }
- else
- {
- int i = 0;
- int num2 = array2.Length;
- while (i < num2)
- {
- drawOrder[i] = slots[array2[i]];
- i++;
- }
- }
- }
- internal float[] frames;
- private int[][] drawOrders;
- }
- }
|