示例#1
0
        public override void ClearAllResources()
        {
            if (!m_IsAppQuit)
            {
                var mgr = BaseResLoaderAsyncMgr.GetInstance();
                if (mgr != null)
                {
                    mgr.RemoveListener(this);
                }

                // 回池
                if (m_LoadingList != null)
                {
                    var node = m_LoadingList.First;
                    while (node != null)
                    {
                        var next = node.Next;
                        if (node.Value != null)
                        {
                            node.Value.Dispose();
                        }
                        node = next;
                    }

                    m_LoadingList.Clear();
                }
            }

            base.ClearAllResources();
        }
示例#2
0
        public bool LoadMainTextureAsync(string fileName, MeshRenderer renderer, bool isMatInst = false, int loadPriority = 0)
        {
            if (renderer == null)
            {
                return(false);
            }

            var mgr = BaseResLoaderAsyncMgr.GetInstance();

            if (mgr != null)
            {
                ulong id;
                int   rk = ReMake(fileName, renderer, BaseResLoaderAsyncType.MeshRenderMainTexture, isMatInst, out id, _cMainTex);
                if (rk < 0)
                {
                    return(false);
                }
                if (rk == 0)
                {
                    return(true);
                }

                return(mgr.LoadTextureAsync(fileName, this, id, loadPriority));
            }
            return(false);
        }
示例#3
0
        public bool LoadAniControllerAsync(string fileName, Animator obj, int loadPriority = 0)
        {
            if (obj == null)
            {
                return(false);
            }
            var mgr = BaseResLoaderAsyncMgr.GetInstance();

            if (mgr != null)
            {
                ulong id;
                int   rk = ReMake(fileName, obj, BaseResLoaderAsyncType.AnimatorController, false, out id);
                if (rk < 0)
                {
                    return(false);
                }
                if (rk == 0)
                {
                    return(true);
                }

                return(mgr.LoadAniControllerAsync(fileName, this, id, loadPriority));
            }

            return(false);
        }
示例#4
0
        protected virtual void Awake()
        {
            m_UUID = ++m_GlobalUUID;
            var mgr = BaseResLoaderAsyncMgr.GetInstance();

            if (mgr != null)
            {
                mgr.RegListener(this);
            }
        }
示例#5
0
        public bool LoadMaterialAsync(string fileName, MeshRenderer renderer, int loadPriority = 0)
        {
            if (renderer == null)
            {
                return(false);
            }

            var mgr = BaseResLoaderAsyncMgr.GetInstance();

            if (mgr != null)
            {
                Material target;
                if (ExitsResKeyTag <Material> (renderer, fileName, out target))
                {
                    if (renderer.sharedMaterial == null)
                    {
                        renderer.sharedMaterial = target;
                        ClearInstanceMaterialMap(renderer);
                    }
                    return(true);
                }

                ulong id;
                int   rk = ReMake(fileName, renderer, BaseResLoaderAsyncType.MeshRenderMaterial, false, out id);
                if (rk < 0)
                {
                    return(false);
                }
                if (rk == 0)
                {
                    return(true);
                }

                return(mgr.LoadMaterialAsync(fileName, this, id, loadPriority));
            }
            return(false);
        }