예제 #1
0
        IEnumerator LoadAudioClip()
        {
            GetNewSong();

            Logger.Log("Loading file @ " + musicPath);
            WWW data = new WWW(Environment.CurrentDirectory + "\\" + musicPath);

            yield return(data);

            try
            {
                _menuMusic = data.GetAudioClipCompressed(false, AudioType.OGGVORBIS) as AudioClip;

                if (_menuMusic != null)
                {
                    _menuMusic.name = Path.GetFileName(musicPath);
                }
                else
                {
                    Logger.Log("No audio found!");
                }
            }
            catch (Exception e)
            {
                Logger.Log("Can't load audio! Exception: " + e);
            }

            if (_previewPlayer != null && _menuMusic != null)
            {
                Logger.Log("Applying custom menu music...");

                _previewPlayer.SetField("_defaultAudioClip", _menuMusic);
                _previewPlayer.CrossfadeToDefault();
            }
        }
예제 #2
0
        private void GetSongsList()
        {
            if (CheckOptions())
            {
                AllSongFilePaths = GetAllCustomMenuSongs();
            }
            else
            {
                AllSongFilePaths = GetAllCustomSongs();
            }

            Logger.Log("Found " + AllSongFilePaths.Length + " Custom Menu Songs");
        }
예제 #3
0
        private string[] GetAllCustomMenuSongs()
        {
            if (!Directory.Exists("CustomMenuSongs"))
            {
                Directory.CreateDirectory("CustomMenuSongs");
            }

            string[] filePaths = Directory.GetFiles("CustomMenuSongs", "*.ogg");

            Logger.Log("CustomMenuSongs files found " + filePaths.Length);

            if (filePaths.Length == 0)
            {
                filePaths = GetAllCustomSongs();
            }

            return(filePaths);
        }