override public void dispose() { if (m_texRes != null) { Ctx.m_instance.m_texMgr.unload(m_texRes.GetPath(), null); m_texRes = null; } base.dispose(); }
public void loadTex() { bool needLoad = true; if (m_texRes != null) { if (m_texRes.GetPath() != m_texPath) { unloadTex(); } else { needLoad = false; } } if (needLoad) { if (!string.IsNullOrEmpty(m_texPath)) { LoadParam param; param = Ctx.m_instance.m_poolSys.newObject <LoadParam>(); param.m_path = m_texPath; param.m_loadEventHandle = onTexLoadEventHandle; Ctx.m_instance.m_texMgr.load <TextureRes>(param); Ctx.m_instance.m_poolSys.deleteObj(param); } } }
// 资源改变更新图像 protected void updateImage() { if (m_bNeedUpdateImage) { if (m_texRes != null) { Ctx.m_instance.m_texMgr.unload(m_texRes.GetPath(), null); m_texRes = null; } m_texRes = Ctx.m_instance.m_texMgr.getAndSyncLoad <TextureRes>(m_texPath); m_texRes.setImageTex(m_image); } else if (m_bImageGoChange) { if (m_texRes == null) { m_texRes = Ctx.m_instance.m_texMgr.getAndSyncLoad <TextureRes>(m_texPath); } m_texRes.setImageTex(m_image); } m_bImageGoChange = false; m_bNeedUpdateImage = false; }