Пример #1
0
        /// <summary>
        /// 添加一个新任务
        /// </summary>
        public ReCoroutineTask AddTask(IEnumerator <float> ienumer,
                                       Action <bool> call_back = null, object bind_object = null, bool auto_start = true)
        {
            ReCoroutineTask task = new ReCoroutineTask(ienumer, call_back, bind_object, auto_start);

            AddTask(task);
            return(task);
        }
Пример #2
0
        /// <summary>
        /// 当满足条件循环动作
        /// </summary>
        public ReCoroutineTask LoopTodoByWhile(Action call_back, float interval, Func <bool> predicates,
                                               object bind_object = null, float start_time = 0)
        {
            ReCoroutineTask task = new ReCoroutineTask(
                DoLoopByWhile(interval, predicates, call_back, start_time), null, bind_object);

            AddTask(task);
            return(task);
        }
Пример #3
0
        /// <summary>
        /// 间隔时间进行多次动作
        /// </summary>
        public ReCoroutineTask LoopTodoByTime(Action call_back, float interval,
                                              int loop_time, object bind_object = null, float start_time = 0)
        {
            ReCoroutineTask task = new ReCoroutineTask(
                DoLoopByTime(interval, loop_time, call_back, start_time), null, bind_object);

            AddTask(task);
            return(task);
        }
Пример #4
0
        /// <summary>
        /// 每帧进行循环
        /// </summary>
        public ReCoroutineTask LoopByEveryFrame(Action call_back, int loop_time = -1
                                                , object bind_object            = null, float start_time = 0)
        {
            ReCoroutineTask task = new ReCoroutineTask(
                DoLoopByEveryFrame(loop_time, call_back, start_time), null, bind_object);

            AddTask(task);
            return(task);
        }
Пример #5
0
        /// <summary>
        /// 等待一段时间再执行时间
        /// </summary>
        public ReCoroutineTask WaitSecondTodo(Action <bool> call_back, float time, object bind_object = null)
        {
            ReCoroutineTask task = new ReCoroutineTask(
                DoWaitTodo(time),
                call_back, bind_object);

            AddTask(task);
            return(task);
        }
Пример #6
0
        public void Restart(string task_name)
        {
            if (!task_list.ContainsKey(task_name))
            {
                LogManager.Error("重新开始任务", "不存在该任务" + task_name);
                return;
            }
            ReCoroutineTask task = task_list[task_name];

            Stop(task_name);
            AddTask(task);
        }
Пример #7
0
 /// <summary>
 /// 添加一个新任务
 /// </summary>
 public ReCoroutineTask AddTask(ReCoroutineTask task)
 {
     if (task_list.ContainsKey(task.Name))
     {
         //Debug.logger.LogError("添加新任务", "任务重名!" + task.name);
         Restart(task.Name);
     }
     else
     {
         task_list.Add(task.Name, task);
     }
     return(task);
 }
Пример #8
0
 /// <summary>
 /// 添加一个新任务
 /// </summary>
 public ReCoroutineTask AddTask(string task_name, IEnumerator <float> ienumer,
                                Action <bool> call_back = null, object bind_object = null, bool auto_start = true)
 {
     if (task_list.ContainsKey(task_name))
     {
         //Debug.logger.LogError("添加新任务", "任务重名!" + taskName);
         Restart(task_name);
         return(task_list[task_name]);
     }
     else
     {
         ReCoroutineTask task = new ReCoroutineTask(task_name, ienumer, call_back, bind_object, auto_start);
         task_list.Add(task_name, task);
         return(task);
     }
 }
Пример #9
0
        /// <summary>
        /// 当条件成立时等待
        /// </summary>
        public ReCoroutineTask WaitWhileTodo(Action call_back, Func <bool> predicates,
                                             object bind_object = null)
        {
            Action <bool> call_back2 = (bo) =>
            {
                if (bo)
                {
                    call_back();
                }
            };
            ReCoroutineTask task = new ReCoroutineTask(
                DoWaitWhile(predicates), call_back2, bind_object);

            AddTask(task);
            return(task);
        }
Пример #10
0
        /// <summary>
        /// 等待所有其他携程任务完成
        /// </summary>
        public ReCoroutineTask WaitForAllCoroutine(Action call_back, ReCoroutineTask[] tasks,
                                                   object bind_object = null)
        {
            // ReSharper disable once RedundantLambdaSignatureParentheses
            Action <bool> call_back2 = (bo) =>
            {
                if (bo)
                {
                    call_back();
                }
            };
            ReCoroutineTask task = new ReCoroutineTask(
                DoWaitForAllCoroutine(tasks), call_back2, bind_object);

            AddTask(task);
            return(task);
        }
Пример #11
0
        /// <summary>
        /// 等待一段时间再执行时间
        /// </summary>
        public ReCoroutineTask WaitSecondTodo(Action call_back, float time, object bind_object = null)
        {
            // ReSharper disable once RedundantLambdaSignatureParentheses
            Action <bool> call_back2 = (bo) =>
            {
                if (bo)
                {
                    call_back();
                }
            };
            ReCoroutineTask task = new ReCoroutineTask(
                DoWaitTodo(time),
                call_back2, bind_object);

            AddTask(task);
            return(task);
        }