mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-04 14:24:53 +08:00
Minor cleanup.
This commit is contained in:
parent
2df28f8564
commit
98bf05c305
@ -76,10 +76,10 @@ namespace Spine {
|
||||
|
||||
TrackEntry next = current.next;
|
||||
if (next != null && time >= next.delay) {
|
||||
if (next.animation == null)
|
||||
Clear(i);
|
||||
else
|
||||
if (next.animation != null)
|
||||
SetCurrent(i, next);
|
||||
else
|
||||
Clear(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -204,7 +204,7 @@ namespace Spine {
|
||||
if (delay <= 0) {
|
||||
if (last != null) {
|
||||
delay += last.endTime;
|
||||
if (animation != null) delay += -data.GetMix(last.animation, animation);
|
||||
if (animation != null) delay -= data.GetMix(last.animation, animation);
|
||||
} else
|
||||
delay = 0;
|
||||
}
|
||||
@ -214,7 +214,7 @@ namespace Spine {
|
||||
}
|
||||
|
||||
/** @return May be null. */
|
||||
public TrackEntry getTrackEntry (int trackIndex) {
|
||||
public TrackEntry getCurrent (int trackIndex) {
|
||||
if (trackIndex >= tracks.Count) return null;
|
||||
return tracks[trackIndex];
|
||||
}
|
||||
|
||||
@ -73,10 +73,10 @@ public class AnimationState {
|
||||
|
||||
TrackEntry next = current.next;
|
||||
if (next != null && time >= next.delay) {
|
||||
if (next.animation == null)
|
||||
clear(i);
|
||||
else
|
||||
if (next.animation != null)
|
||||
setCurrent(i, next);
|
||||
else
|
||||
clear(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -227,7 +227,7 @@ public class AnimationState {
|
||||
if (delay <= 0) {
|
||||
if (last != null) {
|
||||
delay += last.endTime;
|
||||
if (animation != null) delay += -data.getMix(last.animation, animation);
|
||||
if (animation != null) delay -= data.getMix(last.animation, animation);
|
||||
} else
|
||||
delay = 0;
|
||||
}
|
||||
@ -237,7 +237,7 @@ public class AnimationState {
|
||||
}
|
||||
|
||||
/** @return May be null. */
|
||||
public TrackEntry getTrackEntry (int trackIndex) {
|
||||
public TrackEntry getCurrent (int trackIndex) {
|
||||
if (trackIndex >= tracks.size) return null;
|
||||
return tracks.get(trackIndex);
|
||||
}
|
||||
|
||||
@ -70,19 +70,19 @@ public class AnimationStateTest extends ApplicationAdapter {
|
||||
state = new AnimationState(stateData);
|
||||
state.addListener(new AnimationStateListener() {
|
||||
public void event (int trackIndex, Event event) {
|
||||
System.out.println(trackIndex + " event: " + state.getTrackEntry(trackIndex) + ", " + event.getData().getName());
|
||||
System.out.println(trackIndex + " event: " + state.getCurrent(trackIndex) + ", " + event.getData().getName());
|
||||
}
|
||||
|
||||
public void complete (int trackIndex, int loopCount) {
|
||||
System.out.println(trackIndex + " complete: " + state.getTrackEntry(trackIndex) + ", " + loopCount);
|
||||
System.out.println(trackIndex + " complete: " + state.getCurrent(trackIndex) + ", " + loopCount);
|
||||
}
|
||||
|
||||
public void start (int trackIndex) {
|
||||
System.out.println(trackIndex + " start: " + state.getTrackEntry(trackIndex));
|
||||
System.out.println(trackIndex + " start: " + state.getCurrent(trackIndex));
|
||||
}
|
||||
|
||||
public void end (int trackIndex) {
|
||||
System.out.println(trackIndex + " end: " + state.getTrackEntry(trackIndex));
|
||||
System.out.println(trackIndex + " end: " + state.getCurrent(trackIndex));
|
||||
}
|
||||
});
|
||||
state.setAnimation(0, "walk", true);
|
||||
|
||||
@ -150,19 +150,19 @@ namespace Spine {
|
||||
}
|
||||
|
||||
public void Start (object sender, StartEndArgs e) {
|
||||
Console.WriteLine(e.TrackIndex + " " + state.getTrackEntry(e.TrackIndex) + ": start");
|
||||
Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": start");
|
||||
}
|
||||
|
||||
public void End (object sender, StartEndArgs e) {
|
||||
Console.WriteLine(e.TrackIndex + " " + state.getTrackEntry(e.TrackIndex) + ": end");
|
||||
Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": end");
|
||||
}
|
||||
|
||||
public void Complete (object sender, CompleteArgs e) {
|
||||
Console.WriteLine(e.TrackIndex + " " + state.getTrackEntry(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.getTrackEntry(e.TrackIndex) + ": event " + e.Event);
|
||||
Console.WriteLine(e.TrackIndex + " " + state.getCurrent(e.TrackIndex) + ": event " + e.Event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user