/// <summary> /// 释放webstrem(ab包),通过ResTag。 /// 比如统一清除战斗中的资源 /// </summary> /// <param name="tag"></param> public void RemoveAssetBundleByTag(ResTag tag, bool unloadUsedObjects = false) { if (LoadThreadManager.showDebug) { Log.info("ResDataManager::RemoveAssetBundleByTag 清除资源!ResTag " + tag.ToString()); } List <string> list = new List <string>(_dataList.Count); foreach (VOAssetInfo info in _dataList.Values) { if ((info.tag & tag) != ResTag.None) { list.Add(info.path); } } for (int i = 0; i < list.Count; i++) { string path = list[i]; if (path == null || path == "") { continue; } this.RemoveAssetBundle(path, true, unloadUsedObjects); } list.Clear(); list = null; }
/// <summary> /// 缓存AudioClip /// </summary> /// <param name="fileName"></param> /// <param name="clip"></param> /// <param name="tag"></param> public static void AddAudioClip(string fileName, AudioClip clip, ResTag tag) { if (!_audioDic.ContainsKey(fileName)) { _audioDic[fileName] = clip; string key = tag.ToString(); if (!_tag2SoundNameList.ContainsKey(key)) { _tag2SoundNameList[key] = new List <string>(); } _tag2SoundNameList[key].Add(fileName); } }
/// <summary> /// 移出音频缓存文件 /// </summary> /// <param name="tag"></param> public static void RemoveSounds(ResTag tag) { string key = tag.ToString(); if (!_tag2SoundNameList.ContainsKey(key)) { return; } List <string> list = _tag2SoundNameList[key]; for (var i = 0; i < list.Count; i++) { if (_audioDic.ContainsKey(list[i])) { _audioDic.Remove(list[i]); } } list.Clear(); _tag2SoundNameList.Remove(key); }
public void Dispose() { if (LoadThreadManager.showDebug) { Log.info("VOAssetInfo :: Dispose! " + path); } path = ""; tag = 0; if (this.www != null) { if (this.www.assetBundle != null) { this.www.assetBundle.Unload(false); } this.www.Dispose(); this.www = null; if (LoadThreadManager.showDebug) { Log.info("VOAssetInfo :: www Dispose! "); } } }
/// <summary> /// /// </summary> /// <param name="www"></param> /// <param name="path"></param> /// <param name="resTag"></param> public VOAssetInfo(WWW www, string path, ResTag resTag) { this.path = path; this.tag = resTag; this.www = www; }
public void AddTag(ResTag tag) { _tags.Add(tag); }
private void LoadSoundAssetBundle(string path, ResTag tag) { StResPath stPath = new StResPath(path, tag); ResLoadTool.Load <AudioClip>(stPath, OnSoundLoaded, null, OnSoundLoadError, stPath); }
/// <summary> /// 资源路径结构 /// </summary> /// <param name="path"></param> /// <param name="resTag"></param> /// <param name="version"></param> public StResPath(string path, ResTag resTag = ResTag.None, int version = 1) { this.path = path; this.version = version; this.tag = resTag; }