예제 #1
0
        /// <summary>
        /// 执行
        /// </summary>
        /// <returns></returns>
        private IEnumerator <float> Run()
        {
            if (isDone)
            {
                yield break;
            }

            var tasks = new ReCoroutine[taskDict.Count];

            for (int i = 0; i < taskDict.Count; i++)
            {
                tasks[i] = taskDict.GetValueAt(i).GetCoroutine();
            }
            ///同时执行所有的任务
            yield return(ReCoroutine.WaitForAllCoroutines(tasks));

            if (this.actionType == TaskActionType.Sync)
            {
                //同步按顺序执行
                for (int i = 0; i < syncActionList.Count; i++)
                {
                    syncActionList[i]();
                }
            }
            else
            {
                //异步按顺序执行
                for (int i = 0; i < asynActionList.Count; i++)
                {
                    yield return(ReCoroutine.Wait(asynActionList[i]));
                }
            }

            isDone = true;
        }
예제 #2
0
        /// <summary>
        /// 执行
        /// </summary>
        private IEnumerator <float> Run()
        {
            var tasks = new ReCoroutine[taskDict.Count];

            for (int i = 0; i < taskDict.Count; i++)
            {
                //按顺序执行
                yield return(ReCoroutine.Wait(taskDict.GetValueAt(i).GetCoroutine()));
            }
        }