Ejemplo n.º 1
0
 /// <summary>
 /// Use this to play bundleAudios from Localization folder
 /// </summary>
 /// <param name="audioTag">Use PYAudioTags that start with a B_</param>
 /// <param name="group">In which group/channel this audio will be played</param>
 /// <returns></returns>
 public PYAudioSource StartAudio(PYAudioTags audioTag, PYGroupTag group)
 {
     if (audioTag.ToString().StartsWith("B_"))
     {
         return(StartAudio(PYBundleManager.Localization, audioTag, group));
     }
     else
     {
         return(StartAudio(audioTag, new AudioTrack(audioTag.ToString(), group, GetAudioTrack(audioTag).PathToClip)));
     }
 }
Ejemplo n.º 2
0
        public PYAudioSource StartBundleAudio(PYAudioTags audioTag, PYGroupTag group)
        {
            if (audioTag.ToString().StartsWith("B_"))
            {
                return(StartBundleAudioClip(PYBundleManager.Localization.GetAsset <AudioClip>(audioTag.ToString().Replace("B_", "")), audioTag, group));
            }

            return(StartAudio(audioTag));
        }
Ejemplo n.º 3
0
 private static void PlayAudio(PYAudioTags tag, Action <PYAudioSource.PYAudioSourceEventData> callback = null, float delay = 0)
 {
     if (PYBundleManager.Instance != null)
     {
         PYAudioManager.Instance.StartAudio(tag, PYGroupTag.Voice).Delay(delay).Play(callback);
     }
     else
     {
         string tagString = tag.ToString().Replace("B_", "Voice_" + PlaytableWin32.Instance.Language.Replace("-", "") + "_");
         PYAudioManager.Instance.StartAudio((PYAudioTags)Enum.Parse(typeof(PYAudioTags), tagString)).Delay(delay).Play(callback);
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Use this to play Resource audios
        /// </summary>
        /// <param name="audioTag">Use PYAudioTags that dont start with a B_</param>
        /// <returns></returns>
        public PYAudioSource StartAudio(PYAudioTags audioTag)
        {
            PYAudioSource audioSource = GetPYAudioSource(audioTag);

            if (audioSource != null && audioSource.Track.GroupTag == PYGroupTag.Voice)
            {
                return(audioSource);
            }

            AudioTrack track = (audioTag == PYAudioTags.None) ?
                               new AudioTrack(audioTag.ToString(), PYGroupTag.Master, string.Empty) : GetAudioTrack(audioTag);

            return(StartAudio(audioTag, track));
        }
Ejemplo n.º 5
0
        // Base method for others implementations
        private PYAudioSource StartAudio(PYAudioTags audioTag, AudioTrack track)
        {
            PYAudioSource audioSource = CreatePYAudioSource(audioTag.ToString());

            audioSource.Initialize(audioTag, track);

            if (_audioTriggers.ContainsKey(audioSource.AudioTag))
            {
                foreach (PYAudioTrigger.Trigger trigger in _audioTriggers[audioSource.AudioTag])
                {
                    audioSource.AudioTrigger.AddTriggerAction(trigger);
                }
            }

            if (_audioSourceActions.ContainsKey(audioSource.AudioTag))
            {
                foreach (PYAudioSource.EventListenerData listener in _audioSourceActions[audioSource.AudioTag])
                {
                    audioSource.AddListenerToEvent(listener);
                }
            }

            return(audioSource);
        }
Ejemplo n.º 6
0
 private AudioTrack GetAudioTrack(PYAudioTags audioTag)
 {
     return(Audios.Find(item => item.Tag == audioTag.ToString()));
 }
Ejemplo n.º 7
0
        /// <summary>
        /// Use this to play audios from a specific bundleManager
        /// </summary>
        /// <param name="bundleManager">From which bundleManager the audio will be fetch</param>
        /// <param name="audioTag">Use PYAudioTags that start with a B_</param>
        /// <param name="group">In which group/channel this audio will be played</param>
        /// <returns></returns>
        public PYAudioSource StartAudio(PYBundleSubManager bundleManager, PYAudioTags audioTag, PYGroupTag group)
        {
            PYAudioSource audioSource = GetPYAudioSource(audioTag);

            if (audioSource != null && audioSource.Track.GroupTag == PYGroupTag.Voice)
            {
                return(audioSource);
            }

            return(StartAudio(audioTag, new AudioTrack(group, bundleManager.GetAsset <AudioClip>(audioTag.ToString().Replace("B_", "")))));
        }