コード例 #1
0
ファイル: LocalResLoad.cs プロジェクト: zootankb/ZFramework
        /// <summary>
        /// 分配空间下载AudioClip
        /// </summary>
        /// <param name="path"></param>
        /// <param name="callbackAudioclip"></param>
        /// <param name="progress"></param>
        /// <param name="args"></param>
        private void AllocateAudioClip(string path, Action <string, long, AudioClip, object[]> callbackAudioclip = null, Action <float> progress = null, params object[] args)
        {
            Action <string, long, AudioClip, object[]> callback = (ppath, code, audioclip, cargs) => {
                callbackAudioclipDic[ppath]?.Invoke(ppath, code, audioclip, args);
                callbackAudioclipDic.Remove(ppath);
            };

            if (callbackAudioclipDic.ContainsKey(path))
            {
                callbackAudioclipDic[path] += callbackAudioclip;
            }
            else
            {
                callbackAudioclipDic.Add(path, callbackAudioclip);
            }
            NetResGetRequest nrgr = NetResGetRequest.Allocate(path, callback, progress, args);

            StartCoroutine(nrgr.IEnumStart());
        }
コード例 #2
0
ファイル: LocalResLoad.cs プロジェクト: zootankb/ZFramework
        /// <summary>
        /// 分配空间下载Texture2D
        /// </summary>
        /// <param name="path"></param>
        /// <param name="callbackTexture2d"></param>
        /// <param name="progress"></param>
        /// <param name="args"></param>
        private void AllocateTexture2d(string path, Action <string, long, Texture2D, object[]> callbackTexture2d = null, Action <float> progress = null, params object[] args)
        {
            Action <string, long, Texture2D, object[]> callback = (ppath, code, t2d, cargs) => {
                callbackT2dDic[ppath]?.Invoke(ppath, code, t2d, args);
                callbackT2dDic.Remove(ppath);
            };

            if (callbackT2dDic.ContainsKey(path))
            {
                callbackT2dDic[path] += callbackTexture2d;
            }
            else
            {
                callbackT2dDic.Add(path, callbackTexture2d);
            }
            NetResGetRequest nrgr = NetResGetRequest.Allocate(path, callback, progress, args);

            StartCoroutine(nrgr.IEnumStart());
        }
コード例 #3
0
ファイル: NetResDownload.cs プロジェクト: zootankb/ZFramework
        /// <summary>
        /// 分配空间下载AudioClip
        /// </summary>
        /// <param name="url"></param>
        /// <param name="callbackAudioclip"></param>
        /// <param name="progress"></param>
        /// <param name="args"></param>
        private void AllocateAudioClip(string url, Action <string, long, AudioClip, object[]> callbackAudioclip = null, Action <float> progress = null, params object[] args)
        {
            Action <string, long, AudioClip, object[]> callback = (uurl, code, audioclip, cargs) => {
                callbackAudioclipDic[url]?.Invoke(uurl, code, code == REPONE_SUCC_CODE ? audioclip : null, cargs);
                callbackAudioclipDic.Remove(url);
            };

            if (callbackAudioclipDic.ContainsKey(url))
            {
                callbackAudioclipDic[url] += callbackAudioclip;
            }
            else
            {
                callbackAudioclipDic.Add(url, callbackAudioclip);
            }
            NetResGetRequest nrgr = NetResGetRequest.Allocate(url, callback, progress, args);

            StartCoroutine(nrgr.IEnumStart());
        }
コード例 #4
0
ファイル: NetResDownload.cs プロジェクト: zootankb/ZFramework
        /// <summary>
        /// 分配空间下载TextAsset
        /// </summary>
        /// <param name="url"></param>
        /// <param name="callbackTextasset"></param>
        /// <param name="progress"></param>
        /// <param name="args"></param>
        private void AllocateTextAsset(string url, Action <string, long, TextAsset, object[]> callbackTextasset = null, Action <float> progress = null, params object[] args)
        {
            Action <string, long, TextAsset, object[]> callback = (uurl, code, txtast, cargs) => {
                callbackTextAssetDic[url]?.Invoke(uurl, code, code == REPONE_SUCC_CODE ? txtast : null, cargs);
                callbackTextAssetDic.Remove(url);
            };

            if (callbackTextAssetDic.ContainsKey(url))
            {
                callbackTextAssetDic[url] += callbackTextasset;
            }
            else
            {
                callbackTextAssetDic.Add(url, callbackTextasset);
            }
            NetResGetRequest nrgr = NetResGetRequest.Allocate(url, callback, progress, args);

            StartCoroutine(nrgr.IEnumStart());
        }
コード例 #5
0
ファイル: LocalResLoad.cs プロジェクト: zootankb/ZFramework
        /// <summary>
        /// 分配空间加载ab包数据
        /// </summary>
        /// <param name="path"></param>
        /// <param name="callbackAb"></param>
        /// <param name="progress"></param>
        /// <param name="args"></param>
        private void AllocateAssetbundle(string path, Action <string, long, AssetBundle, object[]> callbackAb = null, Action <float> progress = null, params object[] args)
        {
            Action <string, long, AssetBundle, object[]> callback = (ppath, code, ab, cargs) =>
            {
                callbackAbDic[ppath]?.Invoke(ppath, code, ab, args);
                callbackAbDic.Remove(ppath);
            };

            // 不管下没下载都执行一次下载,在会调用处理下载结果
            if (callbackByteArrDic.ContainsKey(path))
            {
                callbackAbDic[path] += callbackAb;
            }
            else
            {
                callbackAbDic.Add(path, callbackAb);
            }
            NetResGetRequest nrgr = NetResGetRequest.Allocate(path, callback, progress, args);

            StartCoroutine(nrgr.IEnumStart());
        }
コード例 #6
0
ファイル: NetResDownload.cs プロジェクト: zootankb/ZFramework
        private void AllocateByteArr(string url, Action <string, long, AssetBundle, object[]> callbackAb = null, Action <float> progress = null, params object[] args)
        {
            Action <string, long, AssetBundle, object[]> callback = (uurl, code, ab, cargs) =>
            {
                callbackAbDic[url]?.Invoke(uurl, code, code == REPONE_SUCC_CODE ? ab : null, cargs);
                callbackAbDic.Remove(url);
            };

            // 不管下没下载都执行一次下载,在会调用处理下载结果
            if (callbackByteArrDic.ContainsKey(url))
            {
                callbackAbDic[url] += callbackAb;
            }
            else
            {
                callbackAbDic.Add(url, callbackAb);
            }
            NetResGetRequest nrgr = NetResGetRequest.Allocate(url, callback, progress, args);

            StartCoroutine(nrgr.IEnumStart());
        }