44using UnityEngine ;
55using UnityScreenNavigator . Runtime . Core . Shared ;
66using UnityScreenNavigator . Runtime . Foundation ;
7- using UnityScreenNavigator . Runtime . Foundation . Coroutine ;
87#if USN_USE_ASYNC_METHODS
98using System . Threading . Tasks ;
109#endif
@@ -169,8 +168,9 @@ public void RemoveLifecycleEvent(IModalLifecycleEvent lifecycleEvent)
169168 _lifecycleEvents . RemoveItem ( lifecycleEvent ) ;
170169 }
171170
172- internal AsyncProcessHandle AfterLoad ( RectTransform parentTransform )
171+ internal AsyncStatus AfterLoad ( RectTransform parentTransform )
173172 {
173+ Debug . Log ( "//////" ) ;
174174 _rectTransform = ( RectTransform ) transform ;
175175 _canvasGroup = gameObject . GetOrAddComponent < CanvasGroup > ( ) ;
176176 _lifecycleEvents . AddItem ( this , 0 ) ;
@@ -180,12 +180,12 @@ internal AsyncProcessHandle AfterLoad(RectTransform parentTransform)
180180 _canvasGroup . alpha = 0.0f ;
181181
182182 var lifecycleEventTask = _lifecycleEvents . ExecuteLifecycleEventsSequentially ( x => x . Initialize ( ) ) ;
183- return CoroutineManager . Instance . Run ( CreateCoroutine ( lifecycleEventTask ) ) ;
183+ return CoroutineScheduler . Run ( CreateCoroutine ( lifecycleEventTask ) ) ;
184184 }
185185
186- internal AsyncProcessHandle BeforeEnter ( bool push , Modal partnerModal )
186+ internal AsyncStatus BeforeEnter ( bool push , Modal partnerModal )
187187 {
188- return CoroutineManager . Instance . Run ( BeforeEnterRoutine ( push , partnerModal ) ) ;
188+ return CoroutineScheduler . Run ( BeforeEnterRoutine ( push , partnerModal ) ) ;
189189 }
190190
191191 private IEnumerator BeforeEnterRoutine ( bool push , Modal partnerModal )
@@ -204,14 +204,14 @@ private IEnumerator BeforeEnterRoutine(bool push, Modal partnerModal)
204204 var lifecycleEventTask = push
205205 ? _lifecycleEvents . ExecuteLifecycleEventsSequentially ( x => x . WillPushEnter ( ) )
206206 : _lifecycleEvents . ExecuteLifecycleEventsSequentially ( x => x . WillPopEnter ( ) ) ;
207- var handle = CoroutineManager . Instance . Run ( CreateCoroutine ( lifecycleEventTask ) ) ;
208- while ( ! handle . IsTerminated )
207+ var handle = CoroutineScheduler . Run ( CreateCoroutine ( lifecycleEventTask ) ) ;
208+ while ( ! handle . IsCompleted )
209209 yield return null ;
210210 }
211211
212- internal AsyncProcessHandle Enter ( bool push , bool playAnimation , Modal partnerModal )
212+ internal AsyncStatus Enter ( bool push , bool playAnimation , Modal partnerModal )
213213 {
214- return CoroutineManager . Instance . Run ( EnterRoutine ( push , playAnimation , partnerModal ) ) ;
214+ return CoroutineScheduler . Run ( EnterRoutine ( push , playAnimation , partnerModal ) ) ;
215215 }
216216
217217 private IEnumerator EnterRoutine ( bool push , bool playAnimation , Modal partnerModal )
@@ -230,7 +230,7 @@ private IEnumerator EnterRoutine(bool push, bool playAnimation, Modal partnerMod
230230 {
231231 anim . SetPartner ( partnerModal ? . transform as RectTransform ) ;
232232 anim . Setup ( _rectTransform ) ;
233- yield return CoroutineManager . Instance . Run ( anim . CreatePlayRoutine ( TransitionProgressReporter ) ) ;
233+ yield return CoroutineScheduler . Run ( anim . CreatePlayRoutine ( TransitionProgressReporter ) ) ;
234234 }
235235 }
236236
@@ -251,9 +251,9 @@ internal void AfterEnter(bool push, Modal partnerModal)
251251 TransitionAnimationType = null ;
252252 }
253253
254- internal AsyncProcessHandle BeforeExit ( bool push , Modal partnerModal )
254+ internal AsyncStatus BeforeExit ( bool push , Modal partnerModal )
255255 {
256- return CoroutineManager . Instance . Run ( BeforeExitRoutine ( push , partnerModal ) ) ;
256+ return CoroutineScheduler . Run ( BeforeExitRoutine ( push , partnerModal ) ) ;
257257 }
258258
259259 private IEnumerator BeforeExitRoutine ( bool push , Modal partnerModal )
@@ -273,14 +273,14 @@ private IEnumerator BeforeExitRoutine(bool push, Modal partnerModal)
273273 ? _lifecycleEvents . ExecuteLifecycleEventsSequentially ( x => x . WillPushExit ( ) )
274274 : _lifecycleEvents . ExecuteLifecycleEventsSequentially ( x => x . WillPopExit ( ) ) ;
275275
276- var handle = CoroutineManager . Instance . Run ( CreateCoroutine ( routines ) ) ;
277- while ( ! handle . IsTerminated )
276+ var handle = CoroutineScheduler . Run ( CreateCoroutine ( routines ) ) ;
277+ while ( ! handle . IsCompleted )
278278 yield return null ;
279279 }
280280
281- internal AsyncProcessHandle Exit ( bool push , bool playAnimation , Modal partnerModal )
281+ internal AsyncStatus Exit ( bool push , bool playAnimation , Modal partnerModal )
282282 {
283- return CoroutineManager . Instance . Run ( ExitRoutine ( push , playAnimation , partnerModal ) ) ;
283+ return CoroutineScheduler . Run ( ExitRoutine ( push , playAnimation , partnerModal ) ) ;
284284 }
285285
286286 private IEnumerator ExitRoutine ( bool push , bool playAnimation , Modal partnerModal )
@@ -297,7 +297,7 @@ private IEnumerator ExitRoutine(bool push, bool playAnimation, Modal partnerModa
297297 {
298298 anim . SetPartner ( partnerModal ? . transform as RectTransform ) ;
299299 anim . Setup ( _rectTransform ) ;
300- yield return CoroutineManager . Instance . Run ( anim . CreatePlayRoutine ( TransitionProgressReporter ) ) ;
300+ yield return CoroutineScheduler . Run ( anim . CreatePlayRoutine ( TransitionProgressReporter ) ) ;
301301 }
302302 }
303303
@@ -323,10 +323,10 @@ internal void BeforeReleaseAndForget()
323323 var _ = _lifecycleEvents . ExecuteLifecycleEventsSequentially ( x => x . Cleanup ( ) ) ;
324324 }
325325
326- internal AsyncProcessHandle BeforeRelease ( )
326+ internal AsyncStatus BeforeRelease ( )
327327 {
328328 var lifecycleEventTask = _lifecycleEvents . ExecuteLifecycleEventsSequentially ( x => x . Cleanup ( ) ) ;
329- return CoroutineManager . Instance . Run ( CreateCoroutine ( lifecycleEventTask ) ) ;
329+ return CoroutineScheduler . Run ( CreateCoroutine ( lifecycleEventTask ) ) ;
330330 }
331331
332332#if USN_USE_ASYNC_METHODS
@@ -337,8 +337,8 @@ private IEnumerator CreateCoroutine(IEnumerable<IEnumerator> targets)
337337 {
338338 foreach ( var target in targets )
339339 {
340- var handle = CoroutineManager . Instance . Run ( CreateCoroutine ( target ) ) ;
341- if ( ! handle . IsTerminated )
340+ var handle = CoroutineScheduler . Run ( CreateCoroutine ( target ) ) ;
341+ if ( ! handle . IsCompleted )
342342 yield return handle ;
343343 }
344344 }
0 commit comments