/// <summary>
        /// 其它都准备好了,加载AssetBundle
        /// 注意:这个方法只能被 AssetBundleManager 调用
        /// 由 Manager 统一分配加载时机,防止加载过卡
        /// </summary>
        override public void LoadBundle()
        {
            _assetBundleCachedFile = string.Format("{0}/{1}", AssetBundlePathResolver.BundleCacheDir, bundleName);
            _assetBundleSourceFile = AssetBundlePathResolver.GetBundleSourceFile(bundleName);

            if (File.Exists(_assetBundleCachedFile))
            {
                bundleManager.StartCoroutine(LoadFromCachedFile());
            }
            else
            {
                bundleManager.StartCoroutine(LoadFromPackage());
            }
        }
        protected override IEnumerator LoadFromPackage()
        {
            //兼容低版本API
#if UNITY_4 || UNITY_4_6 || UNITY_5_1 || UNITY_5_2
            _bundle = AssetBundle.CreateFromFile(_assetBundleSourceFile);
            yield return(null);
#else
            _assetBundleSourceFile = AssetBundlePathResolver.GetBundleSourceFile(bundleName, false);
            AssetBundleCreateRequest req = AssetBundle.LoadFromFileAsync(_assetBundleSourceFile);
            yield return(req);

            _bundle = req.assetBundle;
#endif
            this.Complete();
        }
示例#3
0
 public AssetBundlePathResolver()
 {
     instance = this;
 }
示例#4
0
 public AssetBundleBuilder4x(AssetBundlePathResolver pathResolver) : base(pathResolver)
 {
 }
示例#5
0
 public AssetBundleManager()
 {
     Instance     = this;
     pathResolver = new AssetBundlePathResolver();
 }
示例#6
0
 public ABBuilder(AssetBundlePathResolver resolver)
 {
     this.pathResolver = resolver;
     this.InitDirs();
     AssetBundleUtils.pathResolver = pathResolver;
 }
示例#7
0
 public AssetBundleBuilder5x(AssetBundlePathResolver resolver)
     : base(resolver)
 {
 }