mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-23 02:06:46 +08:00
parent
6a2b0f50de
commit
9eb18fa2eb
@ -101,7 +101,7 @@ public class AnimationState {
|
|||||||
next.delay = 0;
|
next.delay = 0;
|
||||||
next.trackTime = nextTime + delta * next.timeScale;
|
next.trackTime = nextTime + delta * next.timeScale;
|
||||||
current.trackTime += currentDelta;
|
current.trackTime += currentDelta;
|
||||||
setCurrent(i, next);
|
setCurrent(i, next, true);
|
||||||
while (next.mixingFrom != null) {
|
while (next.mixingFrom != null) {
|
||||||
next.mixTime += currentDelta;
|
next.mixTime += currentDelta;
|
||||||
next = next.mixingFrom;
|
next = next.mixingFrom;
|
||||||
@ -374,12 +374,12 @@ public class AnimationState {
|
|||||||
queue.drain();
|
queue.drain();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setCurrent (int index, TrackEntry current) {
|
private void setCurrent (int index, TrackEntry current, boolean interrupt) {
|
||||||
TrackEntry from = expandToIndex(index);
|
TrackEntry from = expandToIndex(index);
|
||||||
tracks.set(index, current);
|
tracks.set(index, current);
|
||||||
|
|
||||||
if (from != null) {
|
if (from != null) {
|
||||||
queue.interrupt(from);
|
if (interrupt) queue.interrupt(from);
|
||||||
current.mixingFrom = from;
|
current.mixingFrom = from;
|
||||||
current.mixTime = 0;
|
current.mixTime = 0;
|
||||||
|
|
||||||
@ -406,6 +406,7 @@ public class AnimationState {
|
|||||||
* after the {@link AnimationStateListener#dispose(TrackEntry)} event occurs. */
|
* after the {@link AnimationStateListener#dispose(TrackEntry)} event occurs. */
|
||||||
public TrackEntry setAnimation (int trackIndex, Animation animation, boolean loop) {
|
public TrackEntry setAnimation (int trackIndex, Animation animation, boolean loop) {
|
||||||
if (animation == null) throw new IllegalArgumentException("animation cannot be null.");
|
if (animation == null) throw new IllegalArgumentException("animation cannot be null.");
|
||||||
|
boolean interrupt = true;
|
||||||
TrackEntry current = expandToIndex(trackIndex);
|
TrackEntry current = expandToIndex(trackIndex);
|
||||||
if (current != null) {
|
if (current != null) {
|
||||||
if (current.nextTrackLast == -1) {
|
if (current.nextTrackLast == -1) {
|
||||||
@ -415,11 +416,12 @@ public class AnimationState {
|
|||||||
queue.end(current);
|
queue.end(current);
|
||||||
disposeNext(current);
|
disposeNext(current);
|
||||||
current = current.mixingFrom;
|
current = current.mixingFrom;
|
||||||
|
interrupt = false; // mixingFrom is current again, but don't interrupt it twice.
|
||||||
} else
|
} else
|
||||||
disposeNext(current);
|
disposeNext(current);
|
||||||
}
|
}
|
||||||
TrackEntry entry = trackEntry(trackIndex, animation, loop, current);
|
TrackEntry entry = trackEntry(trackIndex, animation, loop, current);
|
||||||
setCurrent(trackIndex, entry);
|
setCurrent(trackIndex, entry, interrupt);
|
||||||
queue.drain();
|
queue.drain();
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
@ -451,7 +453,7 @@ public class AnimationState {
|
|||||||
TrackEntry entry = trackEntry(trackIndex, animation, loop, last);
|
TrackEntry entry = trackEntry(trackIndex, animation, loop, last);
|
||||||
|
|
||||||
if (last == null) {
|
if (last == null) {
|
||||||
setCurrent(trackIndex, entry);
|
setCurrent(trackIndex, entry, true);
|
||||||
queue.drain();
|
queue.drain();
|
||||||
} else {
|
} else {
|
||||||
last.next = entry;
|
last.next = entry;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user