Esempio n. 1
0
    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;
                }
            }
        }
    }
Esempio n. 2
0
    static void ParseThreadData(DataLoadThreadData threadData)
    {
        if (threadData != null)
        {
            //UnityEngine.Debug.Log("@@@@@ START ---- " + threadData.m_name);
            SimpleJSON.JSONNode rootNode = null;

            //long lStartTime = DateTime.Now.Ticks;

            if (string.IsNullOrEmpty(threadData.m_Text) == false)
            {
                rootNode = SimpleJSON.JSON.Parse(threadData.m_Text);
            }

            try
            {
                if (threadData.m_CompleteFunc != null)
                {
                    threadData.m_CompleteFunc(rootNode);
                }

                if (threadData.m_EndFunc != null)
                {
                    threadData.m_EndFunc();
                }
            }

            catch (Exception e)
            {
                Debug.Log(e.ToString());
            }

            if (DATA_LOAD_MODE == eDataLoadMode.Coroutine)
            {
                --CoroutineRunningCount;
                //Debug.LogError(" -- Coroutine running Removed : " + CoroutineRunningCount.ToString());
            }
        }
        else
        {
            //Fabric.Crashlytics.Crashlytics.Log("threadData is null");
        }
    }
Esempio n. 3
0
    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;
    }
Esempio n. 4
0
 static void ParseDataImmediately(eLoadDataPriority priority, DataLoadThreadData threadData)
 {
     ParseThreadData(threadData);
 }