public static void StopCoroutine(LiteCoroutine handle)
 {
     if (handle == null)
     {
         return;
     }
     handle.Stop();
 }
예제 #2
0
        public LiteCoroutine StartCoroutine(ref LiteCoroutine handle, IEnumerator routine, bool runImmediate = true)
        {
            if (handle == null || handle.OwnerManager != this)
            {
                handle = CreateHandle();
            }

            handle.RestartCoroutine(routine, runImmediate);
            return(handle);
        }
        public static LiteCoroutine StartCoroutine(ref LiteCoroutine handle, IEnumerator routine, bool runImmediate, bool wakeSystem)
        {
            if (!Initialize())
            {
                return(null);
            }

            defaultManager.StartCoroutine(ref handle, routine, runImmediate);

            if (!handle.IsDone && wakeSystem)
            {
                WakeUp();
            }

            return(handle);
        }
예제 #4
0
        public void Release(LiteTask task)
        {
            lock (pool)
            {
                if (task != null && set.Add(task))
                {
                    task.Cancel();

                    if (task.IsDone)
                    {
                        task.RestartTask(null, true);
                        pool.Push(task);
                    }
                    else
                    {
                        if (runningTasks == null)
                        {
                            runningTasks = new List <LiteTask>()
                            {
                                task
                            };
                            removeFinishedTask = RemoveFinishedTask;
                        }
                        else
                        {
                            runningTasks.Add(task);
                        }

                        if (waitRoutine.IsNullOrDone())
                        {
                            LiteCoroutine.StartCoroutine(ref waitRoutine, WaitForTasks());
                        }
                    }
                }
            }
        }
 public static bool IsNullOrDone(this LiteCoroutine handle)
 {
     return(handle == null || handle.IsDone);
 }
 public static LiteCoroutine StartCoroutine(ref LiteCoroutine handle, IEnumerator routine, bool runImmediate)
 {
     return(StartCoroutine(ref handle, routine, runImmediate, true));
 }
 public static LiteCoroutine StartCoroutine(ref LiteCoroutine handle, IEnumerator routine)
 {
     return(StartCoroutine(ref handle, routine, true, true));
 }