File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ public class Transition : ITweenListener
5050 float _startTime ;
5151 float _endTime ;
5252 GTweenCallback _delayedCallDelegate ;
53+ GTweenCallback _checkAllDelegate ;
5354 GTweenCallback1 _delayedCallDelegate2 ;
5455
5556 const int OPTION_IGNORE_DISPLAY_CONTROLLER = 1 ;
@@ -64,6 +65,7 @@ public Transition(GComponent owner)
6465
6566 _delayedCallDelegate = OnDelayedPlay ;
6667 _delayedCallDelegate2 = OnDelayedPlayItem ;
68+ _checkAllDelegate = CheckAllComplete ;
6769 }
6870
6971 /// <summary>
@@ -779,7 +781,7 @@ void InternalPlay()
779781 _ownerBaseX = _owner . x ;
780782 _ownerBaseY = _owner . y ;
781783
782- _totalTasks = 0 ;
784+ _totalTasks = 1 ; //prevent to complete inside the loop
783785
784786 bool needSkipAnimations = false ;
785787 int cnt = _items . Length ;
@@ -814,6 +816,8 @@ void InternalPlay()
814816
815817 if ( needSkipAnimations )
816818 SkipAnimations ( ) ;
819+
820+ _totalTasks -- ;
817821 }
818822
819823 void PlayItem ( TransitionItem item )
@@ -1175,12 +1179,18 @@ void CheckAllComplete()
11751179 if ( _totalTimes < 0 )
11761180 {
11771181 InternalPlay ( ) ;
1182+ if ( _totalTasks == 0 )
1183+ GTween . DelayedCall ( 0 ) . SetTarget ( this ) . OnComplete ( _checkAllDelegate ) ;
11781184 }
11791185 else
11801186 {
11811187 _totalTimes -- ;
11821188 if ( _totalTimes > 0 )
1189+ {
11831190 InternalPlay ( ) ;
1191+ if ( _totalTasks == 0 )
1192+ GTween . DelayedCall ( 0 ) . SetTarget ( this ) . OnComplete ( _checkAllDelegate ) ;
1193+ }
11841194 else
11851195 {
11861196 _playing = false ;
You can’t perform that action at this time.
0 commit comments