|
@@ -114,6 +114,8 @@ namespace Spine {
|
|
|
boneData.rotation = GetFloat(boneMap, "rotation", 0);
|
|
|
boneData.scaleX = GetFloat(boneMap, "scaleX", 1);
|
|
|
boneData.scaleY = GetFloat(boneMap, "scaleY", 1);
|
|
|
+ boneData.flipX = GetBoolean(boneMap, "flipX", false);
|
|
|
+ boneData.flipY = GetBoolean(boneMap, "flipY", false);
|
|
|
boneData.inheritScale = GetBoolean(boneMap, "inheritScale", true);
|
|
|
boneData.inheritRotation = GetBoolean(boneMap, "inheritRotation", true);
|
|
|
skeletonData.bones.Add(boneData);
|
|
@@ -387,7 +389,7 @@ namespace Spine {
|
|
|
foreach (KeyValuePair<String, Object> timelineEntry in timelineMap) {
|
|
|
var values = (List<Object>)timelineEntry.Value;
|
|
|
var timelineName = (String)timelineEntry.Key;
|
|
|
- if (timelineName.Equals("color")) {
|
|
|
+ if (timelineName == "color") {
|
|
|
var timeline = new ColorTimeline(values.Count);
|
|
|
timeline.slotIndex = slotIndex;
|
|
|
|
|
@@ -402,7 +404,7 @@ namespace Spine {
|
|
|
timelines.Add(timeline);
|
|
|
duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 5 - 5]);
|
|
|
|
|
|
- } else if (timelineName.Equals("attachment")) {
|
|
|
+ } else if (timelineName == "attachment") {
|
|
|
var timeline = new AttachmentTimeline(values.Count);
|
|
|
timeline.slotIndex = slotIndex;
|
|
|
|
|
@@ -431,7 +433,7 @@ namespace Spine {
|
|
|
foreach (KeyValuePair<String, Object> timelineEntry in timelineMap) {
|
|
|
var values = (List<Object>)timelineEntry.Value;
|
|
|
var timelineName = (String)timelineEntry.Key;
|
|
|
- if (timelineName.Equals("rotate")) {
|
|
|
+ if (timelineName == "rotate") {
|
|
|
var timeline = new RotateTimeline(values.Count);
|
|
|
timeline.boneIndex = boneIndex;
|
|
|
|
|
@@ -445,10 +447,10 @@ namespace Spine {
|
|
|
timelines.Add(timeline);
|
|
|
duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 2 - 2]);
|
|
|
|
|
|
- } else if (timelineName.Equals("translate") || timelineName.Equals("scale")) {
|
|
|
+ } else if (timelineName == "translate" || timelineName == "scale") {
|
|
|
TranslateTimeline timeline;
|
|
|
float timelineScale = 1;
|
|
|
- if (timelineName.Equals("scale"))
|
|
|
+ if (timelineName == "scale")
|
|
|
timeline = new ScaleTimeline(values.Count);
|
|
|
else {
|
|
|
timeline = new TranslateTimeline(values.Count);
|
|
@@ -468,6 +470,21 @@ namespace Spine {
|
|
|
timelines.Add(timeline);
|
|
|
duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 3 - 3]);
|
|
|
|
|
|
+ } else if (timelineName == "flipX" || timelineName == "flipY") {
|
|
|
+ bool x = timelineName == "flipX";
|
|
|
+ var timeline = x ? new FlipXTimeline(values.Count) : new FlipYTimeline(values.Count);
|
|
|
+ timeline.boneIndex = boneIndex;
|
|
|
+
|
|
|
+ String field = x ? "x" : "y";
|
|
|
+ int frameIndex = 0;
|
|
|
+ foreach (Dictionary<String, Object> valueMap in values) {
|
|
|
+ float time = (float)valueMap["time"];
|
|
|
+ timeline.SetFrame(frameIndex, time, valueMap.ContainsKey(field) ? (bool)valueMap[field] : false);
|
|
|
+ frameIndex++;
|
|
|
+ }
|
|
|
+ timelines.Add(timeline);
|
|
|
+ duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 2 - 2]);
|
|
|
+
|
|
|
} else
|
|
|
throw new Exception("Invalid timeline type for a bone: " + timelineName + " (" + boneName + ")");
|
|
|
}
|
|
@@ -550,27 +567,8 @@ namespace Spine {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if (map.ContainsKey("flipx")) {
|
|
|
- var flipMap = (List<Object>)map["flipx"];
|
|
|
- var timeline = new FlipXTimeline(flipMap.Count);
|
|
|
- int frameIndex = 0;
|
|
|
- foreach (Dictionary<String, Object> valueMap in flipMap)
|
|
|
- timeline.SetFrame(frameIndex++, (float)valueMap["time"], valueMap.ContainsKey("x") ? (bool)valueMap["x"] : false);
|
|
|
- timelines.Add(timeline);
|
|
|
- duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 2 - 2]);
|
|
|
- }
|
|
|
- if (map.ContainsKey("flipy")) {
|
|
|
- var flipMap = (List<Object>)map["flipy"];
|
|
|
- var timeline = new FlipYTimeline(flipMap.Count);
|
|
|
- int frameIndex = 0;
|
|
|
- foreach (Dictionary<String, Object> valueMap in flipMap)
|
|
|
- timeline.SetFrame(frameIndex++, (float)valueMap["time"], valueMap.ContainsKey("y") ? (bool)valueMap["y"] : false);
|
|
|
- timelines.Add(timeline);
|
|
|
- duration = Math.Max(duration, timeline.frames[timeline.FrameCount * 2 - 2]);
|
|
|
- }
|
|
|
-
|
|
|
- if (map.ContainsKey("draworder")) {
|
|
|
- var values = (List<Object>)map["draworder"];
|
|
|
+ if (map.ContainsKey("drawOrder") || map.ContainsKey("draworder")) {
|
|
|
+ var values = (List<Object>)map[map.ContainsKey("drawOrder") ? "drawOrder" : "draworder"];
|
|
|
var timeline = new DrawOrderTimeline(values.Count);
|
|
|
int slotCount = skeletonData.slots.Count;
|
|
|
int frameIndex = 0;
|