Exemplo n.º 1
0
        /// <summary>
        /// 异步加载资源的话,都会有Asset
        /// </summary>
        /// <param name="name">Name.</param>

        public void LoadAsync(string filename, System.Action <UObj, string> finished)
        {
            Utils.Assert(string.IsNullOrEmpty(filename), "Can't Load Empty Resource");
                        #if Package
            CoroutineProvider.Instance().StartCoroutine(AsyncAb(filename, finished));
                        #else
            CoroutineProvider.Instance().StartCoroutine(Async(filename, finished));
                        #endif
        }
Exemplo n.º 2
0
        public void LoadAsync(string filename, Action <UObj, string> finished)
        {
            Utils.Assert(string.IsNullOrEmpty(filename), "Can't Load Empty Resource");

            ///
            /// 有一定策略来决定是Resource加载还是Assetbundle加载
            ///
                        #if Package
            CoroutineProvider.Instance().StartCoroutine(AsyncAb(filename, finished));
                        #else
            CoroutineProvider.Instance().StartCoroutine(AsyncRes(filename, finished));
                        #endif
        }
Exemplo n.º 3
0
        private void LoadEnd()
        {
            if (cachedWork.Count > 0)
            {
                AssetTask task = cachedWork.Dequeue();

                if (task != null)
                {
                    if (dicLoadingReq.Count < MAX_WWW_COUNT)
                    {
                        // 如果没下载,则开始下载
                        CoroutineProvider.Instance().StartCoroutine(AsyncLoadCoroutine(task));
                    }
                    else
                    {
                        cachedWork.Enqueue(task);
                    }
                }
            }
        }
Exemplo n.º 4
0
        // name表示 不包含路径的预设体名,
        public void LoadAsync(AssetTask task)
        {
            if (task == null)
            {
                return;
            }
            // 如果已经下载,则返回
            if (dicAsset.ContainsKey(task.AssetBundleName))
            {
                return;
            }

            // 如果正在下载,则返回
            if (dicLoadingReq.ContainsKey(task.AssetBundleName))
            {
                return;
            }

            if (dicLoadingReq.Count < MAX_WWW_COUNT)
            {
                if (Core.DevFSM.rtPlatform == RuntimePlatform.OSXEditor || Core.DevFSM.rtPlatform == RuntimePlatform.OSXPlayer)
                {
                    //CoroutineProvider.Instance().StartCoroutine(AsyncLoadLoacl(task));
                    CoroutineProvider.Instance().StartCoroutine(AsyncLoadCoroutine(task));
                }
                else
                {
                    // 如果没下载,则开始下载
                    CoroutineProvider.Instance().StartCoroutine(AsyncLoadCoroutine(task));
                }
            }
            else
            {
                cachedWork.Enqueue(task);
            }
        }