diff --git a/spine-csharp/spine-csharp.csproj b/spine-csharp/spine-csharp.csproj
index a0b8effbe..8491dd148 100644
--- a/spine-csharp/spine-csharp.csproj
+++ b/spine-csharp/spine-csharp.csproj
@@ -70,6 +70,7 @@
+
diff --git a/spine-csharp/src/Animation.cs b/spine-csharp/src/Animation.cs
index 4953d23ef..c77e34e05 100644
--- a/spine-csharp/src/Animation.cs
+++ b/spine-csharp/src/Animation.cs
@@ -548,7 +548,7 @@ namespace Spine {
}
}
- public class FFDTimeline : CurveTimeline {
+ public class FfdTimeline : CurveTimeline {
internal int slotIndex;
internal float[] frames;
private float[][] frameVertices;
@@ -559,7 +559,7 @@ namespace Spine {
public float[][] Vertices { get { return frameVertices; } set { frameVertices = value; } }
public Attachment Attachment { get { return attachment; } set { attachment = value; } }
- public FFDTimeline (int frameCount)
+ public FfdTimeline (int frameCount)
: base(frameCount) {
frames = new float[frameCount];
frameVertices = new float[frameCount][];
@@ -573,7 +573,7 @@ namespace Spine {
override public void Apply (Skeleton skeleton, float lastTime, float time, ExposedList firedEvents, float alpha) {
Slot slot = skeleton.slots.Items[slotIndex];
- IFfdAttachment ffdAttachment = slot.attachment as IFfdAttachment; // == null if not FfdAttachment.
+ IFfdAttachment ffdAttachment = slot.attachment as IFfdAttachment;
if (ffdAttachment == null || !ffdAttachment.ApplyFFD(attachment)) return;
float[] frames = this.frames;
diff --git a/spine-csharp/src/Attachments/IFfdAttachment.cs b/spine-csharp/src/Attachments/IFfdAttachment.cs
index 8e234f3a2..bdc87f7de 100644
--- a/spine-csharp/src/Attachments/IFfdAttachment.cs
+++ b/spine-csharp/src/Attachments/IFfdAttachment.cs
@@ -1,4 +1,35 @@
-namespace Spine {
+/******************************************************************************
+ * Spine Runtimes Software License
+ * Version 2.3
+ *
+ * Copyright (c) 2013-2015, Esoteric Software
+ * All rights reserved.
+ *
+ * You are granted a perpetual, non-exclusive, non-sublicensable and
+ * non-transferable license to use, install, execute and perform the Spine
+ * Runtimes Software (the "Software") and derivative works solely for personal
+ * or internal use. Without the written permission of Esoteric Software (see
+ * Section 2 of the Spine Software License Agreement), you may not (a) modify,
+ * translate, adapt or otherwise create derivative works, improvements of the
+ * Software or develop new applications using the Software or (b) remove,
+ * delete, alter or obscure any trademarks or any copyright, trademark, patent
+ * or other intellectual property or proprietary rights notices on or in the
+ * Software, including any copy thereof. Redistributions in binary or source
+ * form must include this license and terms.
+ *
+ * THIS SOFTWARE IS PROVIDED BY ESOTERIC SOFTWARE "AS IS" AND ANY EXPRESS OR
+ * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+ * EVENT SHALL ESOTERIC SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *****************************************************************************/
+
+namespace Spine {
public interface IFfdAttachment {
bool ApplyFFD (Attachment sourceAttachment);
}
diff --git a/spine-csharp/src/IkConstraint.cs b/spine-csharp/src/IkConstraint.cs
index c5212850c..cb3b6938d 100644
--- a/spine-csharp/src/IkConstraint.cs
+++ b/spine-csharp/src/IkConstraint.cs
@@ -99,18 +99,18 @@ namespace Spine {
static public void Apply (Bone parent, Bone child, float targetX, float targetY, int bendDir, float alpha) {
if (alpha == 0) return;
float px = parent.x, py = parent.y, psx = parent.scaleX, psy = parent.scaleY;
- int offset1, offset2, sign2;
+ int os1, os2, s2;
if (psx < 0) {
psx = -psx;
- offset1 = 180;
- sign2 = -1;
+ os1 = 180;
+ s2 = -1;
} else {
- offset1 = 0;
- sign2 = 1;
+ os1 = 0;
+ s2 = 1;
}
if (psy < 0) {
psy = -psy;
- sign2 = -sign2;
+ s2 = -s2;
}
float cx = child.x, cy = child.y, csx = child.scaleX;
bool u = Math.Abs(psx - psy) <= 0.0001f;
@@ -121,9 +121,9 @@ namespace Spine {
}
if (csx < 0) {
csx = -csx;
- offset2 = 180;
+ os2 = 180;
} else
- offset2 = 0;
+ os2 = 0;
Bone pp = parent.parent;
float tx, ty, dx, dy;
if (pp == null) {
@@ -208,9 +208,9 @@ namespace Spine {
}
}
outer:
- float oo = MathUtils.Atan2(cy, cx) * sign2;
- a1 = (a1 - oo) * MathUtils.radDeg + offset1;
- a2 = (a2 + oo) * MathUtils.radDeg * sign2 + offset2;
+ float os = MathUtils.Atan2(cy, cx) * s2;
+ a1 = (a1 - os) * MathUtils.radDeg + os1;
+ a2 = (a2 + os) * MathUtils.radDeg * s2 + os2;
if (a1 > 180) a1 -= 360;
else if (a1 < -180) a1 += 360;
if (a2 > 180) a2 -= 360;
diff --git a/spine-csharp/src/SkeletonBinary.cs b/spine-csharp/src/SkeletonBinary.cs
index f63367aaa..4c065e3f4 100644
--- a/spine-csharp/src/SkeletonBinary.cs
+++ b/spine-csharp/src/SkeletonBinary.cs
@@ -50,11 +50,10 @@ namespace Spine {
public const int CURVE_STEPPED = 1;
public const int CURVE_BEZIER = 2;
- private AttachmentLoader attachmentLoader;
public float Scale { get; set; }
- private byte[] bytes = new byte[32];
- private byte[] buffer = new byte[4];
+ private AttachmentLoader attachmentLoader;
+ private byte[] buffer = new byte[32];
private List linkedMeshes = new List();
public SkeletonBinary (params Atlas[] atlasArray)
@@ -358,7 +357,7 @@ namespace Spine {
for (int i = 0; i < vertexCount; i++) {
int boneCount = (int)ReadFloat(input);
bones.Add(boneCount);
- for (int ii = 0; i < boneCount; ii++) {
+ for (int ii = 0; ii < boneCount; ii++) {
bones.Add((int)ReadFloat(input));
weights.Add(ReadFloat(input) * scale);
weights.Add(ReadFloat(input) * scale);
@@ -554,7 +553,7 @@ namespace Spine {
for (int iii = 0, nnn = ReadVarint(input, true); iii < nnn; iii++) {
Attachment attachment = skin.GetAttachment(slotIndex, ReadString(input));
int frameCount = ReadVarint(input, true);
- FFDTimeline timeline = new FFDTimeline(frameCount);
+ FfdTimeline timeline = new FfdTimeline(frameCount);
timeline.slotIndex = slotIndex;
timeline.attachment = attachment;
for (int frameIndex = 0; frameIndex < frameCount; frameIndex++) {
@@ -698,9 +697,7 @@ namespace Spine {
if ((b & 0x80) != 0) {
b = input.ReadByte();
result |= (b & 0x7F) << 21;
- if ((b & 0x80) != 0) {
- result |= (input.ReadByte() & 0x7F) << 28;
- }
+ if ((b & 0x80) != 0) result |= (input.ReadByte() & 0x7F) << 28;
}
}
}
@@ -716,20 +713,18 @@ namespace Spine {
return "";
}
byteCount--;
- byte[] bytes = this.bytes;
- if (bytes.Length < byteCount) bytes = new byte[byteCount];
- ReadFully(input, bytes, 0, byteCount);
- return System.Text.Encoding.UTF8.GetString(bytes, 0, byteCount);
+ byte[] buffer = this.buffer;
+ if (buffer.Length < byteCount) buffer = new byte[byteCount];
+ ReadFully(input, buffer, 0, byteCount);
+ return System.Text.Encoding.UTF8.GetString(buffer, 0, byteCount);
}
- private static void ReadFully (Stream input, byte[] b, int off, int len) {
- while (len > 0) {
- int count = input.Read(b, off, len);
- if (count <= 0) {
- throw new EndOfStreamException();
- }
- off += count;
- len -= count;
+ private static void ReadFully (Stream input, byte[] buffer, int offset, int length) {
+ while (length > 0) {
+ int count = input.Read(buffer, offset, length);
+ if (count <= 0) throw new EndOfStreamException();
+ offset += count;
+ length -= count;
}
}
}
diff --git a/spine-csharp/src/SkeletonJson.cs b/spine-csharp/src/SkeletonJson.cs
index 8c22b8d6e..84691e890 100644
--- a/spine-csharp/src/SkeletonJson.cs
+++ b/spine-csharp/src/SkeletonJson.cs
@@ -44,8 +44,9 @@ using Windows.Storage;
namespace Spine {
public class SkeletonJson {
- private AttachmentLoader attachmentLoader;
public float Scale { get; set; }
+
+ private AttachmentLoader attachmentLoader;
private List linkedMeshes = new List();
public SkeletonJson (params Atlas[] atlasArray)
@@ -365,12 +366,11 @@ namespace Spine {
for (int i = 0, n = vertices.Length; i < n;) {
int boneCount = (int)vertices[i++];
bones.Add(boneCount);
- for (int nn = i + boneCount * 4; i < nn;) {
+ for (int nn = i + boneCount * 4; i < nn; i += 4) {
bones.Add((int)vertices[i]);
weights.Add(vertices[i + 1] * scale);
weights.Add(vertices[i + 2] * scale);
weights.Add(vertices[i + 3]);
- i += 4;
}
}
mesh.bones = bones.ToArray();
@@ -576,7 +576,7 @@ namespace Spine {
int slotIndex = skeletonData.FindSlotIndex(slotMap.Key);
foreach (KeyValuePair meshMap in (Dictionary)slotMap.Value) {
var values = (List