Example #1
0
 /// <summary>
 /// 等待知道
 /// </summary>
 public static float WaitUntil(Func <bool> condition)
 {
     // E_CoroutineType.update
     lock (lock_object)
         ReplaceCoroutine = ReCoroutineManager.AddCoroutine(GetReplaceCoroutine(condition));
     return(float.NaN);
 }
Example #2
0
        private void CommonUpdate()
        {
            CurrentTime += ReCoroutineManager.GetDeltaTime(this);

            // 1.是否处于等待
            if (!IsWaiting())
            {
                // 2.判断是否结束
                if (!Ie.MoveNext())
                {
                    IsDone = true;
                }
                // 3.更新等待时间
                _update_wait_time(Ie.Current);

                if (Ie.Current.Equals(float.NaN))
                {
                    WaitingCoroutine = ReplaceCoroutine;
                }
            }
            else
            {
                if (WaitingCoroutine != null && WaitingCoroutine.IsDone)
                {
                    WaitingCoroutine = null;
                }
            }
        }
Example #3
0
 /// <summary>
 /// 等待异步操作
 /// </summary>
 public static float WaitAsynOperation(AsyncOperation operation)
 {
     lock (lock_object)
     {
         // E_CoroutineType.update
         ReplaceCoroutine = ReCoroutineManager.AddCoroutine(GetReplaceCoroutine(() => operation.isDone));
     }
     return(float.NaN);
 }
Example #4
0
 /// <summary>
 /// 等待www返回
 /// </summary>
 public static float WaitWww(WWW www)
 {
     lock (lock_object)
     {
         //  E_CoroutineType.update
         ReplaceCoroutine = ReCoroutineManager.AddCoroutine(GetReplaceCoroutine(() => www.isDone));
     }
     return(float.NaN);
 }
Example #5
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         LogManager.Error("ReCoroutineManager Instance Error");
     }
     UpdateDeltaTime      = Time.deltaTime;
     LateUpdateDeltaTime  = Time.deltaTime;
     FixedUpdateDeltaTime = Time.fixedDeltaTime;
 }
Example #6
0
 /// <summary>
 /// 等待所有其他携程
 /// </summary>
 public static float WaitForAllCoroutines(params ReCoroutine[] coroutines)
 {
     // E_CoroutineType.update
     lock (lock_object)
         ReplaceCoroutine = ReCoroutineManager.AddCoroutine(
             GetReplaceCoroutine(() =>
         {
             int length = coroutines.Length;
             for (int i = 0; i < length; i++)
             {
                 if (!coroutines[i].IsDone)
                 {
                     return(false);
                 }
             }
             return(true);
         }));
     return(float.NaN);
 }
Example #7
0
 /// <summary>
 /// 等待其他协程
 /// </summary>
 public static float Wait(IEnumerator <float> e)
 {
     lock (lock_object)
         ReplaceCoroutine = ReCoroutineManager.AddCoroutine(e);
     return(float.NaN);
 }
Example #8
0
 public void Start()
 {
     Running    = true;
     IsFinished = false;
     ReCoroutineManager.AddCoroutine(_do_task());
 }