コード例 #1
0
        //执行加载单个资源
        private void AddSingleTask(ReferInfo info, Action callBack = null, bool isShowWaitcircle = true)
        {
            AssetTaskNodeBase curNode = AssetTaskNodeBase.CreatLoadNode(_resMgr, info.m_isSingleAsset);

            curNode.AddNode(info, isShowWaitcircle, callBack);
            _listTaskObj.Add(curNode);
        }
コード例 #2
0
        /// <summary>
        /// 加载资源
        /// </summary>
        /// <param name="call"></param>
        /// <param name="isloadFromResource"></param>
        public override void LoadRefer(Action call, bool isloadFromResource = false)
        {
            if (_referList.Count != 0)
            {
                ReferInfo refer = null;
                for (int i = 0; i < _referList.Count; i++)
                {
                    refer = _referList[i];
                    if (refer != null)
                    {
                        if (!_referDic.ContainsKey(refer.m_resName))
                        {
                            _referDic.Add(refer.m_resName, new List <ReferInfo>());
                        }

                        _referDic[refer.m_resName].Add(refer);
                    }
                }
                LoadResMgr.Instance.AddGroupTask(_referList, call, false);
            }
            else
            {
                call?.Invoke();
            }
        }
コード例 #3
0
        public virtual void AddRefer(ResType type, string referStr, AssetType assetType)
        {
            ReferInfo refer = null;

            if (!string.IsNullOrEmpty(referStr))
            {
                refer = new ReferInfo(type, referStr, assetType);
                _referList.Add(refer);
            }
        }
コード例 #4
0
        public override void AddNode <T>(T info, bool isShowWaitcircle = true, Action callBack = null)
        {
            base.AddNode(info, isShowWaitcircle, callBack);

            this.m_info = info as ReferInfo;
            this._isRealShowWaitcircle = isShowWaitcircle;
            this.m_CallBack            = callBack;

            _mgr.LoadAssetAsync <Object>(m_info.m_loadType, m_info.m_resName, m_info.m_assetType, (obj) =>
            {
                this.m_Data       = obj;
                m_IsLoadCompleted = true;
            });
        }
コード例 #5
0
        /// <summary>
        /// 释放资源
        /// </summary>
        public override void ReleaseRefer()
        {
            if (_referList.Count != 0)
            {
                ReferInfo refer = null;
                for (int i = 0; i < _referList.Count; i++)
                {
                    refer = _referList[i];
                    _referDic[refer.m_resName].Remove(refer);

                    if (_referDic[refer.m_resName].Count == 0)
                    {
                        LoadResMgr.Instance.UnloadAsset(ResType.UI, refer.m_resName);
                    }
                }
            }
        }
コード例 #6
0
 /// <summary>
 /// 预加载单个资源到内存
 /// </summary>
 public void PreLoadRes <T>(ResType loadType, string name, AssetType assetType)
 {
     AddSingleTask(ReferInfo.Create(loadType, name, assetType));
 }