Exemple #1
0
 public void Pause()
 {
     if (!this.Enabled)
     {
         return;
     }
     Waiters.Interpolate(0.25, (Action <float>)(step =>
     {
         ActiveTrackedSong temp_10 = this;
         int temp_15         = (temp_10.cancelPause ? 1 : 0) | (this.resumeRequested ? 1 : (!this.Enabled ? 1 : 0));
         temp_10.cancelPause = temp_15 != 0;
         if (this.cancelPause)
         {
             return;
         }
         this.SoundManager.MusicVolumeFactor = FezMath.Saturate(1f - Easing.EaseOut((double)step, EasingType.Sine));
     }), (Action)(() =>
     {
         if (!this.cancelPause && !this.resumeRequested)
         {
             this.Watch.Stop();
             foreach (ActiveLoop item_0 in this.ActiveLoops)
             {
                 item_0.Pause();
             }
             this.Enabled = false;
             this.SoundManager.MusicVolumeFactor = 1f;
         }
         this.cancelPause = this.resumeRequested = false;
     }));
 }
Exemple #2
0
 public void Resume()
 {
     if (this.Enabled)
     {
         return;
     }
     foreach (ActiveAmbienceTrack activeAmbienceTrack in this.ActiveTracks)
     {
         activeAmbienceTrack.Resume();
     }
     this.Enabled         = true;
     this.resumeRequested = true;
     Waiters.Interpolate(0.125, (Action <float>)(step =>
     {
         if (!this.Enabled)
         {
             return;
         }
         this.resumeRequested = false;
     }));
 }
Exemple #3
0
 public void Resume()
 {
     if (this.Enabled || this.Watch == null)
     {
         return;
     }
     this.Watch.Start();
     foreach (ActiveLoop activeLoop in this.ActiveLoops)
     {
         activeLoop.Resume();
     }
     this.Enabled         = true;
     this.resumeRequested = true;
     Waiters.Interpolate(0.125, (Action <float>)(step =>
     {
         if (!this.Enabled)
         {
             return;
         }
         this.SoundManager.MusicVolumeFactor = FezMath.Saturate(Easing.EaseOut((double)step, EasingType.Sine));
         this.resumeRequested = false;
     }), (Action)(() => this.SoundManager.MusicVolumeFactor = 1f));
 }
Exemple #4
0
 public void Pause()
 {
     if (!this.Enabled)
     {
         return;
     }
     Waiters.Interpolate(0.25, (Action <float>)(step =>
     {
         ActiveAmbience temp_10 = this;
         int temp_15            = (temp_10.cancelPause ? 1 : 0) | (this.resumeRequested ? 1 : (!this.Enabled ? 1 : 0));
         temp_10.cancelPause    = temp_15 != 0;
     }), (Action)(() =>
     {
         if (!this.cancelPause && !this.resumeRequested)
         {
             foreach (ActiveAmbienceTrack item_0 in this.ActiveTracks)
             {
                 item_0.Pause();
             }
             this.Enabled = false;
         }
         this.cancelPause = this.resumeRequested = false;
     }));
 }
Exemple #5
0
 public void OnMuteStateChanged(float fadeDuration)
 {
     if (this.ActiveForDayPhase && !this.ForceMuted && (double)this.volume != 1.0)
     {
         float   originalVolume = this.volume;
         IWaiter thisWaiter     = (IWaiter)null;
         this.volume          += 1.0 / 1000.0;
         this.transitionWaiter = thisWaiter = Waiters.Interpolate((double)fadeDuration * (1.0 - (double)this.volume), (Action <float>)(s =>
         {
             if (this.transitionWaiter != thisWaiter)
             {
                 return;
             }
             this.volume = originalVolume + s * (1f - originalVolume);
             if (this.cue == null || this.cue.IsDisposed)
             {
                 return;
             }
             this.cue.Volume = this.volume;
         }), (Action)(() =>
         {
             if (this.transitionWaiter != thisWaiter)
             {
                 return;
             }
             this.volume = 1f;
             if (this.cue == null || this.cue.IsDisposed)
             {
                 return;
             }
             this.cue.Volume = this.volume;
         }));
     }
     else
     {
         if (this.ActiveForDayPhase && !this.ForceMuted || (double)this.volume == 0.0)
         {
             return;
         }
         float   originalVolume = this.volume;
         IWaiter thisWaiter     = (IWaiter)null;
         this.volume          -= 1.0 / 1000.0;
         this.transitionWaiter = thisWaiter = Waiters.Interpolate((double)fadeDuration * (double)this.volume, (Action <float>)(s =>
         {
             if (this.transitionWaiter != thisWaiter)
             {
                 return;
             }
             this.volume = originalVolume * (1f - s);
             if (this.cue == null || this.cue.IsDisposed)
             {
                 return;
             }
             this.cue.Volume = this.volume;
         }), (Action)(() =>
         {
             if (this.transitionWaiter != thisWaiter)
             {
                 return;
             }
             this.volume = 0.0f;
             if (this.cue == null || this.cue.IsDisposed)
             {
                 return;
             }
             this.cue.Volume = this.volume;
         }));
     }
 }
Exemple #6
0
 public static IWaiter Interpolate(double durationSeconds, Action <float> assignation)
 {
     return(Waiters.Interpolate(durationSeconds, assignation, new Action(Util.NullAction)));
 }