diff --git a/spine-csharp/src/AnimationState.cs b/spine-csharp/src/AnimationState.cs index eea852b7b..14cc61135 100644 --- a/spine-csharp/src/AnimationState.cs +++ b/spine-csharp/src/AnimationState.cs @@ -214,7 +214,7 @@ namespace Spine { } /** @return May be null. */ - public TrackEntry getCurrent (int trackIndex) { + public TrackEntry GetCurrent (int trackIndex) { if (trackIndex >= tracks.Count) return null; return tracks[trackIndex]; } diff --git a/spine-tk2d/Assets/Spine/Editor/SkeletonDataAssetInspector.cs b/spine-tk2d/Assets/Spine/Editor/SkeletonDataAssetInspector.cs index 4e9d48093..bb847a700 100644 --- a/spine-tk2d/Assets/Spine/Editor/SkeletonDataAssetInspector.cs +++ b/spine-tk2d/Assets/Spine/Editor/SkeletonDataAssetInspector.cs @@ -30,7 +30,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ - using System; using UnityEditor; using UnityEngine; @@ -101,7 +100,7 @@ public class SkeletonDataAssetInspector : Editor { if (!Application.isPlaying) { if (serializedObject.ApplyModifiedProperties() || - (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "UndoRedoPerformed") + (UnityEngine.Event.current.type == EventType.ValidateCommand && UnityEngine.Event.current.commandName == "UndoRedoPerformed") ) { asset.Clear(); } diff --git a/spine-tk2d/Assets/Spine/SkeletonAnimation.cs b/spine-tk2d/Assets/Spine/SkeletonAnimation.cs index 846eab38a..54b5d0e48 100644 --- a/spine-tk2d/Assets/Spine/SkeletonAnimation.cs +++ b/spine-tk2d/Assets/Spine/SkeletonAnimation.cs @@ -30,7 +30,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ - using System; using System.IO; using System.Collections.Generic; @@ -54,15 +53,16 @@ public class SkeletonAnimation : SkeletonComponent { override public void UpdateSkeleton () { if (useAnimationName) { // Keep AnimationState in sync with animationName and loop fields. + TrackEntry entry = state.GetCurrent(0); if (animationName == null || animationName.Length == 0) { - if (state.Animation != null) - state.ClearAnimation(); - } else if (state.Animation == null || animationName != state.Animation.Name) { + if (entry != null && entry.Animation != null) + state.Clear(0); + } else if (entry == null || entry.Animation == null || animationName != entry.Animation.Name) { Spine.Animation animation = skeleton.Data.FindAnimation(animationName); if (animation != null) - state.SetAnimation(animation, loop); - } - state.Loop = loop; + state.SetAnimation(0, animation, loop); + } else if (entry != null) + entry.Loop = loop; } // Apply the animation. diff --git a/spine-tk2d/Assets/Spine/SkeletonComponent.cs b/spine-tk2d/Assets/Spine/SkeletonComponent.cs index a71ef32c0..b4e3a7338 100644 --- a/spine-tk2d/Assets/Spine/SkeletonComponent.cs +++ b/spine-tk2d/Assets/Spine/SkeletonComponent.cs @@ -164,7 +164,7 @@ public class SkeletonComponent : MonoBehaviour { if (regionAttachment == null) continue; - regionAttachment.ComputeVertices(skeleton.X, skeleton.Y, slot.Bone, vertexPositions); + regionAttachment.ComputeWorldVertices(skeleton.X, skeleton.Y, slot.Bone, vertexPositions); vertices[vertexIndex] = new Vector3(vertexPositions[RegionAttachment.X1], vertexPositions[RegionAttachment.Y1], 0); vertices[vertexIndex + 1] = new Vector3(vertexPositions[RegionAttachment.X4], vertexPositions[RegionAttachment.Y4], 0); diff --git a/spine-tk2d/Assets/examples/spineboy/Spineboy.cs b/spine-tk2d/Assets/examples/spineboy/Spineboy.cs index 0dc66aaba..14168e2c7 100644 --- a/spine-tk2d/Assets/examples/spineboy/Spineboy.cs +++ b/spine-tk2d/Assets/examples/spineboy/Spineboy.cs @@ -33,6 +33,7 @@ using UnityEngine; using System.Collections; +using Spine; public class Spineboy : MonoBehaviour { private SkeletonAnimation skeleton; @@ -44,7 +45,8 @@ public class Spineboy : MonoBehaviour { void LateUpdate() { if (skeleton.loop) return; - if (skeleton.state.Animation != null && skeleton.state.Time >= skeleton.state.Animation.Duration - 0.25) { + TrackEntry entry = skeleton.state.GetCurrent(0); + if (entry != null && entry.Time >= entry.Animation.Duration - 0.25) { skeleton.animationName = "walk"; skeleton.loop = true; } diff --git a/spine-unity/Assets/Spine/Editor/SkeletonDataAssetInspector.cs b/spine-unity/Assets/Spine/Editor/SkeletonDataAssetInspector.cs index 184761b21..7f0013a07 100644 --- a/spine-unity/Assets/Spine/Editor/SkeletonDataAssetInspector.cs +++ b/spine-unity/Assets/Spine/Editor/SkeletonDataAssetInspector.cs @@ -30,7 +30,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ - using System; using UnityEditor; using UnityEngine; @@ -97,7 +96,7 @@ public class SkeletonDataAssetInspector : Editor { if (!Application.isPlaying) { if (serializedObject.ApplyModifiedProperties() || - (Event.current.type == EventType.ValidateCommand && Event.current.commandName == "UndoRedoPerformed") + (UnityEngine.Event.current.type == EventType.ValidateCommand && UnityEngine.Event.current.commandName == "UndoRedoPerformed") ) { asset.Clear(); } diff --git a/spine-unity/Assets/Spine/SkeletonAnimation.cs b/spine-unity/Assets/Spine/SkeletonAnimation.cs index 3b2c59eeb..54b5d0e48 100644 --- a/spine-unity/Assets/Spine/SkeletonAnimation.cs +++ b/spine-unity/Assets/Spine/SkeletonAnimation.cs @@ -30,7 +30,6 @@ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *****************************************************************************/ - using System; using System.IO; using System.Collections.Generic; @@ -54,14 +53,16 @@ public class SkeletonAnimation : SkeletonComponent { override public void UpdateSkeleton () { if (useAnimationName) { // Keep AnimationState in sync with animationName and loop fields. + TrackEntry entry = state.GetCurrent(0); if (animationName == null || animationName.Length == 0) { - if (state.Animation != null) state.ClearAnimation(); - } else if (state.Animation == null || animationName != state.Animation.Name) { + if (entry != null && entry.Animation != null) + state.Clear(0); + } else if (entry == null || entry.Animation == null || animationName != entry.Animation.Name) { Spine.Animation animation = skeleton.Data.FindAnimation(animationName); if (animation != null) - state.SetAnimation(animation, loop); - } - state.Loop = loop; + state.SetAnimation(0, animation, loop); + } else if (entry != null) + entry.Loop = loop; } // Apply the animation. diff --git a/spine-unity/Assets/Spine/SkeletonComponent.cs b/spine-unity/Assets/Spine/SkeletonComponent.cs index f9f075f44..ecf3c41be 100644 --- a/spine-unity/Assets/Spine/SkeletonComponent.cs +++ b/spine-unity/Assets/Spine/SkeletonComponent.cs @@ -168,7 +168,7 @@ public class SkeletonComponent : MonoBehaviour { if (regionAttachment == null) continue; - regionAttachment.ComputeVertices(skeleton.X, skeleton.Y, slot.Bone, vertexPositions); + regionAttachment.ComputeWorldVertices(skeleton.X, skeleton.Y, slot.Bone, vertexPositions); vertices[vertexIndex] = new Vector3(vertexPositions[RegionAttachment.X1], vertexPositions[RegionAttachment.Y1], 0); vertices[vertexIndex + 1] = new Vector3(vertexPositions[RegionAttachment.X4], vertexPositions[RegionAttachment.Y4], 0); diff --git a/spine-unity/Assets/examples/spineboy/Spineboy.cs b/spine-unity/Assets/examples/spineboy/Spineboy.cs index 0ad719c25..f3a50d380 100644 --- a/spine-unity/Assets/examples/spineboy/Spineboy.cs +++ b/spine-unity/Assets/examples/spineboy/Spineboy.cs @@ -37,12 +37,12 @@ using System.Collections; public class Spineboy : MonoBehaviour { public void Start () { SkeletonAnimation skeletonAnimation = GetComponent(); - skeletonAnimation.state.SetAnimation("walk", true); + skeletonAnimation.state.SetAnimation(0, "walk", true); } public void OnMouseDown () { SkeletonAnimation skeletonAnimation = GetComponent(); - skeletonAnimation.state.SetAnimation("jump", false); - skeletonAnimation.state.AddAnimation("walk", true); + skeletonAnimation.state.SetAnimation(0, "jump", false); + skeletonAnimation.state.AddAnimation(0, "walk", true, 0); } } diff --git a/spine-unity/Assets/examples/spineboy/spineboy SkeletonData.asset b/spine-unity/Assets/examples/spineboy/spineboy SkeletonData.asset index e41e05273..1847ae216 100644 Binary files a/spine-unity/Assets/examples/spineboy/spineboy SkeletonData.asset and b/spine-unity/Assets/examples/spineboy/spineboy SkeletonData.asset differ diff --git a/spine-unity/Assets/examples/spineboy/spineboy.unity b/spine-unity/Assets/examples/spineboy/spineboy.unity index 572a6f9d7..6c6e8161c 100644 Binary files a/spine-unity/Assets/examples/spineboy/spineboy.unity and b/spine-unity/Assets/examples/spineboy/spineboy.unity differ diff --git a/spine-xna/example/src/ExampleGame.cs b/spine-xna/example/src/ExampleGame.cs index e5a6c97e1..c32889a67 100644 --- a/spine-xna/example/src/ExampleGame.cs +++ b/spine-xna/example/src/ExampleGame.cs @@ -150,19 +150,19 @@ namespace Spine { } public void Start (object sender, StartEndArgs e) { - Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": start"); + Console.WriteLine(e.TrackIndex + " " + state.GetCurrent(e.TrackIndex) + ": start"); } public void End (object sender, StartEndArgs e) { - Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": end"); + Console.WriteLine(e.TrackIndex + " " + state.GetCurrent(e.TrackIndex) + ": end"); } public void Complete (object sender, CompleteArgs e) { - Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": complete " + e.LoopCount); + Console.WriteLine(e.TrackIndex + " " + state.GetCurrent(e.TrackIndex) + ": complete " + e.LoopCount); } public void Event (object sender, EventTriggeredArgs e) { - Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": event " + e.Event); + Console.WriteLine(e.TrackIndex + " " + state.GetCurrent(e.TrackIndex) + ": event " + e.Event); } } }