コード例 #1
0
 /// <summary>
 /// 播放声音
 /// </summary>
 /// <param name="type">声音类型</param>
 private void PlaySound(Constant.SoundType type)
 {
     if (!isSilent)
     {
         playerCtl.Play(type);//播放声音
     }
 }
コード例 #2
0
        /// <summary>
        /// 播放声音
        /// </summary>
        /// <param name="soundType">声音类型</param>
        public void Play(Constant.SoundType soundType)
        {
            switch (soundType)
            {
            case Constant.SoundType.Bom:
                PlaySound(playerBom);
                break;

            case Constant.SoundType.Coin:
                PlaySound(playerCoin);
                break;

            case Constant.SoundType.ButtonEnter:
                PlaySound(playerButtonEnter);
                break;

            case Constant.SoundType.ButtonClick:
                PlaySound(playerButtonClick);
                break;

            case Constant.SoundType.PressError:
                PlaySound(playerPressError);
                break;

            case Constant.SoundType.Open:
                PlaySound(playerOpen);
                break;

            default:
                throw new Exception();
            }
        }