Пример #1
0
 private bool _Init()
 {
     TsAudio.LoadPlayerPrefs();
     TsAudio.RefreshAllAudioVolumes();
     TsAudio.RefreshAllMuteAudio();
     this._defaultAudioListenerSwitcher = new TsAudioListenerSwitcher(base.gameObject);
     if (Application.isPlaying)
     {
         this._currentAudioListenerSwitcher = null;
         AudioListener audioListener = this.SearchAndEnable_CurrentAudioListener();
         if (audioListener != null)
         {
             this._currentAudioListenerSwitcher = new TsAudioListenerSwitcher(audioListener.gameObject);
             if (this._currentAudioListenerSwitcher == null)
             {
                 TsLog.LogWarning("_currentAudioListenerSwitcher == null", new object[0]);
             }
         }
         else if (Camera.main != null)
         {
             this._currentAudioListenerSwitcher = new TsAudioListenerSwitcher(Camera.main.gameObject);
             if (this._currentAudioListenerSwitcher == null)
             {
                 TsLog.LogWarning("_currentAudioListenerSwitcher == null", new object[0]);
             }
         }
         if (this._currentAudioListenerSwitcher == null)
         {
             this._currentAudioListenerSwitcher = this._defaultAudioListenerSwitcher;
         }
         this._currentAudioListenerSwitcher.Switch();
         if (this.CurrentAudioListener == null)
         {
             TsLog.LogError("Failed~! Set Current AudioListener~!", new object[0]);
         }
     }
     else
     {
         this._defaultAudioListenerSwitcher.Switch();
     }
     if (Application.isEditor)
     {
         if (base.gameObject.GetComponent <TsAudioDebugger>() == null)
         {
             base.gameObject.AddComponent <TsAudioDebugger>();
         }
         if (base.gameObject.GetComponent <TsTestDownloadAtAudioContainer>() == null)
         {
             base.gameObject.AddComponent <TsTestDownloadAtAudioContainer>();
         }
     }
     if (this._tempclip == null)
     {
         this._tempclip = AudioClip.Create("tempclip", 44100, 1, 44100, false, false);
     }
     return(true);
 }
Пример #2
0
 public void OnFinish()
 {
     TsAudio.RefreshAllAudioVolumes();
     if (SystemInfo.processorCount == 1)
     {
         TsAudio.SetDisableDownloadAudio(EAudioType.AMBIENT, true);
         TsAudio.SetDisableDownloadAudio(EAudioType.ENVIRONMENT, true);
     }
     FacadeHandler.EndNPATCHDownLoad(false);
 }
Пример #3
0
 private void Set_Sound()
 {
     for (int i = 0; i < 10; i++)
     {
         if (i == 1 || i == 9)
         {
             if (this.m_MuteBgm.IsChecked())
             {
                 TsAudio.SetMuteAudioType((EAudioType)i, true);
             }
             else
             {
                 bool mute = false;
                 if (this.m_BgmSound.Value <= 0.001f)
                 {
                     mute = true;
                 }
                 TsAudio.SetMuteAudioType((EAudioType)i, mute);
                 TsAudio.SetVolumeOfAudioType((EAudioType)i, this.m_BgmSound.Value);
             }
         }
         else if (this.m_MuteEffect.IsChecked())
         {
             TsAudio.SetMuteAudioType((EAudioType)i, true);
         }
         else
         {
             bool mute2 = false;
             if (this.m_EffectSound.Value <= 0.001f)
             {
                 mute2 = true;
             }
             TsAudio.SetMuteAudioType((EAudioType)i, mute2);
             TsAudio.SetVolumeOfAudioType((EAudioType)i, this.m_EffectSound.Value);
         }
     }
     TsAudio.RefreshAllAudioVolumes();
     TsAudio.RefreshAllMuteAudio();
 }