Ejemplo n.º 1
0
        public void RemoveClip(AudioClip _clip)
        {
            string key = _clip.name;

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

            AudioFactoryUnit unit = dic[key];

            unit.Dispose();

            dic.Remove(key);
        }
Ejemplo n.º 2
0
        public void Dispose()
        {
            Dictionary <string, AudioFactoryUnit> tmpDic = new Dictionary <string, AudioFactoryUnit>();

            foreach (KeyValuePair <String, AudioFactoryUnit> pair in dic)
            {
                AudioFactoryUnit unit = pair.Value;

                if (!unit.willDispose)
                {
                    tmpDic.Add(pair.Key, unit);
                }
            }

            dic = tmpDic;
        }
Ejemplo n.º 3
0
        public AudioClip GetClip(string _name, Action <AudioClip> _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));
        }
Ejemplo n.º 4
0
        public void Dispose(bool _force)
        {
            List <string> delKeyList = new List <string> ();

            foreach (KeyValuePair <String, AudioFactoryUnit> pair in dic)
            {
                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]);
            }
        }