override public void init(LoadItem item) { base.init(item); // 继续加载当前的关卡 //loadLevel(m_origPath); refCountResLoadResultNotify.loadResEventDispatch.dispatchEvent(this); }
protected string m_prefabName; // 预制名字 override public void init(LoadItem item) { base.init(item); m_prefabObj = (item as ResourceLoadItem).prefabObj; refCountResLoadResultNotify.loadResEventDispatch.dispatchEvent(this); }
override public void init(LoadItem item) { base.init(item); m_bytes = (item as DataLoadItem).m_bytes; m_localPath = (item as DataLoadItem).m_localPath; refCountResLoadResultNotify.loadResEventDispatch.dispatchEvent(this); }
public Dictionary<string, ABMemUnPakFileResItemBase> m_path2MemUnPakRes = new Dictionary<string, ABMemUnPakFileResItemBase>(); // 路径到 bytes 内容的字典,从文件加载一次就不再加载,保存这份引用 override public void init(LoadItem item) { base.init(item); m_pakItem = new PakItem(); m_pakItem.m_fs = (item as ABPakLoadItem).m_fs; m_pakItem.readArchiveFileHeader(); // 获取打包头部信息 initMemUnPak(); }
override public void init(LoadItem item) { base.init(item); m_bundle = item.assetBundle; if (m_resNeedCoroutine) { Ctx.m_instance.m_coroutineMgr.StartCoroutine(initAssetByCoroutine()); } else { initAsset(); } }
public void onLoadEventHandle(IDispatchObject dispObj) { LoadItem item = dispObj as LoadItem; item.nonRefCountResLoadResultNotify.loadResEventDispatch.removeEventHandle(onLoadEventHandle); if (item.nonRefCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { onLoaded(item); } else if (item.nonRefCountResLoadResultNotify.resLoadState.hasFailed()) { onFailed(item); } releaseLoadItem(item); --m_curNum; loadNextItem(); }
protected void loadWithResCreatedAndNotLoad(LoadParam param, ResItem resItem) { m_LoadData.m_path2Res[param.m_path] = resItem; m_LoadData.m_path2Res[param.m_path].refCountResLoadResultNotify.resLoadState.setLoading(); LoadItem loadItem = createLoadItem(param); if (m_curNum < m_maxParral) { m_LoadData.m_path2LDItem[param.m_path] = loadItem; m_LoadData.m_path2LDItem[param.m_path].load(); ++m_curNum; } else { m_LoadData.m_willLDItem.Add(loadItem); } resetLoadParam(param); }
override public void init(LoadItem item) { base.init(item); // 如果是打包成 AssetBundle ,然后放在本地磁盘,要加载的话,需要 WWW 打开,AssetBundle.CreateFromFile 是不行的 //string path; //path = Application.dataPath + "/" + m_path; //AssetBundle asset = AssetBundle.CreateFromFile(path); //asset.LoadAll(); //Object[] resArr = asset.LoadAllAssets(); if (m_resNeedCoroutine) { Ctx.m_instance.m_coroutineMgr.StartCoroutine(initAssetByCoroutine()); } else { initAsset(); //Ctx.m_instance.m_coroutineMgr.StartCoroutine(initAssetNextFrame()); } }
virtual public void failed(LoadItem item) { m_refCountResLoadResultNotify.resLoadState.setFailed(); m_refCountResLoadResultNotify.loadResEventDispatch.dispatchEvent(this); }
virtual public void init(LoadItem item) { m_refCountResLoadResultNotify.resLoadState.setSuccessLoaded(); }
override public void init(LoadItem item) { initByBytes((item as ABUnPakLoadItem).m_bytes, SCENE_PRE_PATH); }
protected void releaseLoadItem(LoadItem item) { item.reset(); m_LoadData.m_noUsedLDItem.Add(item); m_LoadData.m_path2LDItem.Remove(item.path); }
protected LoadItem createLoadItem(LoadParam param) { LoadItem loadItem = findLoadItemFormPool(param.m_resPackType); if (ResPackType.eResourcesType == param.m_resPackType) // 默认 Bundle 中资源 { if (loadItem == null) { loadItem = new ResourceLoadItem(); } } else if (ResPackType.eBundleType == param.m_resPackType) // Bundle 打包模式 { if (loadItem == null) { loadItem = new BundleLoadItem(); } } else if (ResPackType.eLevelType == param.m_resPackType) { if (loadItem == null) { loadItem = new LevelLoadItem(); } (loadItem as LevelLoadItem).levelName = param.lvlName; } else if (ResPackType.eDataType == param.m_resPackType) { if (loadItem == null) { loadItem = new DataLoadItem(); } (loadItem as DataLoadItem).m_version = param.m_version; } else if (ResPackType.eUnPakType == param.m_resPackType || ResPackType.eUnPakLevelType == param.m_resPackType) { if (loadItem == null) { loadItem = new ABUnPakLoadItem(); } } else if (ResPackType.ePakType == param.m_resPackType || ResPackType.ePakLevelType == param.m_resPackType) { if (loadItem == null) { loadItem = new ABPakLoadItem(); } } loadItem.resPackType = param.m_resPackType; loadItem.resLoadType = param.m_resLoadType; loadItem.path = param.m_path; loadItem.pathNoExt = param.m_pathNoExt; loadItem.extName = param.extName; loadItem.loadNeedCoroutine = param.m_loadNeedCoroutine; loadItem.nonRefCountResLoadResultNotify.loadResEventDispatch.addEventHandle(onLoadEventHandle); return(loadItem); }
protected GameObject m_retGO; // 方便调试的临时对象 override public void init(LoadItem item) { base.init(item); initByBytes((item as ABUnPakLoadItem).m_bytes, PRE_PATH); }
public void onLoaded(LoadItem item) { if (m_LoadData.m_path2Res.ContainsKey(item.path)) { m_LoadData.m_path2Res[item.path].init(m_LoadData.m_path2LDItem[item.path]); } else // 如果资源已经没有使用的地方了 { item.unload(); // 直接卸载掉 } }
public void onFailed(LoadItem item) { string path = item.path; if (m_LoadData.m_path2Res.ContainsKey(path)) { m_LoadData.m_path2Res[path].failed(m_LoadData.m_path2LDItem[path]); } }
protected LoadItem findLoadItemFormPool(ResPackType type) { m_retLoadItem = null; foreach (LoadItem item in m_LoadData.m_noUsedLDItem) { if (item.resPackType == type) { m_retLoadItem = item; m_LoadData.m_noUsedLDItem.Remove(m_retLoadItem); break; } } return m_retLoadItem; }
public FileStream m_fs = null; // 文件句柄 override public void init(LoadItem item) { base.init(item); refCountResLoadResultNotify.loadResEventDispatch.dispatchEvent(this); }