private VirtualInstrumentManager mVIM = null; //!< The @link VIM Virtual Instrument Manager@endlink. /*************************************************************************//** * @} * @defgroup SC_LSDUnity Unity Functions * @ingroup DocSC_LSD * These are functions automatically called by Unity * @{ ******************************************************************************/ /** * @brief Initializes the SC_LoadSongDialog by getting references to its components. */ private void Awake() { // Get the virtual instrument manager. mVIM = GameObject.Find("VirtualInstrumentManager").GetComponent <VirtualInstrumentManager>(); Assert.IsNotNull(mVIM, "Could not get a reference to the VirtualInstrumentManager!"); // Set up the event. SongSelected = new SongSelectedEvent(); // Set up the selection menu by getting a reference to it and clearing its options. Then, fill its options // with the songs in the SongManager. Also add its listener. mSongSelectionMenu = transform.GetChild(1).GetChild(0).GetComponent <Dropdown>(); mSongSelectionMenu.options.Clear(); mSongSelectionMenu.AddOptions(mVIM.SongManager.GetSongNames()); mSongSelectionMenu.onValueChanged.AddListener(OnSongSelected); // Get the default mSelectedSong = mVIM.SongManager.GetSongs()[0]; // Set up the buttons. mLoadButton = transform.GetChild(1).GetChild(2).GetComponent <Button>(); mLoadButton.onClick.AddListener(OnLoadButtonClicked); mCancelButton = transform.GetChild(1).GetChild(1).GetComponent <Button>(); mCancelButton.onClick.AddListener(OnCancelButtonClicked); }
private void SongSelectected(int songIndex, string songFullPath) { SongSelectedEvent?.Invoke(songIndex, songFullPath, Path.GetFileNameWithoutExtension(songFullPath)); }