Пример #1
0
        private void DoLoadAsync()
        {
            var nextNode = m_WaitLoadList.First;
            LinkedListNode <IRes> currentNode = null;

            while (nextNode != null)
            {
                currentNode = nextNode;
                IRes res = currentNode.Value;
                nextNode = currentNode.Next;
                if (res.IsDependResLoadFinish())
                {
                    m_WaitLoadList.Remove(currentNode);

                    if (res.resState != eResState.kReady)
                    {
                        res.RegisteResListener(OnResLoadFinish);
                        res.LoadAsync();
                    }
                    else
                    {
                        --m_LoadingCount;
                    }
                }
            }
        }
Пример #2
0
        private void RequestUpdateImage()
        {
            if (m_Res != null)
            {
                m_Res.UnRegisteResListener(OnResLoadFinish);
                m_Res.SubRef();
                m_Res = null;
            }

            if (m_Image != null)
            {
                m_Image.enabled = false;
            }

            if (string.IsNullOrEmpty(m_Url))
            {
                return;
            }

            m_Res = ResMgr.Instance.GetRes(string.Format("NetImage:{0}", m_Url), true);
            m_Res.AddRef();

            m_Res.RegisteResListener(OnResLoadFinish);
            m_Res.LoadAsync();
        }
Пример #3
0
        private void RequestUpdateImage()
        {
            if (m_PreRes != null)
            {
                m_PreRes.UnRegisteResListener(OnResLoadFinish);
                m_PreRes.SubRef();
                m_PreRes = null;
            }

            if (m_Res != null)
            {
                if (!m_HideWhenLoading)
                {
                    m_PreRes = m_Res;
                }
            }

            if (m_Image != null && m_PreRes == null)
            {
                m_Image.enabled = false;
            }

            if (string.IsNullOrEmpty(m_Url))
            {
                return;
            }

            m_Res = ResMgr.S.GetRes(string.Format("{0}{1}", m_PrefixKey, m_Url), true);
            m_Res.AddRef();

            m_Res.RegisteResListener(OnResLoadFinish);
            m_Res.LoadAsync();
        }
Пример #4
0
        // 异步加载unity中的Asset
        public async void LoadAsync <T>(string path, string name, Action <UnityEngine.Object> action) where T : UnityEngine.Object
        {
            IRes res = await ResManager.Instance.LoadAsync(path, name, action);

            if (null != res)
            {
                res.LoadFinishEvent += action;
                res.LoadAsync <T>(name);
            }
        }
Пример #5
0
        private void DoLoadAsync()
        {
            if (mLoadingCount == 0)
            {
                //ResMgr.Instance.timeDebugger.End();
                //ResMgr.Instance.timeDebugger.Dump(-1);
                if (mListener != null)
                {
                    Action callback = mListener;
                    mListener = null;
                    callback();
                }

                return;
            }

            var nextNode = mWaitLoadList.First;
            LinkedListNode <IRes> currentNode = null;

            while (nextNode != null)
            {
                currentNode = nextNode;
                IRes res = currentNode.Value;
                nextNode = currentNode.Next;
                if (res.IsDependResLoadFinish())
                {
                    mWaitLoadList.Remove(currentNode);

                    if (res.State != ResState.Ready)
                    {
                        res.RegisteResListener(OnResLoadFinish);
                        res.LoadAsync();
                    }
                    else
                    {
                        --mLoadingCount;
                    }
                }
            }
        }
Пример #6
0
        private void DoLoadAsync()
        {
            if (m_LoadingCount == 0)
            {
                if (m_Listener != null)
                {
                    Action callback = m_Listener;
                    m_Listener = null;
                    callback();
                }

                return;
            }

            var nextNode = m_WaitLoadList.First;
            LinkedListNode <IRes> currentNode = null;

            while (nextNode != null)
            {
                currentNode = nextNode;
                IRes res = currentNode.Value;
                nextNode = currentNode.Next;
                if (res.IsDependResLoadFinish())
                {
                    m_WaitLoadList.Remove(currentNode);

                    if (res.State != ResState.Ready)
                    {
                        res.RegisteOnResLoadDoneEvent(OnResLoadFinish);
                        res.LoadAsync();
                    }
                    else
                    {
                        --m_LoadingCount;
                    }
                }
            }
        }