void OnTableThread(object state) { #if UNITY_EDITOR RTLog.LogFormat(LogCat.Table, "Begin Thread[{0}]", mThreadState.name); #endif try { while (mThreadState.isAlive) { ITableLoader loader = null; lock (mLock) { IsLoading = mLoaders.Count > 0; if (!IsLoading) { //mThread = null; mThreadState.isAlive = false; break; } loader = mLoaders.Dequeue(); mTaskQueue.Remove(loader.Identify); } if (mThreadState.isAlive) { MainThread.RunOnMainThread(loader.StartLoad); } while (mThreadState.isAlive && !loader.IsReady) { #if UNITY_EDITOR if (!MainThread.IsInitilized) { mThreadState.isAlive = false; } MainThread.RunOnMainThread((x) => { if (!Application.isPlaying) { x.isAlive = false; } }, mThreadState); #endif Thread.Sleep(200); } if (mThreadState.isAlive) { loader.LoadAsTable(); } } } catch (System.Exception e) { RTLog.LogError(LogCat.Table, e.ToString()); } finally { Abort(); MainThread.RunOnMainThread(NotifyComplete); #if UNITY_EDITOR RTLog.LogFormat(LogCat.Table, "End Thread[{0}]", mThreadState.name); #endif } }