Fixed reading draw order timeline in binary format.

This commit is contained in:
NathanSweet 2016-04-14 13:40:39 +02:00
parent 7a3c24b4fb
commit 2c0dea8f87
2 changed files with 4 additions and 2 deletions

View File

@ -605,6 +605,7 @@ namespace Spine {
DrawOrderTimeline timeline = new DrawOrderTimeline(drawOrderCount); DrawOrderTimeline timeline = new DrawOrderTimeline(drawOrderCount);
int slotCount = skeletonData.slots.Count; int slotCount = skeletonData.slots.Count;
for (int i = 0; i < drawOrderCount; i++) { for (int i = 0; i < drawOrderCount; i++) {
float time = ReadFloat(input);
int offsetCount = ReadVarint(input, true); int offsetCount = ReadVarint(input, true);
int[] drawOrder = new int[slotCount]; int[] drawOrder = new int[slotCount];
for (int ii = slotCount - 1; ii >= 0; ii--) for (int ii = slotCount - 1; ii >= 0; ii--)
@ -625,7 +626,7 @@ namespace Spine {
// Fill in unchanged items. // Fill in unchanged items.
for (int ii = slotCount - 1; ii >= 0; ii--) for (int ii = slotCount - 1; ii >= 0; ii--)
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex]; if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
timeline.SetFrame(i, ReadFloat(input), drawOrder); timeline.SetFrame(i, time, drawOrder);
} }
timelines.Add(timeline); timelines.Add(timeline);
duration = Math.Max(duration, timeline.frames[drawOrderCount - 1]); duration = Math.Max(duration, timeline.frames[drawOrderCount - 1]);

View File

@ -613,6 +613,7 @@ public class SkeletonBinary {
DrawOrderTimeline timeline = new DrawOrderTimeline(drawOrderCount); DrawOrderTimeline timeline = new DrawOrderTimeline(drawOrderCount);
int slotCount = skeletonData.slots.size; int slotCount = skeletonData.slots.size;
for (int i = 0; i < drawOrderCount; i++) { for (int i = 0; i < drawOrderCount; i++) {
float time = input.readFloat();
int offsetCount = input.readInt(true); int offsetCount = input.readInt(true);
int[] drawOrder = new int[slotCount]; int[] drawOrder = new int[slotCount];
for (int ii = slotCount - 1; ii >= 0; ii--) for (int ii = slotCount - 1; ii >= 0; ii--)
@ -633,7 +634,7 @@ public class SkeletonBinary {
// Fill in unchanged items. // Fill in unchanged items.
for (int ii = slotCount - 1; ii >= 0; ii--) for (int ii = slotCount - 1; ii >= 0; ii--)
if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex]; if (drawOrder[ii] == -1) drawOrder[ii] = unchanged[--unchangedIndex];
timeline.setFrame(i, input.readFloat(), drawOrder); timeline.setFrame(i, time, drawOrder);
} }
timelines.add(timeline); timelines.add(timeline);
duration = Math.max(duration, timeline.getFrames()[drawOrderCount - 1]); duration = Math.max(duration, timeline.getFrames()[drawOrderCount - 1]);