public virtual void DownLoad(string url) { if (this.LoadState == BundleLoadState.Prepared) { this.LoadState = BundleLoadState.Running; } }
void LoadNext() { if (requestList.Count < 1) { state = BundleLoadState.Success; totalLength = 0; loadIndex = 0; return; } BundleLoadInfo info = requestList[0]; loadIndex++; state = BundleLoadState.InProgress; if (ZBundleManager.Instance.HasBundle(info.path)) { if (info.completeFun != null) { info.completeFun.Invoke(info.path, true); } RemoveLoadInfo(info.path); LoadNext(); } else { if (info.IsWeb) { StartCoroutine(LoadRemoteInspector(info)); } else { StartCoroutine(LoadLocalInspector(info)); } } }
public void LoadBundles(BundleInfo[] list) { if (state == BundleLoadState.InProgress || list == null) { return; } ZLog.Log("LoadBundles ..................num = " + list.Length); state = BundleLoadState.Failure; loadIndex = 0; requestList.Clear(); for (int i = 0; i < list.Length; i++) { BundleInfo model = list[i]; if (!HasLoadInfo(model.path)) { BundleLoadInfo info = new BundleLoadInfo(model.path, model.type) { id = model.id, downURL = model.url }; requestList.Add(info); } } totalLength = requestList.Count; LoadNext(); }
public virtual void Resume() { if (this.LoadState != BundleLoadState.Error && this.LoadState != BundleLoadState.Stopped && this.LoadState != BundleLoadState.Finished) { this.LoadState = BundleLoadState.Running; } }
public virtual void Stop() { if (this.LoadState != BundleLoadState.Finished && this.LoadState != BundleLoadState.Error && this.LoadState != BundleLoadState.Stopped) { this.LoadState = BundleLoadState.Stopped; } }
public virtual void Load(string name) { this.LoadResPath = name; if (this.LoadState == BundleLoadState.Prepared) { this.LoadState = BundleLoadState.Running; } }
public void CopyData(BundleImportData data) { RootPath = data.RootPath; FileNameMatch = data.FileNameMatch; Index = data.Index; Type = data.Type; LoadState = data.LoadState; Publish = data.Publish; LimitCount = data.LimitCount; LimitKBSize = data.LimitKBSize; PushDependice = data.PushDependice; }
protected BundlePkgInfo _SeekPkgInfo(string name) { BundlePkgInfo pkginfo = ResBundleMgr.mIns.BundleInformation.SeekInfo(name); if (pkginfo == null) { this.LoadState = BundleLoadState.Error; throw new FrameWorkException(string.Format("Not Found {0}", name), ExceptionType.Higher_Excetpion); } return(pkginfo); }
public virtual void RemoveToPool() { this._BundleMainObject = null; this._BundleRef = null; this.loadingpkg = null; this.LoadResPath = null; this.LoadState = BundleLoadState.Prepared; this.onComplete = null; this.LoaderInsObject = null; this.PreParedGameObject = null; this._AsyncOpation = null; }
protected IBundleRef LoadFullAssetToMem(BundlePkgInfo pkginfo) { IBundleRef bundle = null; if (ResBundleMgr.mIns.Cache.Contains(pkginfo)) { bundle = ResBundleMgr.mIns.Cache.TryGetValue(pkginfo); return(bundle); } #if UNITY_IOS || UNITY_IPHONE || UNITY_ANDROID if (GameApplication.isPlaying && MainLoop.getInstance().OpenABMode) { AssetBundle ab = null; using (gstring.Block()) { ab = this.LoadAssetBundle(BundlePathConvert.GetRunningPath(pkginfo.AbFileName)); } if (ab == null) { this.ThrowAssetMissing(this.LoadResPath); } bundle = ResBundleMgr.mIns.Cache.PushAsset(pkginfo, ab); return(bundle); } else #endif { UnityEngine.Object target = AssetDatabaseLoad(pkginfo.EditorPath); if (target == null) { if (BundleConfig.SAFE_MODE) { this.ThrowAssetMissing(pkginfo.BundleName); } else { this.LoadState = BundleLoadState.Error; LogMgr.LogErrorFormat("Asset {0} Missing", pkginfo.BundleName); } } else { #if UNITY_EDITOR bundle = ResBundleMgr.mIns.Cache.PushEditorAsset(pkginfo, target); #endif } return(bundle); } }
protected void ThrowAssetMissing(string resname) { ResBundleMgr.mIns.Cache.RemoveLoading(resname); ResBundleMgr.mIns.Cache.RemoveLoading(this.LoadResPath); if (BundleConfig.SAFE_MODE) { throw new FrameWorkResMissingException(string.Format("Asset =》{0} Missing", resname)); } else { this.LoadState = BundleLoadState.Error; LogMgr.LogErrorFormat("Asset =》{0} Missing", resname); } }
public static bool CreateNewBundle(string name, string parent, BundleType type, BundleLoadState loadState) { if (m_dataDict.ContainsKey(name)) { return(false); } BundleData newBundle = new BundleData(); newBundle.name = name; newBundle.type = type; newBundle.loadState = loadState; if (!string.IsNullOrEmpty(parent)) { if (m_dataDict.ContainsKey(parent)) { return(false); } else { m_dataDict[parent].children.Add(name); } newBundle.parent = parent; } m_dataDict.Add(name, newBundle); BMDataAccessor.Datas.Add(newBundle); BundleState newState = new BundleState(); newState.bundleID = name; newState.version = 1; m_stateDict.Add(name, newState); BMDataAccessor.States.Add(newState); return(true); }
protected void ThrowLogicError(string info = null) { ResBundleMgr.mIns.Cache.RemoveLoading(this.LoadResPath); this.LoadState = BundleLoadState.Error; throw new FrameWorkException(string.Format("{0} 逻辑异常", info), ExceptionType.Higher_Excetpion); }