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); } }
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 }); }
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); }
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(); } }
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); }
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(); } } }
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); }
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); }
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(); }