Exemplo n.º 1
0
        private int FindIdlePort()
        {
            int index;

            for (index = 0; index < m_audios.Count; ++index)
            {
                if (!m_audios[index].audio.isPlaying)
                {
                    break;
                }
            }

            //如果找不到空闲的, 申请空间, 继续播放
            if (index == m_audios.Count)
            {
                AudioItem tmp = new AudioItem();
                tmp.audio = ObjectEX.AddComponent <AudioSource>(m_audioParent);
                if (tmp.audio != null)
                {
                    tmp.id   = 0;
                    tmp.guid = Guid.Empty;
                    m_audios.Add(tmp);
                }
                else
                {
                    return(-1);
                }
            }

            return(index);
        }
Exemplo n.º 2
0
        private AudioMgr()
        {
            m_audioParent = null;
            m_audios      = new List <AudioItem>();
            if (m_audioParent == null)
            {
                m_audioParent = new GameObject("AudioParent");
                GameObject.DontDestroyOnLoad(m_audioParent);
            }

            for (int i = 0; i < 6; ++i)
            {
                AudioItem tmp;
                tmp       = new AudioItem();
                tmp.audio = ObjectEX.AddComponent <AudioSource>(m_audioParent);
                tmp.id    = 0;
                tmp.group = 0;
                tmp.guid  = Guid.Empty;
                m_audios.Add(tmp);
            }
        }
Exemplo n.º 3
0
 static SceneHelper()
 {
     m_levelScript = ObjectEX.CreatGOWithBehaviour <SceneLoader>("LevelHelperObj");
 }