v0.6.1b: fixed a rare ANR caused by motion interruption
This commit is contained in:
parent
ff28b2314a
commit
68e0916cf5
|
@ -44,6 +44,11 @@ abstract public class Tweener extends Gizmo {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void update() {
|
public void update() {
|
||||||
|
if (elapsed < 0){
|
||||||
|
onComplete();
|
||||||
|
kill();
|
||||||
|
return;
|
||||||
|
}
|
||||||
elapsed += Game.elapsed;
|
elapsed += Game.elapsed;
|
||||||
if (elapsed >= interval) {
|
if (elapsed >= interval) {
|
||||||
updateValues( 1 );
|
updateValues( 1 );
|
||||||
|
@ -54,6 +59,10 @@ abstract public class Tweener extends Gizmo {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stop( boolean complete ){
|
||||||
|
elapsed = complete ? interval : -1;
|
||||||
|
}
|
||||||
|
|
||||||
protected void onComplete() {
|
protected void onComplete() {
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onComplete( this );
|
listener.onComplete( this );
|
||||||
|
|
|
@ -185,7 +185,7 @@ public class CharSprite extends MovieClip implements Tweener.Listener, MovieClip
|
||||||
|
|
||||||
public void interruptMotion() {
|
public void interruptMotion() {
|
||||||
if (motion != null) {
|
if (motion != null) {
|
||||||
onComplete( motion );
|
motion.stop(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user