public void Resume() { this.Play(); if (this.getFirstFrame) { SoundLib.PlayMovieMusic(this.movieKey, 0); } }
public void PlayActiveSound() { if (this.activeSound.SoundProfileType == SoundProfileType.SoundEffect) { this.IsPlay = false; SoundLib.PlaySoundEffect(this.activeSound.SoundIndex, this.soundView.SoundVolume, this.soundView.PanningPosition, this.soundView.PitchPosition); } else if (this.activeSound.SoundProfileType == SoundProfileType.Song) { this.IsPlay = false; SoundLib.PlaySong(this.activeSound.SoundIndex, this.soundView.SoundVolume, this.soundView.PanningPosition, this.soundView.PitchPosition); } else if (this.activeSound.SoundProfileType == SoundProfileType.Music) { this.IsPlay = true; SoundLib.PlayMusic(this.activeSound.SoundIndex); } else if (this.activeSound.SoundProfileType == SoundProfileType.Sfx) { this.IsPlay = false; SoundLib.PlaySfxSound(this.activeSound.SoundIndex, this.soundView.SoundVolume, this.soundView.PanningPosition, this.soundView.PitchPosition); } else if (this.activeSound.SoundProfileType == SoundProfileType.MovieAudio) { this.IsPlay = true; String[] array = this.activeSound.Name.Split(new Char[] { '/' }); SoundLib.PlayMovieMusic(array[(Int32)array.Length - 1], 0); } else { this.IsPlay = false; } }
public void Update() { if (this.m_nativeContext != IntPtr.Zero && !this.m_hasFinished) { IntPtr nativeTextureContext = MovieMaterial.GetNativeTextureContext(this.m_nativeContext); if (nativeTextureContext != this.m_nativeTextureContext) { this.DestroyTextures(); this.AllocateTexures(); this.m_nativeTextureContext = nativeTextureContext; } this.m_hasFinished = MovieMaterial.HasFinished(this.m_nativeContext); if (!this.m_hasFinished) { if (this.advance) { double elapsedTime = this.m_elapsedTime; float num = Mathf.Max(this.playSpeed, 0f); bool flag = false; flag |= this.isFMV; if (flag) { if (this.preciseTimeCycleCounter == 0) { this.m_elapsedTime += 0.066 * (double)this.playSpeed; } else { this.m_elapsedTime += 0.067 * (double)this.playSpeed; } if (this.preciseTimeCycleCounter == 2) { this.preciseTimeCycleCounter = 0; } else { this.preciseTimeCycleCounter++; } } else { this.m_elapsedTime += (double)(Mathf.Min(Time.deltaTime, 0.067f) * num); } if (this.shouldSync) { SoundLib.SeekMovieAudio(this.movieKey, this.PlayPosition); this.shouldSync = false; } if (this.playSpeed > 1f) { this.syncElapsed += Time.deltaTime; if (this.syncElapsed >= 4f) { SoundLib.SeekMovieAudio(this.movieKey, this.PlayPosition); this.syncElapsed = 0f; } } } } else { if (this.loopCount - 1 <= 0 && this.loopCount != -1) { SoundLib.StopMovieMusic(this.movieKey, false); if (this.OnFinished != null) { this.m_elapsedTime = MovieMaterial.GetDecodedFrameTime(this.m_nativeContext); this.OnFinished(); } return; } if (this.loopCount != -1) { this.loopCount--; } this.m_elapsedTime %= MovieMaterial.GetDecodedFrameTime(this.m_nativeContext); MovieMaterial.Seek(this.m_nativeContext, 0.0, false); this.m_hasFinished = false; } MovieMaterial.SetTargetDisplayDecodeTime(this.m_nativeContext, this.m_elapsedTime); if (!this.getFirstFrame) { double uploadedFrameTime = MovieMaterial.GetUploadedFrameTime(this.m_nativeContext); double num2 = 0.066666666666666666; if (uploadedFrameTime > num2) { this.m_elapsedTime = 0.0; this.preciseTimeCycleCounter = 0; this.getFirstFrame = true; if (this.Material != null) { this.Material.SetColor("_TintColor", this.tintColor); } if (this.advance) { SoundLib.PlayMovieMusic(this.movieKey, 0); } } } } }