protected override void LoadMainAsyncRequest(AssetBundleRequest request) { this._BundleMainObject = request.asset; if (!this.isABMode) { GameSceneCtr.LoadScene(this.loadingpkg.BundleName); this._FinishAndRelease(); } else { ///需要异步预实例化 this._PushTaskAndExcute(this.loadingpkg, GameSceneCtr.LoadSceneAsync(this.loadingpkg.BundleName)); } }
protected override void OnFinish() { if (BundleConfig.Bundle_Log) { LogMgr.LogFormat("Scene Load Asset {0} Finished at {1}", this.LoadResPath, GameSyncCtr.mIns.RenderFrameCount); } this.InvokeHandler(true); string[] sceneSplit = this.loadingpkg.BundleName.Split('.'); string scename = this.loadingpkg.BundleName; if (sceneSplit.Length > 1) { scename = sceneSplit[0]; } GameSceneCtr.LoadScene(scename); this.Dispose(); }
private void LoadScene() { if (!this.isABMode) { SceneOperation asyOp = GameSceneCtr.LoadSceneAsync(Path.GetFileNameWithoutExtension(this.loadingpkg.BundleName)); asyOp.DisableScene(); this._AsyncOpation = asyOp; this._PushTaskAndExcute(this.loadingpkg, asyOp); } else { ///需要异步预实例化 SceneOperation asyOp = GameSceneCtr.LoadSceneAsync(this._BundleRef.LoadName); asyOp.DisableScene(); this._AsyncOpation = asyOp; this._PushTaskAndExcute(this.loadingpkg, asyOp); } }
private void AutoCreateBundle() { if (Task.asyncType == AsyncBundleTp.AB_LOAD) { AssetBundleRequest abReq = Task.currentAsync as AssetBundleRequest; this.LoadMainAsyncRequest(abReq); } else if (Task.asyncType == AsyncBundleTp.AB_CREATE) { AssetBundleCreateRequest abCreateReq = Task.currentAsync as AssetBundleCreateRequest; if (abCreateReq.assetBundle == null) { ThrowAssetMissing(this.LoadResPath); } IBundleRef bundle = ResBundleMgr.mIns.Cache.PushAsset(Task.CurrentLoadInfo, abCreateReq.assetBundle); BundlePkgInfo pkg = this._SeekPkgInfo(abCreateReq.assetBundle.name); this.AddDepends(pkg, bundle); ResBundleMgr.mIns.Cache.RemoveLoading(pkg.BundleName); if (FrameWorkConfig.Open_DEBUG) { LogMgr.LogFormat("成功加载了 :{0} => {1} => {2} => RefCnt :{3} =>SelfRefCnt:{4}", this.UID, pkg.BundleName, pkg.AbFileName, bundle.InstanceRefCount, bundle.SelfRefCount); } this.RefreshLoaded(); } else if (Task.asyncType == AsyncBundleTp.SCENE_LOAD) { this.LoadSceneAssetFinish(); } else { if (isABMode) { if (BundleConfig.SAFE_MODE) { throw new FrameWorkResNotMatchException(string.Format("不被支持的异步类型 {0}", Task.currentAsync)); } else { LogMgr.LogError("不被支持的异步类型 "); this.LoadState = BundleLoadState.Error; } } else { this._BundleRef = LoadFullAssetToMem(this.loadingpkg); this._BundleMainObject = this._BundleRef.MainObject; this.AddDepends(this.loadingpkg, this._BundleRef); if (isSceneLoad) { SceneOperation asyncOp = GameSceneCtr.LoadSceneAsync(Path.GetFileNameWithoutExtension(this.LoadResPath)); asyncOp.DisableScene(); this._AsyncOpation = asyncOp; this._PushTaskAndExcute(this.loadingpkg, asyncOp); } else { this._FinishAndRelease(); } } } }