Пример #1
0
 private void _dependenciesLoaded(ResData _data, UnityEngine.Object _obj)
 {
     m_loaded_dependencies_count++;
     if (m_loaded_dependencies_count == m_res_config.Dependencies.Count)
     {
         _loadSelfBundle(m_bundle_async);
     }
 }
Пример #2
0
 public void LoadAssetAsync(ResData _resouce, String _asset_name)
 {
     if (_isWaiting(_resouce, _asset_name) || _isLoading(_resouce, _asset_name))
     {
         return;
     }
     m_waiting_asset.Enqueue(new LoadRequireData()
     {
         Resource = _resouce, AssetName = _asset_name
     });
 }
Пример #3
0
 private bool _isLoading(ResData _resouce, String _asset_name)
 {
     foreach (LoadRequireData load_require_data in m_loading_asset)
     {
         if (load_require_data.Resource == _resouce && _asset_name == load_require_data.AssetName)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #4
0
 private void _onBundleLoaded(ResData _data, UnityEngine.Object _object)
 {
     Debug.LogFormat("bundle: {0}解压完成", _data.GetBundleName());
     _data.Unload();
     m_compress_count--;
     if (m_compress_count == 0)
     {
         UIManager.Instance.HideUI("ui_loading_panel");
         m_compress_res.Clear();
         m_complete_action();
     }
 }
Пример #5
0
        private void _loadAssetBundleAndAsset(string _bundle_name, string _asset_name, Action <ResData, UnityEngine.Object> _action, bool async = true)
        {
            ResConfig config = GetResConfig(_bundle_name);

            if (config == null)
            {
                return;
            }
            ResData data = GetResData(config, true);

            data.LoadAssetBundle(_asset_name, _action, async);
        }
Пример #6
0
 private void _onBundleListLoaded(ResData _data, UnityEngine.Object _obj)
 {
     if (m_cur_bundle_list.Contains(_data.GetBundleName()))
     {
         m_cur_bundle_list.Remove(_data.GetBundleName());
         if (m_cur_bundle_list.Count == 0)
         {
             m_cur_bundle_list = null;
             m_cur_bundle_list_action();
         }
     }
 }
Пример #7
0
        public void LoadAssetSync(ResData _resouce, String _asset_name)
        {
            AssetBundle bundle = _resouce.GetBundle();

            if (bundle == null)
            {
                Debug.LogErrorFormat("Bundle: {0}为空 不能加载asset: {1}", _resouce.GetResConfig().BundleName, _asset_name);
                return;
            }
            Debug.LogFormat("开始同步加载asset: {0}", _asset_name);
            UnityEngine.Object asset = bundle.LoadAsset(_asset_name);
            _resouce.OnAssetLoaded(_asset_name, asset);
        }
Пример #8
0
 public ResData GetResData(ResConfig _config, bool _create = false)
 {
     if (m_res_datas.ContainsKey(_config.BundleName))
     {
         return(m_res_datas[_config.BundleName]);
     }
     if (_create)
     {
         ResData data = new ResData(_config);
         m_res_datas[_config.BundleName] = data;
         return(data);
     }
     return(null);
 }
Пример #9
0
        private IEnumerator _readyUnload()
        {
            m_state = ResDataState.ReadyUnload;
            yield return(new WaitForEndOfFrame());

            if (m_reference_count > 0)
            {
                m_state = ResDataState.BundleLoaded;
                yield break;
            }
            Debug.LogFormat("bundle:{0}开始卸载", m_res_config.BundleName);
            for (int i = 0; i < m_res_config.Dependencies.Count; i++)
            {
                ResData data = ResManager.Instance.GetResData(m_res_config.Dependencies[i]);
                if (data == null)
                {
                    continue;
                }
                data.Unload();
            }
            UnInit();
        }