예제 #1
0
 /// <summary>
 /// 线程。注意大部分Unity函数不能使用! 借用协程配合~
 /// </summary>
 /// <param name="threadCalAction"></param>
 /// <returns></returns>
 public CAsync Thread(AsyncThreadDelegate threadCalAction)
 {
     return(Coroutine(_Thread((thread, next) =>
     {
         threadCalAction(next);
     })));
 }
예제 #2
0
    public IEnumerator _Thread(AsyncThreadDelegate threadCalAction)
    {
        bool waitThreadFinish = false;
        var  thread           = new Thread(() =>
        {
            Action customNext = () =>
            {
                waitThreadFinish = true;
            };
            threadCalAction(customNext);
        });

        thread.Start();

        while (!waitThreadFinish)
        {
            yield return(null);
        }
    }
예제 #3
0
 public void SetMethod(AsyncThreadDelegate dlgt)
 {
     _dlgt = dlgt;
 }
예제 #4
0
 public AsyncThread(AsyncThreadDelegate dlgt)
 {
     _queue = new Queue <object>();
 }
예제 #5
0
    public IEnumerator _Thread(AsyncThreadDelegate threadCalAction)
    {
        bool waitThreadFinish = false;
        var thread = new Thread(() =>
        {
            Action customNext = () =>
            {
                waitThreadFinish = true;
            };
            threadCalAction(customNext);

        });
        thread.Start();

        while (!waitThreadFinish)
            yield return null;
    }
예제 #6
0
 /// <summary>
 /// 线程。注意大部分Unity函数不能使用! 借用协程配合~
 /// </summary>
 /// <param name="threadCalAction"></param>
 /// <returns></returns>
 public CAsync Thread(AsyncThreadDelegate threadCalAction)
 {
     return Coroutine(_Thread(threadCalAction));
 }
예제 #7
0
 /// <summary>
 /// 线程。注意大部分Unity函数不能使用! 借用协程配合~
 /// </summary>
 /// <param name="threadCalAction"></param>
 /// <returns></returns>
 public CAsync Thread(AsyncThreadDelegate threadCalAction)
 {
     return(Coroutine(_Thread(threadCalAction)));
 }
예제 #8
0
 /// <summary>
 /// 线程。注意大部分Unity函数不能使用! 借用协程配合~
 /// </summary>
 /// <param name="threadCalAction"></param>
 /// <returns></returns>
 public CAsync Thread(AsyncThreadDelegate threadCalAction)
 {
     return Coroutine(_Thread((thread, next) =>
     {
         threadCalAction(next);
     }));
 }