mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
0d284dfc1a
Binary file not shown.
@ -89,7 +89,7 @@ public class AnimationState {
|
||||
next.delay = 0;
|
||||
next.trackTime = nextTime + delta * next.timeScale;
|
||||
current.trackTime += currentDelta;
|
||||
setCurrent(i, next);
|
||||
setCurrent(i, next, true);
|
||||
while (next.mixingFrom != null) {
|
||||
next.mixTime += currentDelta;
|
||||
next = next.mixingFrom;
|
||||
@ -355,12 +355,12 @@ public class AnimationState {
|
||||
}
|
||||
|
||||
|
||||
private function setCurrent (index:int, current:TrackEntry):void {
|
||||
private function setCurrent (index:int, current:TrackEntry, interrupt:Boolean):void {
|
||||
var from:TrackEntry = expandToIndex(index);
|
||||
tracks[index] = current;
|
||||
|
||||
if (from != null) {
|
||||
queue.interrupt(from);
|
||||
if (interrupt) queue.interrupt(from);
|
||||
current.mixingFrom = from;
|
||||
current.mixTime = 0;
|
||||
|
||||
@ -381,6 +381,7 @@ public class AnimationState {
|
||||
|
||||
public function setAnimation (trackIndex:int, animation:Animation, loop:Boolean):TrackEntry {
|
||||
if (animation == null) throw new ArgumentError("animation cannot be null.");
|
||||
var interrupt:Boolean = true;
|
||||
var current:TrackEntry = expandToIndex(trackIndex);
|
||||
if (current != null) {
|
||||
if (current.nextTrackLast == -1) {
|
||||
@ -390,11 +391,12 @@ public class AnimationState {
|
||||
queue.end(current);
|
||||
disposeNext(current);
|
||||
current = current.mixingFrom;
|
||||
interrupt = false;
|
||||
} else
|
||||
disposeNext(current);
|
||||
}
|
||||
var entry:TrackEntry = trackEntry(trackIndex, animation, loop, current);
|
||||
setCurrent(trackIndex, entry);
|
||||
setCurrent(trackIndex, entry, interrupt);
|
||||
queue.drain();
|
||||
return entry;
|
||||
}
|
||||
@ -417,7 +419,7 @@ public class AnimationState {
|
||||
var entry:TrackEntry = trackEntry(trackIndex, animation, loop, last);
|
||||
|
||||
if (last == null) {
|
||||
setCurrent(trackIndex, entry);
|
||||
setCurrent(trackIndex, entry, true);
|
||||
queue.drain();
|
||||
} else {
|
||||
last.next = entry;
|
||||
|
||||
@ -240,7 +240,7 @@ function AnimationState:update (delta)
|
||||
_next.delay = 0
|
||||
_next.trackTime = nextTime + delta * _next.timeScale
|
||||
current.trackTime = current.trackTime + currentDelta
|
||||
self:setCurrent(i, _next)
|
||||
self:setCurrent(i, _next, true)
|
||||
while _next.mixingFrom do
|
||||
_next.mixTime = _next.mixTime + currentDelta
|
||||
_next = _next.mixingFrom
|
||||
@ -530,14 +530,14 @@ function AnimationState:clearTrack (trackIndex)
|
||||
queue:drain()
|
||||
end
|
||||
|
||||
function AnimationState:setCurrent (index, current)
|
||||
function AnimationState:setCurrent (index, current, interrupt)
|
||||
local from = self:expandToIndex(index)
|
||||
local tracks = self.tracks
|
||||
local queue = self.queue
|
||||
tracks[index] = current
|
||||
|
||||
if from then
|
||||
queue:interrupt(from)
|
||||
if interrupt then queue:interrupt(from) end
|
||||
current.mixingFrom = from
|
||||
current.mixTime = 0
|
||||
|
||||
@ -556,6 +556,7 @@ end
|
||||
|
||||
function AnimationState:setAnimation (trackIndex, animation, loop)
|
||||
if not animation then error("animation cannot be null.") end
|
||||
local interrupt = true;
|
||||
local current = self:expandToIndex(trackIndex)
|
||||
local queue = self.queue
|
||||
if current then
|
||||
@ -566,12 +567,13 @@ function AnimationState:setAnimation (trackIndex, animation, loop)
|
||||
queue:_end(current)
|
||||
self:disposeNext(current)
|
||||
current = current.mixingFrom
|
||||
interrupt = false;
|
||||
else
|
||||
self:disposeNext(current)
|
||||
end
|
||||
end
|
||||
local entry = self:trackEntry(trackIndex, animation, loop, current)
|
||||
self:setCurrent(trackIndex, entry)
|
||||
self:setCurrent(trackIndex, entry, interrupt)
|
||||
queue:drain()
|
||||
return entry
|
||||
end
|
||||
@ -597,7 +599,7 @@ function AnimationState:addAnimation (trackIndex, animation, loop, delay)
|
||||
local data = self.data
|
||||
|
||||
if not last then
|
||||
self:setCurrent(trackIndex, entry)
|
||||
self:setCurrent(trackIndex, entry, true)
|
||||
queue:drain()
|
||||
else
|
||||
last.next = entry
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user