/// <summary> /// initialization /// </summary> protected void Start() { ComponentsManager manager = GameObject.FindGameObjectWithTag(ComponentsManager.SELF_TAG).GetComponent <ComponentsManager>(); m_audio = manager.m_audio; m_audio.BufferLength = m_spectrumSize; m_leftChannelSamples = new float[(int)m_spectrumSize]; m_rightChannelSamples = new float[(int)m_spectrumSize]; }
//lack a list control component public void Init() { m_currentPlaySongPath = string.Empty; m_audio = GameObject.FindGameObjectWithTag(ComponentsManager.SELF_TAG).GetComponent <ComponentsManager>().m_audio; m_volumeSlider.onValueChanged.AddListener(SetVolume); m_audioSlider.onValueChanged.AddListener(SetAudioTime); m_musicPlay.onValueChanged.AddListener(PlaySong); m_preSongOnClick = m_preSong.gameObject.AddComponent <UIEventListener>(); m_nextSongOnClick = m_nextSong.gameObject.AddComponent <UIEventListener>(); m_audioSlider.maxValue = 100f; }