コード例 #1
0
 public void dispose()
 {
     if (m_modelRes != null)
     {
         Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), onSubModelLoaded);
         m_modelRes = null;
     }
     if (m_skinRes != null)
     {
         Ctx.m_instance.m_modelMgr.unload(m_skinRes.GetPath(), onSubModelLoaded);
         m_skinRes = null;
     }
 }
コード例 #2
0
        public virtual void load()
        {
            bool needLoad = true;

            if (m_res != null)
            {
                if (m_res.GetPath() != m_path)
                {
                    unload();
                }
                else
                {
                    needLoad = false;
                }
            }
            if (needLoad)
            {
                if (!string.IsNullOrEmpty(m_path))
                {
                    LoadParam param;
                    param                   = Ctx.m_instance.m_poolSys.newObject <LoadParam>();
                    param.m_path            = m_path;
                    param.m_loadEventHandle = onLoadEventHandle;
                    Ctx.m_instance.m_modelMgr.load <ModelRes>(param);
                    Ctx.m_instance.m_poolSys.deleteObj(param);
                }
            }
        }
コード例 #3
0
        override public void dispose()
        {
            if (m_selfGo != null)
            {
                UtilApi.Destroy(m_selfGo);
                m_selfGo = null;
            }

            if (m_modelRes != null)
            {
                Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), null);
                m_modelRes = null;
            }

            base.dispose();
        }
コード例 #4
0
        protected void clearEffectRes()
        {
            if (m_selfGo != null)        // 场景中的特效需要直接释放这个 GameObject
            {
                UtilApi.Destroy(m_selfGo);
                m_selfGo       = null;
                m_spriteRender = null;
            }

            if (m_effectPrefab != null)
            {
                Ctx.m_instance.m_modelMgr.unload(m_effectPrefab.GetPath(), null);
                m_effectPrefab = null;
            }
        }
コード例 #5
0
        public void onSubModelLoaded(IDispatchObject dispObj)
        {
            ModelRes res = dispObj as ModelRes;

            Ctx.m_instance.m_logSys.logLoad(res);

            if (res.refCountResLoadResultNotify.resLoadState.hasSuccessLoaded())
            {
                if (m_skelRootGo != null)
                {
                    linkSkelModel();
                }
            }
            else if (res.refCountResLoadResultNotify.resLoadState.hasFailed())
            {
                Ctx.m_instance.m_modelMgr.unload(res.GetPath(), onSubModelLoaded);
                m_modelRes = null;
            }
        }
コード例 #6
0
        override public void dispose()
        {
            if (m_model != null)
            {
                m_model.dispose();
                m_model = null;
            }

            if (m_uiPrefabRes != null)
            {
                Ctx.m_instance.m_uiPrefabMgr.unload(m_uiPrefabRes.GetPath(), null);
                m_uiPrefabRes = null;
            }
            if (m_boxModel != null)
            {
                Ctx.m_instance.m_modelMgr.unload(m_boxModel.GetPath(), null);
                m_boxModel = null;
            }
        }
コード例 #7
0
        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());
            }
        }
コード例 #8
0
        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());
            }
        }