Esempio n. 1
0
        /// <summary>
        /// 停止背景音乐
        /// </summary>
        /// <param name="fadeout">淡出时间,默认0.5s</param>
        /// <returns></returns>
        public SoundPiece StopBGM(float fadeout = 0.5f)
        {
            Queue <SoundEffect> effectsq = new Queue <SoundEffect>();

            if (fadeout != 0f)
            {
                effectsq.Enqueue(SoundBuilder.VolumeDownBGM(fadeout, 1));
            }
            effectsq.Enqueue(SoundBuilder.RemoveBGM());
            return(new SoundPiece(id++, effectsq));
        }
Esempio n. 2
0
        /// <summary>
        /// 暂停背景音乐
        /// </summary>
        /// <param name="fadeout">淡出时间,默认0s</param>
        /// <returns></returns>
        public SoundPiece PauseBGM(float fadeout = 0f)
        {
            Queue <SoundEffect> effectsq = new Queue <SoundEffect>();

            if (fadeout != 0f)
            {
                effectsq.Enqueue(SoundBuilder.VolumeDownBGM(fadeout, 1));
            }
            effectsq.Enqueue(SoundBuilder.PauseBGM());
            return(new SoundPiece(id++, effectsq));
            //return null;
        }