Beispiel #1
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;
                }
            }
        }
Beispiel #2
0
 /// <summary>
 /// 等待知道
 /// </summary>
 public static float WaitUntil(Func <bool> condition)
 {
     // E_CoroutineType.update
     lock (lock_object)
         ReplaceCoroutine = ReCoroutineManager.AddCoroutine(GetReplaceCoroutine(condition));
     return(float.NaN);
 }
Beispiel #3
0
 /// <summary>
 /// 获取执行携程
 /// </summary>
 public ReCoroutine GetCoroutine()
 {
     if (IsRunning)
     {
         return(ReCoroutineManager.AddCoroutine(WaitForFinish()));
     }
     return(ReCoroutineManager.AddCoroutine(Run()));
 }
Beispiel #4
0
 /// <summary>
 /// 开始执行流程
 /// </summary>
 public void Start()
 {
     //应用属性
     for (int i = 0; i < _propertys.Count; i++)
     {
         _propertys.GetValueAt(i).Apply(this);
     }
     ReCoroutineManager.AddCoroutine(Run());
 }
Beispiel #5
0
 /// <summary>
 /// 等待异步操作
 /// </summary>
 public static float WaitAsynOperation(AsyncOperation operation)
 {
     lock (lock_object)
     {
         // E_CoroutineType.update
         ReplaceCoroutine = ReCoroutineManager.AddCoroutine(GetReplaceCoroutine(() => operation.isDone));
     }
     return(float.NaN);
 }
Beispiel #6
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);
 }
Beispiel #7
0
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else
     {
         LogManager.Error("ReCoroutineManager Instance Error");
     }
     update_delta_time       = Time.deltaTime;
     late_update_delta_time  = Time.deltaTime;
     fixed_update_delta_time = Time.fixedDeltaTime;
 }
Beispiel #8
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);
 }
Beispiel #9
0
 public void Start()
 {
     Running    = true;
     IsFinished = false;
     ReCoroutineManager.AddCoroutine(_do_task());
 }
Beispiel #10
0
 /// <summary>
 /// 等待其他协程
 /// </summary>
 public static float Wait(IEnumerator <float> e)
 {
     lock (lock_object)
         ReplaceCoroutine = ReCoroutineManager.AddCoroutine(e);
     return(float.NaN);
 }