public void Dispose(bool _force) { List <string> delKeyList = new List <string> (); Dictionary <string, AudioFactoryUnit> .Enumerator enumerator = dic.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair <string, AudioFactoryUnit> pair = enumerator.Current; AudioFactoryUnit unit = pair.Value; if (_force || unit.willDispose) { unit.Dispose(); delKeyList.Add(pair.Key); } } for (int i = 0; i < delKeyList.Count; i++) { dic.Remove(delKeyList[i]); } }
public AudioClip GetClip(string _name, Action <AudioClip> _callBack, bool _willDispose) { AudioFactoryUnit unit; if (!dic.TryGetValue(_name, out unit)) { unit = new AudioFactoryUnit(_name); dic.Add(_name, unit); } return(unit.GetClip(_callBack, _willDispose)); }
public void RemoveClip(AudioClip _clip) { string key = _clip.name; if (!dic.ContainsKey(key)) { return; } AudioFactoryUnit unit = dic[key]; unit.Dispose(); dic.Remove(key); }
public AudioClip GetClip(string _name, Action <AudioClip, string> _callBack, bool _willDispose) { AudioFactoryUnit unit; if (!dic.ContainsKey(_name)) { unit = new AudioFactoryUnit(_name); dic.Add(_name, unit); } else { unit = dic [_name]; } return(unit.GetClip(_callBack, _willDispose)); }