Esempio n. 1
0
 /// <summary>
 /// 等待异步操作
 /// </summary>
 /// <param name="operation"></param>
 /// <returns></returns>
 public static float WaitAsynOperation(AsyncOperation operation)
 {
     lock (lockObject)
     {
         replaceCoroutine = ReCoroutineManager.AddCoroutine(GetReplaceCoroutine(() => operation.isDone), CoroutineType.Update);
     }
     return(float.NaN);
 }
Esempio n. 2
0
 /// <summary>
 /// 等待www返回
 /// </summary>
 /// <param name="www"></param>
 /// <returns></returns>
 public static float WaitWWW(WWW www)
 {
     lock (lockObject)
     {
         replaceCoroutine = ReCoroutineManager.AddCoroutine(GetReplaceCoroutine(() => www.isDone), CoroutineType.Update);
     }
     return(float.NaN);
 }
Esempio n. 3
0
        /// <summary>
        /// 等待线程操作
        /// </summary>
        /// <param name="act"></param>
        /// <returns></returns>
        public static float WaitThreadOperation(Action act)
        {
            Thread thread = new Thread(new ThreadStart(act));

            thread.Start();
            lock (lockObject)
                replaceCoroutine = ReCoroutineManager.AddCoroutine(GetReplaceCoroutine(() => !thread.IsAlive), CoroutineType.Update);
            return(float.NaN);
        }
Esempio n. 4
0
 /// <summary>
 /// 等待所有其他携程
 /// </summary>
 /// <param name="coroutines"></param>
 /// <returns></returns>
 public static float WaitForAllCoroutines(params ReCoroutine[] coroutines)
 {
     lock (lockObject)
         replaceCoroutine = ReCoroutineManager.AddCoroutine(
             GetReplaceCoroutine(() => {
             for (int i = 0; i < coroutines.Length; i++)
             {
                 if (!coroutines[i].isDone)
                 {
                     return(false);
                 }
             }
             return(true);
         }),
             CoroutineType.Update);
     return(float.NaN);
 }
Esempio n. 5
0
 /// <summary>
 /// 等待知道
 /// </summary>
 /// <param name="condition"></param>
 /// <returns></returns>
 public static float WaitUntil(Func <bool> condition)
 {
     lock (lockObject)
         replaceCoroutine = ReCoroutineManager.AddCoroutine(GetReplaceCoroutine(condition), CoroutineType.Update);
     return(float.NaN);
 }
Esempio n. 6
0
 /// <summary>
 /// 等待其他协程
 /// </summary>
 /// <param name="e"></param>
 /// <returns></returns>
 public static float Wait(IEnumerator <float> e)
 {
     lock (lockObject)
         replaceCoroutine = ReCoroutineManager.AddCoroutine(e);
     return(float.NaN);
 }
Esempio n. 7
0
 public void Start()
 {
     running    = true;
     isFinished = false;
     ReCoroutineManager.AddCoroutine(DoTask());
 }