示例#1
0
        /// <summary>
        /// 播放英雄台词
        /// </summary>
        /// <param name="sGUID"></param>
        /// 对应英雄GUID
        public void PlayHeroLinesAudio(UInt64 sGUID, AudioClip adClip)
        {
            if (!HeroLinesAudioDict.ContainsKey(sGUID))
            {
                AudioSource ad = HolyTechGameBase.Instance.gameObject.AddComponent <AudioSource> ();
                HeroLinesAudioDict.Add(sGUID, ad);
            }
            AudioSource adSource = HeroLinesAudioDict [sGUID];

            if (adSource.isPlaying)
            {
                return;
            }
            adSource.clip = adClip;
            adSource.Play();
        }
示例#2
0
        public void EnableSound(bool enable)
        {
            if (HeroMoveAudio.enabled != enable)
            {
                if (enable)
                {
                    HeroMoveAudio.clip = null;
                }
                HeroMoveAudio.enabled = enable;
            }

            if (GuideVoice.enabled != enable)
            {
                if (enable)
                {
                    GuideVoice.clip = null;
                }
                GuideVoice.enabled = enable;
            }
            for (int i = 0; i < EffectAudioSourceQueue.Count; i++)
            {
                if (EffectAudioSourceQueue.ElementAt(i).enabled != enable)
                {
                    if (enable)
                    {
                        EffectAudioSourceQueue.ElementAt(i).clip = null;
                    }
                    EffectAudioSourceQueue.ElementAt(i).enabled = enable;
                }
            }
            for (int i = 0; i < LongVoiceAudioSourceQueue.Count; i++)
            {
                if (LongVoiceAudioSourceQueue.ElementAt(i).enabled != enable)
                {
                    if (enable)
                    {
                        LongVoiceAudioSourceQueue.ElementAt(i).clip = null;
                    }
                    LongVoiceAudioSourceQueue.ElementAt(i).enabled = enable;
                }
            }

            for (int i = HeroLinesAudioDict.Count - 1; i >= 0; i--)
            {
                if (HeroLinesAudioDict.ElementAt(i).Value.enabled != enable)
                {
                    if (enable)
                    {
                        HeroLinesAudioDict.ElementAt(i).Value.clip = null;
                    }
                    HeroLinesAudioDict.ElementAt(i).Value.enabled = enable;
                }
            }
            if (GameKillAudioSource.enabled != enable)
            {
                if (enable)
                {
                    GameKillAudioSource.clip = null;
                }
                GameKillAudioSource.enabled = enable;
            }

            if (HeroGetMoneySource.enabled != enable)
            {
                if (enable)
                {
                    HeroGetMoneySource.clip = null;
                }
                HeroGetMoneySource.enabled = enable;
            }

            if (NGUITools.audioSource != null && NGUITools.audioSource.enabled != enable)
            {
                if (enable)
                {
                    NGUITools.audioSource.clip = null;
                }

                NGUITools.audioSource.enabled = enable;
            }
        }
示例#3
0
 public void CleanAudio()
 {
     HeroLinesAudioDict.Clear();
 }