static void PutDataIntoThreadList(eLoadDataPriority priority, DataLoadThreadData threadData) { if (m_threadLock != null) { lock (m_threadLock) { switch (priority) { case eLoadDataPriority.HIGH: { m_listThreadDataHigh.Add(threadData); ++ThreadDataCount; } break; case eLoadDataPriority.NORMAL: { m_listThreadDataNormal.Add(threadData); ++ThreadDataCount; } break; case eLoadDataPriority.LOW: { m_listThreadDataLow.Add(threadData); ++ThreadDataCount; } break; } } } }
public static void LoadDataFile(eLoadDataPriority priority, string strFileName, DataFileLoaderFunc completeFunc, Action startFunc = null, Action endFunc = null) { AssetBundleLoadAssetOperation operation = AssetBundleManager.LoadAssetAsync("setting_data", strFileName, typeof(TextAsset)); if (operation == null) { if (completeFunc != null) { completeFunc(null); } return; } if (DATA_LOAD_MODE == eDataLoadMode.Coroutine) { ++CoroutineRunningCount; //Debug.LogError(" ++ Coroutine running Added : " + CoroutineRunningCount.ToString()); } else { startloadCount++; } if (startFunc != null) { startFunc(); } Instance.StartCoroutine(LoadDataFile(priority, operation, completeFunc, endFunc)); }
static IEnumerator LoadDataFile(eLoadDataPriority priority, AssetBundleLoadAssetOperation operation, DataFileLoaderFunc completeFunc, Action endFunc = null) { yield return(operation); TextAsset textAsset = operation.GetAsset <TextAsset>(); //long lStartTime = DateTime.Now.Ticks; string strText = string.Empty; string strName = string.Empty; if (textAsset != null) { strText = textAsset.text; strName = textAsset.name; } AssetBundleManager.UnloadAssetBundle("setting_data"); DataLoadThreadData threadData = new DataLoadThreadData(); threadData.m_name = strName; threadData.m_Text = strText; threadData.m_CompleteFunc = completeFunc; threadData.m_EndFunc = endFunc; //thread.Priority = System.Threading.ThreadPriority.Lowest; if (DATA_LOAD_MODE == eDataLoadMode.MultiThread) { PutDataIntoThreadList(priority, threadData); endloadCount++; } else if (DATA_LOAD_MODE == eDataLoadMode.Coroutine) { ParseDataImmediately(priority, threadData); } yield break; }
public void LoadDataFile(string strFileName, DataFileLoaderFunc completeFunc, eLoadDataPriority loadDataPriority = eLoadDataPriority.NORMAL) { ManagerManager.LoadDataFile(loadDataPriority, strFileName, completeFunc); }
static void ParseDataImmediately(eLoadDataPriority priority, DataLoadThreadData threadData) { ParseThreadData(threadData); }