public void LoadResourcesAsync(string _key, string _AssetsName, System.Action <string, object> _callback) { if (_AssetsName.Length == 0) { DLog.LogError("LoadResourcesBundleByRelativePathNameAsync -- _AssetsName 的长度不能为空"); } if (_callback == null) { DLog.LogError("LoadResourcesBundleByRelativePathNameAsync -- CallBack Fun can not be null"); return; } _AssetsName = BaseBundle.DeleteSuffixName(_AssetsName).ToLower(); if (mBundleList.Contains(_AssetsName)) { if (mBundleList[_AssetsName].Loaded) { if (mBundleList[_AssetsName].Asset == null) { DLog.LogError("ResourcesBundleAsync-erro in vector。文件载入失败,请检查文件名:" + _AssetsName); } mBundleList[_AssetsName].Retain(); _callback(_key, mBundleList[_AssetsName].Asset); } else { CreatTaskAndStart(_key, mBundleList[_AssetsName], _callback, true); ActiveLoader(true); } } else { LoadBundleAsync(new ResourcesBundleAsync(_AssetsName), _key, _callback, true); } }
static public void RemoveAsset(string _AssetsName) { if (IsDispose) { return; } Instance.mBundleList.Remove(BaseBundle.DeleteSuffixName(_AssetsName.ToLowerInvariant())); }
public BaseBundle this[string key] { get { return(mList[BaseBundle.DeleteSuffixName(key).ToLower()]); } set { mList[BaseBundle.DeleteSuffixName(key).ToLower()] = value; } }
public void ReleaseBundle(string _key) { _key = BaseBundle.DeleteSuffixName(_key).ToLower(); if (Contains(_key)) { this[_key].Release(); } else { DLog.LogError("BundleVector 尝试释放一个不存在的资源._key = " + _key); } }
private BaseBundle LoadAssetRetain(string _AssetsName) { if (_AssetsName == null || _AssetsName.Equals("")) { return(null); } _AssetsName = BaseBundle.DeleteSuffixName(_AssetsName).ToLower(); if (!mBundleList.Contains(_AssetsName)) { AssetsBundleHaveDependencie tbundle = new AssetsBundleHaveDependencie(_AssetsName, LoadAssetRetain); AddCache(tbundle); tbundle.Load(this); } return(mBundleList[_AssetsName]); }
public void Remove(string _key, bool _destory = true) { _key = BaseBundle.DeleteSuffixName(_key).ToLower(); if (!Contains(_key)) { return; } BaseBundle tbundle = this[_key]; tbundle.Parent = null; mList.Remove(BaseBundle.DeleteSuffixName(_key)); if (_destory) { tbundle.Destory(); } }
/// <summary> /// 载入Resources资源 /// </summary> /// <param name="_AssetsName">_curPathname 是相对于path/Date/下的路径 例如目录结构Assets/Resources/Date/ +_curPathname</param> /// <returns></returns> public Object LoadResources(string _AssetsName) { if (_AssetsName == null || _AssetsName.Equals("")) { return(null); } _AssetsName = BaseBundle.DeleteSuffixName(_AssetsName).ToLower(); if (mBundleList.Contains(_AssetsName)) { return((Object)mBundleList[_AssetsName].Retain()); } ResourcesBundle tbundle = new ResourcesBundle(_AssetsName); AddCache(tbundle); tbundle.Load(this); return((Object)tbundle.Retain()); }
static public bool LoadScene(string _scenename, string pGroupKey = null) { if (IsSceneLoading) { DLog.LogError("The Scene is Loading."); return(false); } _scenename = BaseBundle.DeleteSuffixName(_scenename); string tusname = _scenename.EndsWith(".unity") ? _scenename.Replace(".unity", "") : _scenename; if (SceneManager.GetActiveScene().name.Equals(tusname)) { return(false); } LoaderManager.LoadAsset(_scenename, pGroupKey); SceneManager.LoadScene(tusname, LoadSceneMode.Single); return(true); }
static public bool LoadSceneAsync(string _scenename, System.Action _FinishdCall, string pGroupKey = null) { if (IsSceneLoading) { DLog.LogError("The Scene is Loading."); return(false); } _scenename = BaseBundle.DeleteSuffixName(_scenename); mNowLoadingScene = _scenename.EndsWith(".unity") ? _scenename.Replace(".unity", "") : _scenename; if (SceneManager.GetActiveScene().name.Equals(mNowLoadingScene)) { return(false); } IsSceneLoading = true; mLoadSceneCall = _FinishdCall; LoaderManager.LoadAssetAsync(_scenename, _scenename, LoadedStartScene, pGroupKey); return(true); }
private BaseBundle LoadAssetAsyncRetain(string _key, string _AssetsName, System.Action <string, object> _callback, bool _retain) { if (_AssetsName.Length == 0) { DLog.LogError("LoadAssetsBundleByFullNameAsync -- _AssetsName 的长度不能为空"); } if (_callback == null) { DLog.LogError("LoadAssetsBundleByFullNameAsync -- CallBack Fun can not be null"); return(null); } _AssetsName = BaseBundle.DeleteSuffixName(_AssetsName).ToLower(); if (mBundleList.Contains(_AssetsName)) { if (mBundleList[_AssetsName].Loaded) { if (mBundleList[_AssetsName].Asset == null) { DLog.LogError("AssetsBundleAsyncFromFile-erro in vector。文件载入失败,请检查文件名:" + _AssetsName); } if (_retain) { mBundleList[_AssetsName].Retain(); } _callback(_key, mBundleList[_AssetsName].Asset); } else { CreatTaskAndStart(_key, mBundleList[_AssetsName], _callback, _retain); ActiveLoader(true); } } else { LoadBundleAsync(new AssetsBundleHaveDependencieAsync(_AssetsName, LoadAssetAsyncRetain), _key, _callback, _retain); } return(mBundleList[_AssetsName]); }
public bool Contains(string _key) { return(mList.ContainsKey(BaseBundle.DeleteSuffixName(_key).ToLower())); }