Example #1
0
        private IEnumerator CacheInternal(string id, ResCategory cat, Action <string> OnCached, Action <string, string, string> OnError, CacheOption options, Type[] typeF, IAsyncProgress prog)
        {
            _inLoading.Add(id);
            WWW l = new WWW(ConvertToUrl(id));

            prog.Next(l);
            yield return(l);

            if (l.error != null)
            {
                if (OnError != null)
                {
                    OnError(id, l.url, l.error);
                }
                else
                {
                    DefaultOnError(id, l.url, l.error);
                }
            }
            PostProcessByCategory(id, l, cat, typeF);
            if (options > CacheOption._Ignorable)
            {
                OptionalPostProcess(id, cat, options);
            }
            if (OnCached != null)
            {
                OnCached(id);
            }
            _inLoading.Remove(id);
        }
Example #2
0
        public IAsyncProgress Cache(string id, ResCategory cat, Action <string> OnCached, Action <string, string, string> OnError, params Type[] typeF)
        {
            if (_inLoading.Contains(id) || _pool.ContainsKey(id))
            {
                return(null);
            }
            LoadProgress lp = new LoadProgress();

            CrExe.StartCoroutine(CacheInternal(id, cat, OnCached, OnError, 0, typeF, lp));
            return(lp);
        }
Example #3
0
        private void PostProcessByCategory(string id, WWW loader, ResCategory cat, Type[] typeF)
        {
            switch (cat)
            {
            case ResCategory.Audio:
                //TODO : loader.GetAudioClip();
                break;

            case ResCategory.Binary:
                //TODO : loader.bytes
                break;

            case ResCategory.Text:
                //TODO : loader.text
                break;

            case ResCategory.Video:
                //TODO : loader.movie;
                break;

            case ResCategory.Character: {
                GameObject t = loader.assetBundle.mainAsset as GameObject;
                if (t == null)
                {
                    Debug.LogError("assetbundle from (" + loader.url + ") does not contain the requested GameObject (id = " + id + ")");
                }
                else
                {
                    _pool.Add(id, t);
                }
            }
            break;

            case ResCategory.Scene: {
                AssetBundle ab = loader.assetBundle;                //load the bundle into memory
            }
            break;

            case ResCategory.Shader: {
                Shader t = loader.assetBundle.mainAsset as Shader;
                if (t == null)
                {
                    Debug.LogError("assetbundle from (" + loader.url + ") does not contain the requested Shader (id = " + id + ")");
                }
                else
                {
                    _pool.Add(id, t);
                }
            }
            break;
            }
        }
Example #4
0
        public ResCategory GetCategory(AuthenticationInfo objAuthInfo)
        {
            ResCategory objResponse = new ResCategory();

            try
            {
                // entry log
            }

            catch (Exception ex)
            {
                objResponse.Result = CreateResult(ex, objAuthInfo);
            }
            finally
            {
                // exit log
            }

            return(objResponse);
        }
Example #5
0
 private void OptionalPostProcess(string id, ResCategory cat, CacheOption options)
 {
     //TODO
 }
Example #6
0
 public IAsyncProgress Cache <R> (string id, ResCategory cat, Action <string> OnCached) where R : UnityEngine.Object
 {
     return(Cache(id, cat, OnCached, null, typeof(R)));
 }
Example #7
0
 public IAsyncProgress Cache(string id, ResCategory cat, Action <string> OnCached)
 {
     return(Cache(id, cat, OnCached, null, null));
 }