示例#1
0
        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]);
            }
        }
示例#2
0
        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));
        }
示例#3
0
        public void RemoveClip(AudioClip _clip)
        {
            string key = _clip.name;

            if (!dic.ContainsKey(key))
            {
                return;
            }

            AudioFactoryUnit unit = dic[key];

            unit.Dispose();

            dic.Remove(key);
        }
示例#4
0
        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));
        }