public void syncUpdateModel() { if (m_bNeedReloadModel) { if (m_modelRes != null) { Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), null); m_modelRes = null; } if (m_selfGo != null) { UtilApi.Destroy(m_selfGo); m_selfGo = null; } m_modelRes = Ctx.m_instance.m_modelMgr.getAndSyncLoad <ModelRes>(m_modelResPath); selfGo = m_modelRes.InstantiateObject(m_modelResPath); attach2Parent(); m_modelInsDisp.dispatchEvent(this); } m_bNeedReloadModel = false; }
public string m_path; // 目录 public virtual void onLoadEventHandle(IDispatchObject dispObj) { ModelRes res = dispObj as ModelRes; m_go = res.InstantiateObject(m_path); m_go.transform.parent = m_parentTran; UtilApi.normalPos(m_go.transform); }
public void linkSkelModel() { m_modelGo = m_modelRes.InstantiateObject(m_modelRes.GetPath()); UtilApi.SetParent(m_modelGo, m_skelRootGo); if (m_skinRes.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { UtilSkin.skinSkel(m_modelGo, m_skelRootGo, m_skinRes.boneArr); } }
// 特效对应的精灵 Prefab 改变 override public void onSpritePrefabChanged() { clearEffectRes(); string path = string.Format("{0}{1}", Ctx.m_instance.m_cfg.m_pathLst[(int)ResPathType.ePathSpriteAni], m_tableBody.m_aniPrefabName); m_effectPrefab = Ctx.m_instance.m_modelMgr.getAndSyncLoad <ModelRes>(path); selfGo = m_effectPrefab.InstantiateObject(path); if (m_selfGo == null) { Ctx.m_instance.m_logSys.log(string.Format("Load SpritePrefab Path = {0} Failed", path)); } }
public void updateModel() { if (m_bNeedReloadModel) { if (m_modelRes != null) { Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), null); m_modelRes = null; } if (m_selfGo != null) { UtilApi.Destroy(m_selfGo); m_selfGo = null; } LoadParam param; param = Ctx.m_instance.m_poolSys.newObject <LoadParam>(); param.m_path = m_resPath; // 这个需要立即加载 param.m_loadNeedCoroutine = false; param.m_resNeedCoroutine = false; m_modelRes = Ctx.m_instance.m_modelMgr.getAndLoad <ModelRes>(param); Ctx.m_instance.m_poolSys.deleteObj(param); m_selfGo = m_modelRes.InstantiateObject(m_resPath); if (m_bNeedPlaceHolderGo) { if (m_placeHolderGo == null) { m_placeHolderGo = new UnityEngine.GameObject(); UtilApi.SetParent(m_placeHolderGo, m_pntGo, false); } UtilApi.SetParent(m_selfGo, m_placeHolderGo, false); } else { UtilApi.SetParent(m_selfGo, m_pntGo, false); } } m_bNeedReloadModel = false; }
public virtual void onLoadEventHandle(IDispatchObject dispObj) { m_res = dispObj as ModelRes; if (m_res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded()) { Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem0, m_res.GetPath()); m_selfGo = m_res.InstantiateObject(m_path); m_selfGo.transform.SetParent(m_selfLocalGo.transform, false); // 不是使用 m_resLoadMgr.load 接口加载的资源,不要使用 m_resLoadMgr.unload 去卸载资源 // 卸载资源 //Ctx.m_instance.m_resLoadMgr.unload(m_res.GetPath()); } else if (m_res.refCountResLoadResultNotify.resLoadState.hasFailed()) { m_res = dispObj as ModelRes; Ctx.m_instance.m_logSys.debugLog_1(LangItemID.eItem1, m_res.GetPath()); // 卸载资源 //Ctx.m_instance.m_resLoadMgr.unload(m_res.GetPath()); } }
// 特效对应的精灵 Prefab 改变 override public void onSpritePrefabChanged() { clearEffectRes(); string path = string.Format("{0}{1}", Ctx.m_instance.m_cfg.m_pathLst[(int)ResPathType.ePathSpriteAni], m_tableBody.m_aniPrefabName); m_effectPrefab = Ctx.m_instance.m_modelMgr.getAndSyncLoad<ModelRes>(path); selfGo = m_effectPrefab.InstantiateObject(path); if(m_selfGo == null) { Ctx.m_instance.m_logSys.log(string.Format("Load SpritePrefab Path = {0} Failed", path)); } }
public void syncUpdateModel() { if (m_bNeedReloadModel) { if(m_modelRes != null) { Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), null); m_modelRes = null; } if(m_selfGo != null) { UtilApi.Destroy(m_selfGo); m_selfGo = null; } m_modelRes = Ctx.m_instance.m_modelMgr.getAndSyncLoad<ModelRes>(m_modelResPath); selfGo = m_modelRes.InstantiateObject(m_modelResPath); attach2Parent(); m_modelInsDisp.dispatchEvent(this); } m_bNeedReloadModel = false; }