Ejemplo n.º 1
0
 /// <summary>
 /// 刷新助手
 /// </summary>
 public void OnRefresh()
 {
     if (_singlePlayDetector)
     {
         if (!SingleSource.isPlaying)
         {
             _singlePlayDetector = false;
             SingleSoundEndOfPlayEvent?.Invoke(SingleSource.clip.name);
         }
     }
 }
Ejemplo n.º 2
0
 public void Update()
 {
     if (_singleSoundPlayDetector)
     {
         if (!_singleAudio.isPlaying)
         {
             _singleSoundPlayDetector = false;
             SingleSoundEndOfPlayEvent?.Invoke();
         }
     }
 }
Ejemplo n.º 3
0
        public override void OnRefresh()
        {
            base.OnRefresh();

            if (_singleSoundPlayDetector)
            {
                if (!_singleAudio.isPlaying)
                {
                    _singleSoundPlayDetector = false;
                    SingleSoundEndOfPlayEvent?.Invoke();
                }
            }
        }
Ejemplo n.º 4
0
        internal override void OnRefresh()
        {
            base.OnRefresh();

            if (_helper.SingleSoundPlayDetector)
            {
                if (!_helper.SingleAudio.isPlaying)
                {
                    _helper.SingleSoundPlayDetector = false;
                    SingleSoundEndOfPlayEvent?.Invoke();
                }
            }
        }
        public override void OnInitialization()
        {
            base.OnInitialization();

            _helper.SingleSoundEndOfPlayEvent += (value) =>
            {
                SingleSoundEndOfPlayEvent?.Invoke(value);
            };

            Mute = MuteDefault;
            BackgroundPriority = BackgroundPriorityDefault;
            SinglePriority     = SinglePriorityDefault;
            MultiplePriority   = MultiplePriorityDefault;
            WorldPriority      = WorldPriorityDefault;
            OneShootPriority   = OneShootPriorityDefault;
            BackgroundVolume   = BackgroundVolumeDefault;
            SingleVolume       = SingleVolumeDefault;
            MultipleVolume     = MultipleVolumeDefault;
            WorldVolume        = WorldVolumeDefault;
            OneShootVolume     = OneShootVolumeDefault;
        }
Ejemplo n.º 6
0
    public void Update(float deltaTime)
    {
        if (_singleSoundPlayDetector)
        {
            if (!_singleAudio.isPlaying)
            {
                _singleSoundPlayDetector = false;
                if (null != SingleSoundEndOfPlayEvent)
                {
                    SingleSoundEndOfPlayEvent.Invoke();
                }
            }
        }
        if (_backgroundPriorityCache != BackgroundPriority)
        {
            _backgroundPriorityCache  = BackgroundPriority;
            _backgroundAudio.priority = _backgroundPriorityCache;
        }
        if (_singlePriorityCache != SinglePriority)
        {
            _singlePriorityCache  = SinglePriority;
            _singleAudio.priority = _singlePriorityCache;
        }
        if (_multiplePriorityCache != MultiplePriority)
        {
            _multiplePriorityCache = MultiplePriority;
            for (int i = 0; i < _multipleAudio.Count; i++)
            {
                _multipleAudio[i].priority = _multiplePriorityCache;
            }
        }
        if (_worldPriorityCache != WorldPriority)
        {
            _worldPriorityCache = WorldPriority;
            foreach (KeyValuePair <GameObject, AudioSource> audio in _worldAudio)
            {
                audio.Value.priority = _worldPriorityCache;
            }
        }

        if (!Mathf.Approximately(_backgroundVolumeCache, BackgroundVolume))
        {
            _backgroundVolumeCache  = BackgroundVolume;
            _backgroundAudio.volume = _backgroundVolumeCache;
        }
        if (!Mathf.Approximately(_singleVolumeCache, SingleVolume))
        {
            _singleVolumeCache  = SingleVolume;
            _singleAudio.volume = _singleVolumeCache;
        }
        if (!Mathf.Approximately(_multipleVolumeCache, MultipleVolume))
        {
            _multipleVolumeCache = MultipleVolume;
            for (int i = 0; i < _multipleAudio.Count; i++)
            {
                _multipleAudio[i].volume = _multipleVolumeCache;
            }
        }
        if (!Mathf.Approximately(_worldVolumeCache, WorldVolume))
        {
            _worldVolumeCache = WorldVolume;
            foreach (KeyValuePair <GameObject, AudioSource> audio in _worldAudio)
            {
                audio.Value.volume = _worldVolumeCache;
            }
        }
    }