Exemple #1
0
 public void GetAssetBundle(string url, bool unload, Action <AssetBundle> callback)
 {
     GetRemote(url, f =>
     {
         if (f != null)
         {
             FileAssetLoader.GetAssetBundleFromFile(f.FullName, callback);
         }
         else
         {
             fallback.GetAssetBundle(url, unload, callback);
         }
     });
 }
        public void GetAssets <T>(string url, Action <IEnumerable <T> > callback, bool asyncHint) where T : Object
        {
            Entry    e = GetCacheEntry(url);
            FileInfo f = asyncHint? null : e.GetFile();

            if (f != null)
            {
                FileAssetLoader.GetAssetBundleFromFile(f.FullName, bundle => {
                    if (bundle != null)
                    {
                        T[] assets = bundle.LoadAllAssets <T>();
                        bundle.Unload(false);
                        callback.Call(assets);
                    }
                    else
                    {
                        fallback.GetAssets <T>(url, callback, asyncHint);
                    }
                });
            }
            else
            {
#if WWW_MODULE
                GetWWW(url, true, www =>
                {
                    if (www != null)
                    {
                        T[] assets = www.GetAssets <T>();
                        callback.Call(assets);
                    }
                    else
                    {
                        fallback.GetAssets <T>(url, callback, asyncHint);
                    }
                });
#else
                throw new Exception("Not implemented");
#endif
            }
        }