VolumeUpdater.cs 724 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. using System;
  2. using RenderHeads.Media.AVProVideo;
  3. using UnityEngine;
  4. public class VolumeUpdater : MonoBehaviour
  5. {
  6. private MediaPlayer mediaPlayer
  7. {
  8. get
  9. {
  10. if (this.m_MediaPlayer == null)
  11. {
  12. this.m_MediaPlayer = base.GetComponent<MediaPlayer>();
  13. }
  14. return this.m_MediaPlayer;
  15. }
  16. }
  17. private void Update()
  18. {
  19. if (!this.m_MediaPlayer)
  20. {
  21. return;
  22. }
  23. if (!GameMain.Instance)
  24. {
  25. return;
  26. }
  27. if (!GameMain.Instance.SoundMgr)
  28. {
  29. return;
  30. }
  31. int num = GameMain.Instance.SoundMgr.GetVolume(AudioSourceMgr.Type.Bgm);
  32. num *= GameMain.Instance.SoundMgr.GetVolumeAll();
  33. this.mediaPlayer.Control.SetVolume((float)num * 0.0001f);
  34. }
  35. [SerializeField]
  36. private MediaPlayer m_MediaPlayer;
  37. }