Example #1
0
    private static IEnumerator OnLocalLoadThread(VOLocalLoadNode node)
    {
        while (_listNode.Count > 0)
        {
            UnityEngine.Object obj = Resources.Load(node.resPath.path);
            _listNode.Remove(node);

            //完整路径
            if (node.resPath.path.IndexOf(".unity3d") == -1)
            {
                node.resPath.path = SystemConfig.localPlatformResPath + node.resPath.path + ".unity3d";
            }

            if (obj != null)
            {
                ResDataManager.instance.AddEditorRes(node.resPath.path, obj);
                if (node.loaderFileComplete != null)
                {
                    node.loaderFileComplete(node.resPath.path, node.param);
                }
            }
            else
            {
                Log.info("[ResLoadTool LoadFromLocalRes]加载失败!" + node.resPath.path);
                if (node.loaderError != null)
                {
                    node.loaderError(node.resPath.path, "[ResLoadTool LoadFromLocalRes]加载失败!" + node.resPath.path);
                    yield return(2);
                }
            }

            bool b = UpdateProgress(node.id);
            if (b)
            {
                if (node.loaderListProgress != null)
                {
                    node.loaderListProgress(node.id, _listProgressDict[node.id], _listStateDict[node.id]);
                }
                if (CheckLoaded(node.id))
                {//队列完成
                    if (node.loaderListComplete != null)
                    {
                        node.loaderListComplete(node.id, node.param);
                    }
                    RemoveList(node.id);
                }
            }
            yield return(2);
        }
        CoroutineDelegate.StopCoroutines(OnLocalLoadThread(node));
    }