|
@@ -65,7 +65,7 @@ namespace Spine {
|
|
|
private async Task<SkeletonData> ReadFile(string path) {
|
|
|
var folder = Windows.ApplicationModel.Package.Current.InstalledLocation;
|
|
|
var file = await folder.GetFileAsync(path).AsTask().ConfigureAwait(false);
|
|
|
- using (var reader = new StreamReader(await file.OpenStreamForReadAsync().ConfigureAwait(false))) {
|
|
|
+ using (StreamReader reader = new StreamReader(await file.OpenStreamForReadAsync().ConfigureAwait(false))) {
|
|
|
SkeletonData skeletonData = ReadSkeletonData(reader);
|
|
|
skeletonData.Name = Path.GetFileNameWithoutExtension(path);
|
|
|
return skeletonData;
|
|
@@ -78,9 +78,9 @@ namespace Spine {
|
|
|
#else
|
|
|
public override SkeletonData ReadSkeletonData (string path) {
|
|
|
#if WINDOWS_PHONE
|
|
|
- using (var reader = new StreamReader(Microsoft.Xna.Framework.TitleContainer.OpenStream(path))) {
|
|
|
+ using (StreamReader reader = new StreamReader(Microsoft.Xna.Framework.TitleContainer.OpenStream(path))) {
|
|
|
#else
|
|
|
- using (var reader = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))) {
|
|
|
+ using (StreamReader reader = new StreamReader(new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))) {
|
|
|
#endif
|
|
|
SkeletonData skeletonData = ReadSkeletonData(reader);
|
|
|
skeletonData.name = Path.GetFileNameWithoutExtension(path);
|
|
@@ -93,14 +93,14 @@ namespace Spine {
|
|
|
if (reader == null) throw new ArgumentNullException("reader", "reader cannot be null.");
|
|
|
|
|
|
float scale = this.scale;
|
|
|
- var skeletonData = new SkeletonData();
|
|
|
+ SkeletonData skeletonData = new SkeletonData();
|
|
|
|
|
|
- var root = Json.Deserialize(reader) as Dictionary<string, Object>;
|
|
|
+ Dictionary<string, object> root = Json.Deserialize(reader) as Dictionary<string, Object>;
|
|
|
if (root == null) throw new Exception("Invalid JSON.");
|
|
|
|
|
|
// Skeleton.
|
|
|
if (root.ContainsKey("skeleton")) {
|
|
|
- var skeletonMap = (Dictionary<string, Object>)root["skeleton"];
|
|
|
+ Dictionary<string, object> skeletonMap = (Dictionary<string, Object>)root["skeleton"];
|
|
|
skeletonData.hash = (string)skeletonMap["hash"];
|
|
|
skeletonData.version = (string)skeletonMap["spine"];
|
|
|
skeletonData.x = GetFloat(skeletonMap, "x", 0);
|
|
@@ -121,7 +121,7 @@ namespace Spine {
|
|
|
if (parent == null)
|
|
|
throw new Exception("Parent bone not found: " + boneMap["parent"]);
|
|
|
}
|
|
|
- var data = new BoneData(skeletonData.Bones.Count, (string)boneMap["name"], parent);
|
|
|
+ BoneData data = new BoneData(skeletonData.Bones.Count, (string)boneMap["name"], parent);
|
|
|
data.length = GetFloat(boneMap, "length", 0) * scale;
|
|
|
data.x = GetFloat(boneMap, "x", 0) * scale;
|
|
|
data.y = GetFloat(boneMap, "y", 0) * scale;
|
|
@@ -142,11 +142,11 @@ namespace Spine {
|
|
|
// Slots.
|
|
|
if (root.ContainsKey("slots")) {
|
|
|
foreach (Dictionary<string, Object> slotMap in (List<Object>)root["slots"]) {
|
|
|
- var slotName = (string)slotMap["name"];
|
|
|
- var boneName = (string)slotMap["bone"];
|
|
|
+ string slotName = (string)slotMap["name"];
|
|
|
+ string boneName = (string)slotMap["bone"];
|
|
|
BoneData boneData = skeletonData.FindBone(boneName);
|
|
|
if (boneData == null) throw new Exception("Slot bone not found: " + boneName);
|
|
|
- var data = new SlotData(skeletonData.Slots.Count, slotName, boneData);
|
|
|
+ SlotData data = new SlotData(skeletonData.Slots.Count, slotName, boneData);
|
|
|
|
|
|
if (slotMap.ContainsKey("color")) {
|
|
|
string color = (string)slotMap["color"];
|
|
@@ -157,7 +157,7 @@ namespace Spine {
|
|
|
}
|
|
|
|
|
|
if (slotMap.ContainsKey("dark")) {
|
|
|
- var color2 = (string)slotMap["dark"];
|
|
|
+ string color2 = (string)slotMap["dark"];
|
|
|
data.r2 = ToColor(color2, 0, 6); // expectedLength = 6. ie. "RRGGBB"
|
|
|
data.g2 = ToColor(color2, 1, 6);
|
|
|
data.b2 = ToColor(color2, 2, 6);
|
|
@@ -345,8 +345,8 @@ namespace Spine {
|
|
|
// Events.
|
|
|
if (root.ContainsKey("events")) {
|
|
|
foreach (KeyValuePair<string, Object> entry in (Dictionary<string, Object>)root["events"]) {
|
|
|
- var entryMap = (Dictionary<string, Object>)entry.Value;
|
|
|
- var data = new EventData(entry.Key);
|
|
|
+ Dictionary<string, object> entryMap = (Dictionary<string, Object>)entry.Value;
|
|
|
+ EventData data = new EventData(entry.Key);
|
|
|
data.Int = GetInt(entryMap, "int", 0);
|
|
|
data.Float = GetFloat(entryMap, "float", 0);
|
|
|
data.String = GetString(entryMap, "string", string.Empty);
|
|
@@ -383,8 +383,8 @@ namespace Spine {
|
|
|
float scale = this.scale;
|
|
|
name = GetString(map, "name", name);
|
|
|
|
|
|
- var typeName = GetString(map, "type", "region");
|
|
|
- var type = (AttachmentType)Enum.Parse(typeof(AttachmentType), typeName, true);
|
|
|
+ string typeName = GetString(map, "type", "region");
|
|
|
+ AttachmentType type = (AttachmentType)Enum.Parse(typeof(AttachmentType), typeName, true);
|
|
|
|
|
|
switch (type) {
|
|
|
case AttachmentType.Region: {
|
|
@@ -405,7 +405,7 @@ namespace Spine {
|
|
|
region.sequence = sequence;
|
|
|
|
|
|
if (map.ContainsKey("color")) {
|
|
|
- var color = (string)map["color"];
|
|
|
+ string color = (string)map["color"];
|
|
|
region.r = ToColor(color, 0);
|
|
|
region.g = ToColor(color, 1);
|
|
|
region.b = ToColor(color, 2);
|
|
@@ -431,7 +431,7 @@ namespace Spine {
|
|
|
mesh.Path = path;
|
|
|
|
|
|
if (map.ContainsKey("color")) {
|
|
|
- var color = (string)map["color"];
|
|
|
+ string color = (string)map["color"];
|
|
|
mesh.r = ToColor(color, 0);
|
|
|
mesh.g = ToColor(color, 1);
|
|
|
mesh.b = ToColor(color, 2);
|
|
@@ -504,7 +504,7 @@ namespace Spine {
|
|
|
}
|
|
|
|
|
|
public static Sequence ReadSequence (object sequenceJson) {
|
|
|
- var map = sequenceJson as Dictionary<string, Object>;
|
|
|
+ Dictionary<string, object> map = sequenceJson as Dictionary<string, Object>;
|
|
|
if (map == null) return null;
|
|
|
Sequence sequence = new Sequence(GetInt(map, "count"));
|
|
|
sequence.start = GetInt(map, "start", 1);
|
|
@@ -550,22 +550,22 @@ namespace Spine {
|
|
|
}
|
|
|
|
|
|
private void ReadAnimation (Dictionary<string, Object> map, string name, SkeletonData skeletonData) {
|
|
|
- var scale = this.scale;
|
|
|
- var timelines = new ExposedList<Timeline>();
|
|
|
+ float scale = this.scale;
|
|
|
+ ExposedList<Timeline> timelines = new ExposedList<Timeline>();
|
|
|
|
|
|
// Slot timelines.
|
|
|
if (map.ContainsKey("slots")) {
|
|
|
foreach (KeyValuePair<string, Object> entry in (Dictionary<string, Object>)map["slots"]) {
|
|
|
string slotName = entry.Key;
|
|
|
int slotIndex = FindSlotIndex(skeletonData, slotName);
|
|
|
- var timelineMap = (Dictionary<string, Object>)entry.Value;
|
|
|
+ Dictionary<string, object> timelineMap = (Dictionary<string, Object>)entry.Value;
|
|
|
foreach (KeyValuePair<string, Object> timelineEntry in timelineMap) {
|
|
|
- var values = (List<Object>)timelineEntry.Value;
|
|
|
+ List<object> values = (List<Object>)timelineEntry.Value;
|
|
|
int frames = values.Count;
|
|
|
if (frames == 0) continue;
|
|
|
- var timelineName = (string)timelineEntry.Key;
|
|
|
+ string timelineName = (string)timelineEntry.Key;
|
|
|
if (timelineName == "attachment") {
|
|
|
- var timeline = new AttachmentTimeline(frames, slotIndex);
|
|
|
+ AttachmentTimeline timeline = new AttachmentTimeline(frames, slotIndex);
|
|
|
int frame = 0;
|
|
|
foreach (Dictionary<string, Object> keyMap in values) {
|
|
|
timeline.SetFrame(frame++, GetFloat(keyMap, "time", 0), GetString(keyMap, "name", null));
|
|
@@ -573,11 +573,11 @@ namespace Spine {
|
|
|
timelines.Add(timeline);
|
|
|
|
|
|
} else if (timelineName == "rgba") {
|
|
|
- var timeline = new RGBATimeline(frames, frames << 2, slotIndex);
|
|
|
+ RGBATimeline timeline = new RGBATimeline(frames, frames << 2, slotIndex);
|
|
|
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
keyMapEnumerator.MoveNext();
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time = GetFloat(keyMap, "time", 0);
|
|
|
string color = (string)keyMap["color"];
|
|
|
float r = ToColor(color, 0);
|
|
@@ -590,7 +590,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
break;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
color = (string)nextMap["color"];
|
|
@@ -616,11 +616,11 @@ namespace Spine {
|
|
|
timelines.Add(timeline);
|
|
|
|
|
|
} else if (timelineName == "rgb") {
|
|
|
- var timeline = new RGBTimeline(frames, frames * 3, slotIndex);
|
|
|
+ RGBTimeline timeline = new RGBTimeline(frames, frames * 3, slotIndex);
|
|
|
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
keyMapEnumerator.MoveNext();
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time = GetFloat(keyMap, "time", 0);
|
|
|
string color = (string)keyMap["color"];
|
|
|
float r = ToColor(color, 0, 6);
|
|
@@ -632,7 +632,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
break;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
color = (string)nextMap["color"];
|
|
@@ -655,16 +655,16 @@ namespace Spine {
|
|
|
timelines.Add(timeline);
|
|
|
|
|
|
} else if (timelineName == "alpha") {
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
keyMapEnumerator.MoveNext();
|
|
|
timelines.Add(ReadTimeline(ref keyMapEnumerator, new AlphaTimeline(frames, frames, slotIndex), 0, 1));
|
|
|
|
|
|
} else if (timelineName == "rgba2") {
|
|
|
- var timeline = new RGBA2Timeline(frames, frames * 7, slotIndex);
|
|
|
+ RGBA2Timeline timeline = new RGBA2Timeline(frames, frames * 7, slotIndex);
|
|
|
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
keyMapEnumerator.MoveNext();
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time = GetFloat(keyMap, "time", 0);
|
|
|
string color = (string)keyMap["light"];
|
|
|
float r = ToColor(color, 0);
|
|
@@ -681,7 +681,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
break;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
color = (string)nextMap["light"];
|
|
@@ -717,11 +717,11 @@ namespace Spine {
|
|
|
timelines.Add(timeline);
|
|
|
|
|
|
} else if (timelineName == "rgb2") {
|
|
|
- var timeline = new RGB2Timeline(frames, frames * 6, slotIndex);
|
|
|
+ RGB2Timeline timeline = new RGB2Timeline(frames, frames * 6, slotIndex);
|
|
|
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
keyMapEnumerator.MoveNext();
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time = GetFloat(keyMap, "time", 0);
|
|
|
string color = (string)keyMap["light"];
|
|
|
float r = ToColor(color, 0, 6);
|
|
@@ -737,7 +737,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
break;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
color = (string)nextMap["light"];
|
|
@@ -780,7 +780,7 @@ namespace Spine {
|
|
|
foreach (KeyValuePair<string, Object> entry in (Dictionary<string, Object>)map["bones"]) {
|
|
|
string boneName = entry.Key;
|
|
|
int boneIndex = -1;
|
|
|
- var bones = skeletonData.bones.Items;
|
|
|
+ BoneData[] bones = skeletonData.bones.Items;
|
|
|
for (int i = 0, n = skeletonData.bones.Count; i < n; i++) {
|
|
|
if (bones[i].name == boneName) {
|
|
|
boneIndex = i;
|
|
@@ -788,13 +788,13 @@ namespace Spine {
|
|
|
}
|
|
|
}
|
|
|
if (boneIndex == -1) throw new Exception("Bone not found: " + boneName);
|
|
|
- var timelineMap = (Dictionary<string, Object>)entry.Value;
|
|
|
+ Dictionary<string, object> timelineMap = (Dictionary<string, Object>)entry.Value;
|
|
|
foreach (KeyValuePair<string, Object> timelineEntry in timelineMap) {
|
|
|
- var values = (List<Object>)timelineEntry.Value;
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object> values = (List<Object>)timelineEntry.Value;
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
if (!keyMapEnumerator.MoveNext()) continue;
|
|
|
int frames = values.Count;
|
|
|
- var timelineName = (string)timelineEntry.Key;
|
|
|
+ string timelineName = (string)timelineEntry.Key;
|
|
|
if (timelineName == "rotate")
|
|
|
timelines.Add(ReadTimeline(ref keyMapEnumerator, new RotateTimeline(frames, frames, boneIndex), 0, 1));
|
|
|
else if (timelineName == "translate") {
|
|
@@ -829,10 +829,10 @@ namespace Spine {
|
|
|
// IK constraint timelines.
|
|
|
if (map.ContainsKey("ik")) {
|
|
|
foreach (KeyValuePair<string, Object> timelineMap in (Dictionary<string, Object>)map["ik"]) {
|
|
|
- var values = (List<Object>)timelineMap.Value;
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object> values = (List<Object>)timelineMap.Value;
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
if (!keyMapEnumerator.MoveNext()) continue;
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
IkConstraintData constraint = skeletonData.FindIkConstraint(timelineMap.Key);
|
|
|
IkConstraintTimeline timeline = new IkConstraintTimeline(values.Count, values.Count << 1,
|
|
|
skeletonData.IkConstraints.IndexOf(constraint));
|
|
@@ -845,7 +845,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
break;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
float mix2 = GetFloat(nextMap, "mix", 1), softness2 = GetFloat(nextMap, "softness", 0) * scale;
|
|
|
if (keyMap.ContainsKey("curve")) {
|
|
@@ -865,10 +865,10 @@ namespace Spine {
|
|
|
// Transform constraint timelines.
|
|
|
if (map.ContainsKey("transform")) {
|
|
|
foreach (KeyValuePair<string, Object> timelineMap in (Dictionary<string, Object>)map["transform"]) {
|
|
|
- var values = (List<Object>)timelineMap.Value;
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object> values = (List<Object>)timelineMap.Value;
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
if (!keyMapEnumerator.MoveNext()) continue;
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
TransformConstraintData constraint = skeletonData.FindTransformConstraint(timelineMap.Key);
|
|
|
TransformConstraintTimeline timeline = new TransformConstraintTimeline(values.Count, values.Count * 6,
|
|
|
skeletonData.TransformConstraints.IndexOf(constraint));
|
|
@@ -882,7 +882,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
break;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
float mixRotate2 = GetFloat(nextMap, "mixRotate", 1), mixShearY2 = GetFloat(nextMap, "mixShearY", 1);
|
|
|
float mixX2 = GetFloat(nextMap, "mixX", 1), mixY2 = GetFloat(nextMap, "mixY", mixX2);
|
|
@@ -915,14 +915,14 @@ namespace Spine {
|
|
|
PathConstraintData constraint = skeletonData.FindPathConstraint(constraintMap.Key);
|
|
|
if (constraint == null) throw new Exception("Path constraint not found: " + constraintMap.Key);
|
|
|
int constraintIndex = skeletonData.pathConstraints.IndexOf(constraint);
|
|
|
- var timelineMap = (Dictionary<string, Object>)constraintMap.Value;
|
|
|
+ Dictionary<string, object> timelineMap = (Dictionary<string, Object>)constraintMap.Value;
|
|
|
foreach (KeyValuePair<string, Object> timelineEntry in timelineMap) {
|
|
|
- var values = (List<Object>)timelineEntry.Value;
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object> values = (List<Object>)timelineEntry.Value;
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
if (!keyMapEnumerator.MoveNext()) continue;
|
|
|
|
|
|
int frames = values.Count;
|
|
|
- var timelineName = (string)timelineEntry.Key;
|
|
|
+ string timelineName = (string)timelineEntry.Key;
|
|
|
if (timelineName == "position") {
|
|
|
CurveTimeline1 timeline = new PathConstraintPositionTimeline(frames, frames, constraintIndex);
|
|
|
timelines.Add(ReadTimeline(ref keyMapEnumerator, timeline, 0, constraint.positionMode == PositionMode.Fixed ? scale : 1));
|
|
@@ -932,7 +932,7 @@ namespace Spine {
|
|
|
constraint.spacingMode == SpacingMode.Length || constraint.spacingMode == SpacingMode.Fixed ? scale : 1));
|
|
|
} else if (timelineName == "mix") {
|
|
|
PathConstraintMixTimeline timeline = new PathConstraintMixTimeline(frames, frames * 3, constraintIndex);
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time = GetFloat(keyMap, "time", 0);
|
|
|
float mixRotate = GetFloat(keyMap, "mixRotate", 1);
|
|
|
float mixX = GetFloat(keyMap, "mixX", 1), mixY = GetFloat(keyMap, "mixY", mixX);
|
|
@@ -942,7 +942,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
break;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
float mixRotate2 = GetFloat(nextMap, "mixRotate", 1);
|
|
|
float mixX2 = GetFloat(nextMap, "mixX", 1), mixY2 = GetFloat(nextMap, "mixY", mixX2);
|
|
@@ -975,10 +975,10 @@ namespace Spine {
|
|
|
Attachment attachment = skin.GetAttachment(slot.index, attachmentMap.Key);
|
|
|
if (attachment == null) throw new Exception("Timeline attachment not found: " + attachmentMap.Key);
|
|
|
foreach (KeyValuePair<string, Object> timelineMap in (Dictionary<string, Object>)attachmentMap.Value) {
|
|
|
- var values = (List<Object>)timelineMap.Value;
|
|
|
- var keyMapEnumerator = values.GetEnumerator();
|
|
|
+ List<object> values = (List<Object>)timelineMap.Value;
|
|
|
+ List<object>.Enumerator keyMapEnumerator = values.GetEnumerator();
|
|
|
if (!keyMapEnumerator.MoveNext()) continue;
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
int frames = values.Count;
|
|
|
string timelineName = timelineMap.Key;
|
|
|
if (timelineName == "deform") {
|
|
@@ -1014,7 +1014,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
break;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
if (keyMap.ContainsKey("curve")) {
|
|
|
object curve = keyMap["curve"];
|
|
@@ -1047,8 +1047,8 @@ namespace Spine {
|
|
|
|
|
|
// Draw order timeline.
|
|
|
if (map.ContainsKey("drawOrder")) {
|
|
|
- var values = (List<Object>)map["drawOrder"];
|
|
|
- var timeline = new DrawOrderTimeline(values.Count);
|
|
|
+ List<object> values = (List<Object>)map["drawOrder"];
|
|
|
+ DrawOrderTimeline timeline = new DrawOrderTimeline(values.Count);
|
|
|
int slotCount = skeletonData.slots.Count;
|
|
|
int frame = 0;
|
|
|
foreach (Dictionary<string, Object> drawOrderMap in values) {
|
|
@@ -1057,7 +1057,7 @@ namespace Spine {
|
|
|
drawOrder = new int[slotCount];
|
|
|
for (int i = slotCount - 1; i >= 0; i--)
|
|
|
drawOrder[i] = -1;
|
|
|
- var offsets = (List<Object>)drawOrderMap["offsets"];
|
|
|
+ List<object> offsets = (List<Object>)drawOrderMap["offsets"];
|
|
|
int[] unchanged = new int[slotCount - offsets.Count];
|
|
|
int originalIndex = 0, unchangedIndex = 0;
|
|
|
foreach (Dictionary<string, Object> offsetMap in offsets) {
|
|
@@ -1084,13 +1084,13 @@ namespace Spine {
|
|
|
|
|
|
// Event timeline.
|
|
|
if (map.ContainsKey("events")) {
|
|
|
- var eventsMap = (List<Object>)map["events"];
|
|
|
- var timeline = new EventTimeline(eventsMap.Count);
|
|
|
+ List<object> eventsMap = (List<Object>)map["events"];
|
|
|
+ EventTimeline timeline = new EventTimeline(eventsMap.Count);
|
|
|
int frame = 0;
|
|
|
foreach (Dictionary<string, Object> eventMap in eventsMap) {
|
|
|
EventData eventData = skeletonData.FindEvent((string)eventMap["name"]);
|
|
|
if (eventData == null) throw new Exception("Event not found: " + eventMap["name"]);
|
|
|
- var e = new Event(GetFloat(eventMap, "time", 0), eventData) {
|
|
|
+ Event e = new Event(GetFloat(eventMap, "time", 0), eventData) {
|
|
|
intValue = GetInt(eventMap, "int", eventData.Int),
|
|
|
floatValue = GetFloat(eventMap, "float", eventData.Float),
|
|
|
stringValue = GetString(eventMap, "string", eventData.String)
|
|
@@ -1106,14 +1106,14 @@ namespace Spine {
|
|
|
}
|
|
|
timelines.TrimExcess();
|
|
|
float duration = 0;
|
|
|
- var items = timelines.Items;
|
|
|
+ Timeline[] items = timelines.Items;
|
|
|
for (int i = 0, n = timelines.Count; i < n; i++)
|
|
|
duration = Math.Max(duration, items[i].Duration);
|
|
|
skeletonData.animations.Add(new Animation(name, timelines, duration));
|
|
|
}
|
|
|
|
|
|
static Timeline ReadTimeline (ref List<object>.Enumerator keyMapEnumerator, CurveTimeline1 timeline, float defaultValue, float scale) {
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time = GetFloat(keyMap, "time", 0);
|
|
|
float value = GetFloat(keyMap, "value", defaultValue) * scale;
|
|
|
for (int frame = 0, bezier = 0; ; frame++) {
|
|
@@ -1122,7 +1122,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
return timeline;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
float value2 = GetFloat(nextMap, "value", defaultValue) * scale;
|
|
|
if (keyMap.ContainsKey("curve")) {
|
|
@@ -1138,7 +1138,7 @@ namespace Spine {
|
|
|
static Timeline ReadTimeline (ref List<object>.Enumerator keyMapEnumerator, CurveTimeline2 timeline, String name1, String name2, float defaultValue,
|
|
|
float scale) {
|
|
|
|
|
|
- var keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> keyMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time = GetFloat(keyMap, "time", 0);
|
|
|
float value1 = GetFloat(keyMap, name1, defaultValue) * scale, value2 = GetFloat(keyMap, name2, defaultValue) * scale;
|
|
|
for (int frame = 0, bezier = 0; ; frame++) {
|
|
@@ -1147,7 +1147,7 @@ namespace Spine {
|
|
|
timeline.Shrink(bezier);
|
|
|
return timeline;
|
|
|
}
|
|
|
- var nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
+ Dictionary<string, object> nextMap = (Dictionary<string, Object>)keyMapEnumerator.Current;
|
|
|
float time2 = GetFloat(nextMap, "time", 0);
|
|
|
float nvalue1 = GetFloat(nextMap, name1, defaultValue) * scale, nvalue2 = GetFloat(nextMap, name2, defaultValue) * scale;
|
|
|
if (keyMap.ContainsKey("curve")) {
|
|
@@ -1170,7 +1170,7 @@ namespace Spine {
|
|
|
if (curveString == "stepped") timeline.SetStepped(frame);
|
|
|
return bezier;
|
|
|
}
|
|
|
- var curveValues = (List<object>)curve;
|
|
|
+ List<object> curveValues = (List<object>)curve;
|
|
|
int i = value << 2;
|
|
|
float cx1 = (float)curveValues[i];
|
|
|
float cy1 = (float)curveValues[i + 1] * scale;
|
|
@@ -1186,8 +1186,8 @@ namespace Spine {
|
|
|
}
|
|
|
|
|
|
static float[] GetFloatArray (Dictionary<string, Object> map, string name, float scale) {
|
|
|
- var list = (List<Object>)map[name];
|
|
|
- var values = new float[list.Count];
|
|
|
+ List<object> list = (List<Object>)map[name];
|
|
|
+ float[] values = new float[list.Count];
|
|
|
if (scale == 1) {
|
|
|
for (int i = 0, n = list.Count; i < n; i++)
|
|
|
values[i] = (float)list[i];
|
|
@@ -1199,8 +1199,8 @@ namespace Spine {
|
|
|
}
|
|
|
|
|
|
static int[] GetIntArray (Dictionary<string, Object> map, string name) {
|
|
|
- var list = (List<Object>)map[name];
|
|
|
- var values = new int[list.Count];
|
|
|
+ List<object> list = (List<Object>)map[name];
|
|
|
+ int[] values = new int[list.Count];
|
|
|
for (int i = 0, n = list.Count; i < n; i++)
|
|
|
values[i] = (int)(float)list[i];
|
|
|
return values;
|