コード例 #1
0
        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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public virtual void unload()
 {
     if (m_selfGo != null)
     {
         UtilApi.Destroy(m_selfGo);
         m_selfGo = null;
         Ctx.m_instance.m_modelMgr.unload(m_path, null);
         m_res = null;
     }
 }
コード例 #4
0
 public virtual void unload()
 {
     if (m_selfGo != null)
     {
         UtilApi.Destroy(m_selfGo);
         m_selfGo = null;
         Ctx.m_instance.m_modelMgr.unload(m_path, null);
         m_res = null;
     }
 }
コード例 #5
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;
     }
 }
コード例 #6
0
ファイル: SkinModel.cs プロジェクト: zhutaorun/unitygame
 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;
     }
 }
コード例 #7
0
        public void loadSubModel()
        {
            if (m_bNeedReloadModel)
            {
                if (m_modelRes != null)
                {
                    Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), onSubModelLoaded);
                    m_modelRes = null;
                }

                m_modelRes         = Ctx.m_instance.m_modelMgr.getAndAsyncLoad <ModelRes>(m_modelPath, onSubModelLoaded) as ModelRes;
                m_bNeedReloadModel = false;
            }
        }
コード例 #8
0
        // 特效对应的精灵 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));
            }
        }
コード例 #9
0
 virtual protected void addUIAndBox()
 {
     if (m_uiPrefabRes == null)
     {
         m_uiPrefabRes = Ctx.m_instance.m_uiPrefabMgr.getAndSyncLoad <UIPrefabRes>(m_uiPrefabPath);
         GameObject _go = m_uiPrefabRes.InstantiateObject(m_uiPrefabPath);
         _go.name = "UIRoot";
         UtilApi.SetParent(_go, gameObject(), false);
     }
     if (m_boxModel == null)
     {
         m_boxModel = Ctx.m_instance.m_modelMgr.getAndSyncLoad <ModelRes>(m_boxModelPath);
         UtilApi.copyBoxCollider(m_boxModel.getObject() as GameObject, gameObject());
     }
 }
コード例 #10
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;
            }
        }
コード例 #11
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;
            }
        }
コード例 #12
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();
        }
コード例 #13
0
        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;
        }
コード例 #14
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;
            }
        }
コード例 #15
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;
            }
        }
コード例 #16
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;
            }
        }
コード例 #17
0
ファイル: AuxDynModel.cs プロジェクト: zhutaorun/unitygame
        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;
            }

            m_modelInsDisp.clearEventHandle();
            m_modelInsDisp = null;

            base.dispose();
        }
コード例 #18
0
ファイル: MeshMgr.cs プロジェクト: windlex/Jx2U
    public bool GetMesh(meshName, out Mesh mesh, out root, out bones)
    {
        ModelRes res;

        if (!ResMap.TryGetValue(meshName, out res))
        {
            res = new ModelRes();
            bool ret = Utils.LoadMesh(meshName, out res.mesh, out res.bones, out root);
            if (!ret)
            {
                return(false);
            }
            ResMap.Add(meshName, res);
        }
        mesh  = res.mesh;
        bones = new Bones(res.bones);
        root  = new Transform(res.root);
        return(true);
    }
コード例 #19
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());
            }
        }
コード例 #20
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());
            }
        }
コード例 #21
0
        // 特效对应的精灵 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));
            }
        }
コード例 #22
0
 virtual protected void addUIAndBox()
 {
     if (m_uiPrefabRes == null)
     {
         m_uiPrefabRes = Ctx.m_instance.m_uiPrefabMgr.getAndSyncLoad<UIPrefabRes>(m_uiPrefabPath);
         GameObject _go = m_uiPrefabRes.InstantiateObject(m_uiPrefabPath);
         _go.name = "UIRoot";
         UtilApi.SetParent(_go, gameObject(), false);
     }
     if (m_boxModel == null)
     {
         m_boxModel = Ctx.m_instance.m_modelMgr.getAndSyncLoad<ModelRes>(m_boxModelPath);
         UtilApi.copyBoxCollider(m_boxModel.getObject() as GameObject, gameObject());
     }
 }
コード例 #23
0
ファイル: SkinModel.cs プロジェクト: zhutaorun/unitygame
        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;
            }
        }
コード例 #24
0
ファイル: SkinModel.cs プロジェクト: zhutaorun/unitygame
        public void loadSubModel()
        {
            if (m_bNeedReloadModel)
            {
                if(m_modelRes != null)
                {
                    Ctx.m_instance.m_modelMgr.unload(m_modelRes.GetPath(), onSubModelLoaded);
                    m_modelRes = null;
                }

                m_modelRes = Ctx.m_instance.m_modelMgr.getAndAsyncLoad<ModelRes>(m_modelPath, onSubModelLoaded) as ModelRes;
                m_bNeedReloadModel = false;
            }
        }
コード例 #25
0
ファイル: AuxDynModel.cs プロジェクト: zhutaorun/unitygame
        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;
        }