상속: UnityEngine.MonoBehaviour
예제 #1
0
        public void Start()
        {
            Instance = this;
            music    = MusicLogic.fetch;

            preloadTimer.Elapsed += new System.Timers.ElapsedEventHandler(preloadTimer_Elapsed);

            //Utils.Log("# OS Version: " + Environment.OSVersion + ", Platform: " + Environment.OSVersion.Platform);
            //DeleteAllStock();

            DontDestroyOnLoad(gameObject);

            /*Load();
             * UnloadUnusedTracks();
             *
             * // Remove positional effects.
             * music.audio1.panLevel = 0;
             * music.audio1.dopplerLevel = 0;
             * music.audio2.panLevel = 0;
             * music.audio2.dopplerLevel = 0;*/

            UnloadStockMusicPlayer();

            /*for (int i = 0; i < Enum.GetNames(typeof(Enums.Channel)).Length; i++)
             * {
             *  Speakers[i] = new Speaker(gameObject, (Enums.Channel)i);
             * }*/

            // Set up the main audio source.
            Speaker = gameObject.AddComponent <AudioSource>();
            // Disable positional effects.
            Speaker.spatialBlend = 0;
            Speaker.dopplerLevel = 0;
            Speaker.loop         = false;
            Speaker.volume       = GameSettings.MUSIC_VOLUME;
            fader = new Fader(Speaker);

            // TODO: Change volume on unpause or main menu.

            EventManager.Instance.AddEvents();

            // Set up test playlists.
            //SoundTest soundTest = new SoundTest();
            //SoundTest.CreatePlaylists(Playlists);

            Playlists = Persistor.LoadPlaylists();
        }
        public void Start()
        {
            Instance = this;
            music    = MusicLogic.fetch;

            //Utils.Log("# OS Version: " + Environment.OSVersion + ", Platform: " + Environment.OSVersion.Platform);
            //DeleteAllStock();

            DontDestroyOnLoad(gameObject);

            //UnloadUnusedTracks();

            emptyTrack = AudioClip.Create("none", 44100, 1, 44100, false);
            UnloadStockMusicPlayer();

            /*for (int i = 0; i < Enum.GetNames(typeof(Enums.Channel)).Length; i++)
             * {
             *  Speakers[i] = new Speaker(gameObject, (Enums.Channel)i);
             * }*/

            // Set up the main audio source.
            Speaker = gameObject.AddComponent <AudioSource>();
            // Disable positional effects.
            Speaker.spatialBlend = 0;
            Speaker.dopplerLevel = 0;
            Speaker.loop         = false;
            Speaker.volume       = GameSettings.MUSIC_VOLUME;
            fader = new Fader(Speaker);

            // TODO: Change volume on unpause or main menu.

            preloadTimer          = new System.Timers.Timer();
            preloadTimer.Elapsed += new System.Timers.ElapsedEventHandler(preloadTimer_Elapsed);
            // Create a new empty audio clip to replace the stock ones when they are disabled.
            CurrentSituation = new Playlist.Prerequisites()
            {
                scene = Enums.Scenes.Loading
            };
            EventManager.Instance.AddEvents();

            // Set up test playlists.
            //SoundTest soundTest = new SoundTest();
            //SoundTest.CreatePlaylists(Playlists);
            Playlists = Persistor.LoadPlaylists();
        }
예제 #3
0
        public static string GetNewPlaylistName()
        {
            int              num          = 1;
            string           playlistName = "New Playlist " + num;
            SoundtrackEditor sted         = SoundtrackEditor.Instance;

            if (sted == null || sted.Playlists == null)
            {
                return(playlistName);
            }
            for (int i = 0; i < sted.Playlists.Count; i++)
            {
                if (sted.Playlists[i].name == playlistName)
                {
                    num++;
                    playlistName = "New Playlist " + num;
                    i            = 0;
                }
            }
            return(playlistName);
        }