Exemple #1
0
        public void PauseAndResumeMusicTest()
        {
#if UNITY_EDITOR
            UnityEditor.EditorPrefs.SetInt("SimulateAssetBundles", 1);
#endif
            ResMgr.Init();

            var loader = ResLoader.Allocate();

            // 提前预加载,否则会进行异步加载
            loader.LoadSync <AudioClip>("sound1");

            AudioKit.Settings.IsMusicOn.Value = true;

            AudioKit.PlayMusic("sound1");
            AudioKit.PauseMusic();

            Assert.IsFalse(AudioKit.MusicPlayer.AudioSource.isPlaying);

            AudioKit.ResumeMusic();

            Assert.IsTrue(AudioKit.MusicPlayer.AudioSource.isPlaying);

            loader.Recycle2Cache();
            loader = null;
        }