فهرست منبع

[csharp] Port of commit 88b009c: AnimationState, improved triggering complete event.

Harald Csaszar 1 سال پیش
والد
کامیت
d4242a8257
1فایلهای تغییر یافته به همراه8 افزوده شده و 3 حذف شده
  1. 8 3
      spine-csharp/src/AnimationState.cs

+ 8 - 3
spine-csharp/src/AnimationState.cs

@@ -595,9 +595,14 @@ namespace Spine {
 
 			// Queue complete if completed a loop iteration or the animation.
 			bool complete = false;
-			if (entry.loop)
-				complete = duration == 0 || (trackLastWrapped > entry.trackTime % duration);
-			else
+			if (entry.loop) {
+				if (duration == 0)
+					complete = true;
+				else {
+					int cycles = (int)(entry.trackTime / duration);
+					complete = cycles > 0 && cycles > (int)(entry.trackLast / duration);
+				}
+			} else
 				complete = animationTime >= animationEnd && entry.animationLast < animationEnd;
 			if (complete) queue.Complete(entry);