public AssetBundleAssetLoadRequest(AssetBundleBundle bundle, string assetName, Type type, int mode)
 {
     this.assetName = assetName;
     this.type      = type;
     this.mode      = mode;
     LoadAsset(bundle);
 }
示例#2
0
        void CheckComplete()
        {
            if (IsComplete)
            {
                if (depError)
                {
                    state = State.Error;
                    if (assetBundleCache)
                    {
                        assetBundleCache.Unload(true);   //如果依赖出错. 则没有加载的必要
                        assetBundleCache = null;
                    }
                }

                //成功, 需要创建AssetBundleBundle
                if (state == State.Complete)
                {
                    Debug.Assert(bundle == null);
                    AssetBundleManager mgr = AssetBundleManager.Instance as AssetBundleManager;
                    bundle = new AssetBundleBundle(this, mgr.CollectDepAssetBundleBundles(bundleName));
                    if (hold)
                    {
                        mgr.SetBundleHold(bundle, true);
                    }
                }

                //通知
                if (OnComplete != null)
                {
                    var handler = OnComplete;
                    OnComplete = null;
                    handler(state == State.Error);
                }
            }
        }
 //------------------------
 void LoadAsset(AssetBundleBundle bundle)
 {
     AssetBundleManager.Instance.StartCoroutine(bundle.LoadAssetAsyncImpl(assetName, type, this, mode));
 }
示例#4
0
 public AssetBundleAsset(Object asset, string assetName, AssetBundleBundle bundle)
 {
     this.asset  = asset;
     this.bundle = bundle;
     AssetName   = assetName;
 }