override protected void initImpl(ResItem res) { string text = res.getText(GetPath()); Ctx.m_instance.m_aiSystem.behaviorTreeMgr.parseXml(text); base.initImpl(res); }
override protected void initImpl(ResItem res) { m_atlasPath = res.GetPath(); m_soSpriteList = res.getObject(res.getPrefabName()) as SOSpriteList; initImage(); }
override protected void initImpl(ResItem res) { base.initImpl(res); SecurityParser xmlDoc = new SecurityParser(); xmlDoc.LoadXml(m_text); SecurityElement rootNode = xmlDoc.ToXml(); ArrayList itemMeshList = rootNode.Children; SecurityElement itemMesh; ArrayList itemSubMeshList; SecurityElement itemSubMesh; string meshName = ""; string subMeshName = ""; string bonesList = ""; foreach (SecurityElement itemNode1f in itemMeshList) { itemMesh = itemNode1f; UtilXml.getXmlAttrStr(itemMesh, "name", ref meshName); itemSubMeshList = itemMesh.Children; foreach (SecurityElement itemNode2f in itemSubMeshList) { itemSubMesh = itemNode2f; UtilXml.getXmlAttrStr(itemSubMesh, "name", ref subMeshName); UtilXml.getXmlAttrStr(itemSubMesh, "bonelist", ref bonesList); m_boneArr = bonesList.Split(','); } } m_text = ""; }
// 加载一个表完成 public void onLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath()); string text = res.getText(""); if (text != null) { string[] lineSplitStr = { "\r\n" }; string[] tabSplitStr = { "\t" }; string[] lineList = text.Split(lineSplitStr, StringSplitOptions.RemoveEmptyEntries); int lineIdx = 0; string[] tabList = null; m_filterArr = new string[lineList.Length]; while (lineIdx < lineList.Length) { tabList = lineList[lineIdx].Split(tabSplitStr, StringSplitOptions.RemoveEmptyEntries); m_filterArr[lineIdx] = tabList[1]; ++lineIdx; } } } else if (res.refCountResLoadResultNotify.resLoadState.hasFailed()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath()); } // 卸载资源 Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle); }
// 加载一个表完成 public void onLoadEventHandle(IDispatchObject dispObj) { m_res = dispObj as ResItem; if (m_res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, m_res.GetPath()); byte[] bytes = m_res.getBytes(""); if (bytes != null) { m_byteArray = Ctx.m_instance.m_factoryBuild.buildByteBuffer(); m_byteArray.clear(); m_byteArray.writeBytes(bytes, 0, (uint)bytes.Length); m_byteArray.setPos(0); readTable(getTableIDByPath(m_res.GetPath()), m_byteArray); } } else if (m_res.refCountResLoadResultNotify.resLoadState.hasFailed()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, m_res.GetPath()); } // 卸载资源 Ctx.m_instance.m_resLoadMgr.unload(m_res.GetPath(), onLoadEventHandle); }
public virtual void onLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; string path = res.GetPath(); if (m_path2ResDic.ContainsKey(path)) { m_path2ResDic[path].refCountResLoadResultNotify.resLoadState.copyFrom(res.refCountResLoadResultNotify.resLoadState); if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { m_path2ResDic[path].init(res); if (m_path2ResDic[path].bOrigResNeedImmeUnload) { // 卸载资源 Ctx.m_instance.m_resLoadMgr.unload(path, onLoadEventHandle); } } else { m_path2ResDic[path].failed(res); Ctx.m_instance.m_resLoadMgr.unload(path, onLoadEventHandle); } } else { Ctx.m_instance.m_logSys.log(string.Format("路径不能查找到 {0}", path)); Ctx.m_instance.m_resLoadMgr.unload(path, onLoadEventHandle); } }
protected void onLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_logSys.log(string.Format("更新下载文件成功 {0}", (dispObj as DataResItem).path)); m_loadedPath.Add((dispObj as DataResItem).path); m_loadingPath.Remove((dispObj as DataResItem).path); if (m_loadingPath.Count == 0) { onUpdateEnd(); } } else if (res.refCountResLoadResultNotify.resLoadState.hasFailed()) { Ctx.m_instance.m_logSys.log(string.Format("更新下载文件失败 {0}", (dispObj as DataResItem).path)); m_failedPath.Add((dispObj as DataResItem).path); m_loadingPath.Remove((dispObj as DataResItem).path); if (m_loadingPath.Count == 0) { onUpdateEnd(); } } }
public void onLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath()); if (m_path2SoundDic.ContainsKey(res.GetPath())) // 如果有,说明还没被停止 { if (m_path2SoundDic[res.GetPath()].m_soundResType == SoundResType.eSRT_Prefab) { m_path2SoundDic[res.GetPath()].setResObj(res.InstantiateObject(res.GetPath())); } else { m_path2SoundDic[res.GetPath()].setResObj(res.getObject(res.GetPath())); } } // 播放音乐 play(res.GetPath()); } else if (res.refCountResLoadResultNotify.resLoadState.hasFailed()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath()); delSoundItem(m_path2SoundDic[res.GetPath()]); } // 卸载数据 Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle); }
public void onLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath()); byte[] textAsset = (res as DataResItem).getBytes(); if (textAsset != null) { loadFormText(System.Text.Encoding.UTF8.GetString(textAsset), m_path2PakDic); } // 卸载 Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle); if (m_pakCfgLoadDisp != null) { m_pakCfgLoadDisp(); } } else if (res.refCountResLoadResultNotify.resLoadState.hasFailed()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath()); // 卸载 Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle); if (m_pakCfgLoadDisp != null) { m_pakCfgLoadDisp(); } } }
// 加载一个表完成 protected void onMiniLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { byte[] textAsset = (res as DataResItem).getBytes(); if (textAsset != null) { // Lzma 解压缩 //byte[] outBytes = null; //uint outLen = 0; //MLzma.DecompressStrLZMA(textAsset, (uint)textAsset.Length, ref outBytes, ref outLen); loadFormText(System.Text.Encoding.UTF8.GetString(textAsset), m_miniPath2HashDic); } // 卸载 Ctx.m_instance.m_resLoadMgr.unload(MINIFILENAME, onMiniLoadEventHandle); m_miniLoadedDisp(); } else if (res.refCountResLoadResultNotify.resLoadState.hasFailed()) { // 卸载 Ctx.m_instance.m_resLoadMgr.unload(MINIFILENAME, onMiniLoadEventHandle); m_miniFailedDisp(); } }
public void onModuleFailed(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath()); Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoginLoadEventHandle); }
public static void onFailed(IDispatchObject dispObj, Action <IDispatchObject> loadEventHandle) { ResItem res = dispObj as ResItem; Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath()); // 卸载资源 Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), loadEventHandle); }
protected void onSceneCfgLoadded(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; m_sceneParse.sceneCfg = m_scene.sceneCfg; string text = res.getText(m_scene.file); m_sceneParse.parse(text); }
public void resetDefault() // 将数据清空,有时候上一次调用的时候的参数 m_loaded 还在,结果被认为是这一次的回调了 { m_loadEventHandle = null; m_version = ""; m_extName = "prefab"; m_origPath = ""; m_loadRes = null; m_loadInsRes = null; }
public void copyFrom(ResItem rhv) { m_resPackType = rhv.m_resPackType; m_resLoadType = rhv.m_resLoadType; m_path = rhv.m_path; m_pathNoExt = rhv.m_pathNoExt; m_extName = rhv.m_extName; m_resNeedCoroutine = rhv.m_resNeedCoroutine; m_refCountResLoadResultNotify.copyFrom(rhv.refCountResLoadResultNotify); }
protected void onPakResLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { initByPakRes(); } else if (res.refCountResLoadResultNotify.resLoadState.hasFailed()) { refCountResLoadResultNotify.loadResEventDispatch.dispatchEvent(this); } }
protected ResItem findResFormPool(ResPackType type) { m_retResItem = null; foreach (ResItem item in m_LoadData.m_noUsedResItem) { if (item.resPackType == type) { m_retResItem = item; m_LoadData.m_noUsedResItem.Remove(m_retResItem); break; } } return(m_retResItem); }
public void onLoginLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_layerMgr.m_path2Go[ModulePath.LOGINMN] = res.InstantiateObject(m_type2ItemDic[ModuleID.LOGINMN].m_path); Ctx.m_instance.m_layerMgr.m_path2Go[ModulePath.LOGINMN].name = ModuleName.LOGINMN; Ctx.m_instance.m_layerMgr.m_path2Go[ModulePath.LOGINMN].transform.parent = Ctx.m_instance.m_layerMgr.m_path2Go[NotDestroyPath.ND_CV_Root].transform; // 立马卸载这个资源 Ctx.m_instance.m_resLoadMgr.unload(m_type2ItemDic[ModuleID.LOGINMN].m_path, onLoginLoadEventHandle); } else if (res.refCountResLoadResultNotify.resLoadState.hasFailed()) { onModuleFailed(dispObj); } }
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); }
public void onAutoUpdateLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath()); Ctx.m_instance.m_layerMgr.m_path2Go[ModulePath.AUTOUPDATEMN] = res.InstantiateObject(m_type2ItemDic[ModuleID.AUTOUPDATEMN].m_path); Ctx.m_instance.m_layerMgr.m_path2Go[ModulePath.AUTOUPDATEMN].name = ModuleName.AUTOUPDATEMN; Ctx.m_instance.m_layerMgr.m_path2Go[ModulePath.AUTOUPDATEMN].transform.parent = Ctx.m_instance.m_layerMgr.m_path2Go[NotDestroyPath.ND_CV_Root].transform; // 立马卸载这个资源 Ctx.m_instance.m_resLoadMgr.unload(m_type2ItemDic[ModuleID.AUTOUPDATEMN].m_path, onAutoUpdateLoadEventHandle); } else if (res.refCountResLoadResultNotify.resLoadState.hasFailed()) { onModuleFailed(dispObj); } }
// 加载一个表完成 public void onLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; //Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath()); // 这行执行的时候 m_isLoaded 设置加载标志,但是 m_nodeList 还没有初始化 Ctx.m_instance.m_logSys.log("local xml loaded"); string text = res.getText(m_ID2FileName[m_langID].m_filePath); if (text != null) { SecurityParser SP = new SecurityParser(); SP.LoadXml(text); SecurityElement SE = SP.ToXml(); m_nodeList = SE.Children; } // 卸载资源 Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle); }
// 加载一个表完成 public void onLoadEventHandle(IDispatchObject dispObj) { m_res = dispObj as ResItem; if (m_res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, m_res.GetPath()); string text = m_res.getText(""); if (text != null) { m_id2CfgDic[getXmlCfgIDByPath(m_res.GetPath())].parseXml(text); } } else if (m_res.refCountResLoadResultNotify.resLoadState.hasFailed()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, m_res.GetPath()); } Ctx.m_instance.m_resLoadMgr.unload(m_res.GetPath(), onLoadEventHandle); }
// 加载一个表完成 public void onLoadEventHandle(IDispatchObject dispObj) { ResItem res = dispObj as ResItem; if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, res.GetPath()); string text = res.getText(""); if (text != null) { string[] lineSplitStr = { "\r\n" }; m_nameList = text.Split(lineSplitStr, StringSplitOptions.RemoveEmptyEntries); } } else if (res.refCountResLoadResultNotify.resLoadState.hasFailed()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, res.GetPath()); } // 卸载资源 Ctx.m_instance.m_resLoadMgr.unload(res.GetPath(), onLoadEventHandle); }
override protected void initImpl(ResItem res) { m_texture = res.getObject(res.getPrefabName()) as Texture; base.initImpl(res); }
override protected void initImpl(ResItem res) { m_controller = res.getObject(res.getPrefabName()) as SOAnimatorController; base.initImpl(res); }
protected ResItem findResFormPool(ResPackType type) { m_retResItem = null; foreach (ResItem item in m_LoadData.m_noUsedResItem) { if (item.resPackType == type) { m_retResItem = item; m_LoadData.m_noUsedResItem.Remove(m_retResItem); break; } } return m_retResItem; }
override public void failed(ResItem res) { failedImage(); unload(); }
override protected void initImpl(ResItem res) { // 获取资源单独保存 m_bytes = (res.getObject(res.getPrefabName()) as TextAsset).bytes; base.initImpl(res); }
protected void loadWithNotResCreatedAndNotLoad(LoadParam param) { ResItem resItem = createResItem(param); loadWithResCreatedAndNotLoad(param, resItem); }
override protected void initImpl(ResItem res) { m_go = res.getObject(res.getPrefabName()) as GameObject; base.initImpl(res); }
override protected void initImpl(ResItem res) { // 获取资源单独保存 m_mat = res.getObject(res.getPrefabName()) as Material; base.initImpl(res); }
override public void failed(ResItem res) { base.failed(res); }
public ResItem createResItem(LoadParam param) { ResItem resItem = findResFormPool(param.m_resPackType); if (ResPackType.eLevelType == param.m_resPackType) { if (resItem == null) { resItem = new LevelResItem(); } (resItem as LevelResItem).levelName = param.lvlName; } else if (ResPackType.eBundleType == param.m_resPackType) { if (resItem == null) { resItem = new BundleResItem(); } } else if (ResPackType.eResourcesType == param.m_resPackType) { if (resItem == null) { resItem = new PrefabResItem(); } (resItem as PrefabResItem).prefabName = param.prefabName; } else if (ResPackType.eDataType == param.m_resPackType) { if (resItem == null) { resItem = new DataResItem(); } } else if (ResPackType.eUnPakType == param.m_resPackType) { if (resItem == null) { resItem = new ABUnPakComFileResItem(); } } else if (ResPackType.eUnPakLevelType == param.m_resPackType) { if (resItem == null) { resItem = new ABUnPakLevelFileResItem(); } (resItem as ABUnPakLevelFileResItem).levelName = param.lvlName; } else if (ResPackType.ePakType == param.m_resPackType) { if (resItem == null) { resItem = new ABPakComFileResItem(); } } else if (ResPackType.ePakLevelType == param.m_resPackType) { if (resItem == null) { resItem = new ABPakLevelFileResItem(); } (resItem as ABPakLevelFileResItem).levelName = param.lvlName; (resItem as ABPakLevelFileResItem).m_origPath = param.m_origPath; } //else if (ResPackType.ePakMemType == param.m_resPackType) //{ // if (resitem == null) // { // resitem = new ABMemUnPakComFileResItem(); // } //} //else if (ResPackType.ePakMemLevelType == param.m_resPackType) //{ // if (resitem == null) // { // resitem = new ABMemUnPakLevelFileResItem(); // } // (resitem as ABMemUnPakLevelFileResItem).levelName = param.lvlName; //} resItem.refCountResLoadResultNotify.refCount.incRef(); resItem.resNeedCoroutine = param.m_resNeedCoroutine; resItem.resPackType = param.m_resPackType; resItem.resLoadType = param.m_resLoadType; resItem.path = param.m_path; resItem.pathNoExt = param.m_pathNoExt; resItem.extName = param.extName; if (param.m_loadEventHandle != null) { resItem.refCountResLoadResultNotify.loadResEventDispatch.addEventHandle(param.m_loadEventHandle); } return(resItem); }