using System;
using Cpp2IlInjected;
using UnityEngine;

// Token: 0x02000115 RID: 277
[Token(Token = "0x2000115")]
public class GameAudioManager : MonoBehaviour
{
	// Token: 0x06000EA3 RID: 3747 RVA: 0x00022B40 File Offset: 0x00020D40
	[Token(Token = "0x6000EA3")]
	[Address(RVA = "0x539AA0", Offset = "0x5388A0", VA = "0x180539AA0")]
	public void Init()
	{
		Game.OnVolumeSettingsChanged += new Action(this.UpdateVolumeSettings);
		VolumeSettings volumeSettings = Game.Config.volumeSettings;
		float soundEffectVolume = volumeSettings.GetSoundEffectVolume();
		this.standardSEVolume = soundEffectVolume;
		float voiceVolume = volumeSettings.GetVoiceVolume();
		AudioSource audioSource = this.sfxPlayer;
		this.vocalSEVolume = voiceVolume;
		float num = this.standardSEVolume;
		audioSource.volume = num;
	}

	// Token: 0x06000EA4 RID: 3748 RVA: 0x00022BA8 File Offset: 0x00020DA8
	[Token(Token = "0x6000EA4")]
	[Address(RVA = "0x539E40", Offset = "0x538C40", VA = "0x180539E40")]
	private void UpdateVolumeSettings(VolumeSettings settings)
	{
		float soundEffectVolume = settings.GetSoundEffectVolume();
		this.standardSEVolume = soundEffectVolume;
		float voiceVolume = settings.GetVoiceVolume();
		AudioSource audioSource = this.sfxPlayer;
		this.vocalSEVolume = voiceVolume;
		float num = this.standardSEVolume;
		audioSource.volume = num;
	}

	// Token: 0x06000EA5 RID: 3749 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6000EA5")]
	[Address(RVA = "0x539BA0", Offset = "0x5389A0", VA = "0x180539BA0")]
	public void PlayCanvasSE(UICanvasSFX effect)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06000EA6 RID: 3750 RVA: 0x00022BEC File Offset: 0x00020DEC
	[Token(Token = "0x6000EA6")]
	[Address(RVA = "0x539C30", Offset = "0x538A30", VA = "0x180539C30")]
	public void PlayHandlerSE(UIHandlerSFX effect)
	{
		while (effect != UIHandlerSFX.Voice)
		{
			float num = this.standardSEVolume;
			if (effect != UIHandlerSFX.Operation)
			{
				float num2;
				if (effect == UIHandlerSFX.MagicSelection)
				{
					num2 = num * 0.7f * 0.4f;
				}
				int num3 = 0;
				while (num2 <= (float)num3)
				{
				}
				GameAudioPackage gameAudioPackage = this.uiHandlerPack;
				AudioSource audioSource = this.sfxPlayer;
				AudioClip[] clips = gameAudioPackage.clips;
				AudioClip audioClip = clips[(int)effect];
				audioSource.PlayOneShot(audioClip, num2);
				return;
			}
		}
		float num4 = this.vocalSEVolume;
		int num5 = 0;
		if (num4 > (float)num5)
		{
			GameAudioPackage gameAudioPackage2 = this.uiHandlerPack;
			AudioSource audioSource2 = this.sfxPlayer;
			AudioClip audioClip2 = gameAudioPackage2.clips[10];
			audioSource2.PlayOneShot(audioClip2, num4);
			return;
		}
	}

	// Token: 0x06000EA7 RID: 3751 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6000EA7")]
	[Address(RVA = "0x539D20", Offset = "0x538B20", VA = "0x180539D20")]
	private void PlayStandardHandlerSE(UIHandlerSFX effect)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06000EA8 RID: 3752 RVA: 0x00022C94 File Offset: 0x00020E94
	[Token(Token = "0x6000EA8")]
	[Address(RVA = "0x539DE0", Offset = "0x538BE0", VA = "0x180539DE0")]
	private void PlayVoiceHandlerSE()
	{
		float num = this.vocalSEVolume;
		int num2 = 0;
		if (num > (float)num2)
		{
			GameAudioPackage gameAudioPackage = this.uiHandlerPack;
			AudioSource audioSource = this.sfxPlayer;
			AudioClip audioClip = gameAudioPackage.clips[10];
			audioSource.PlayOneShot(audioClip, num);
			return;
		}
	}

	// Token: 0x06000EA9 RID: 3753 RVA: 0x00022CDC File Offset: 0x00020EDC
	[Token(Token = "0x6000EA9")]
	[Address(RVA = "0x539DA0", Offset = "0x538BA0", VA = "0x180539DA0")]
	public void PlayUpgradeSE()
	{
		AudioSource audioSource = this.sfxPlayer;
		AudioClip audioClip = this.upgradeSound;
		audioSource.clip = audioClip;
		this.sfxPlayer.Play();
	}

	// Token: 0x06000EAA RID: 3754 RVA: 0x00022D10 File Offset: 0x00020F10
	[Token(Token = "0x6000EAA")]
	[Address(RVA = "0x539A80", Offset = "0x538880", VA = "0x180539A80")]
	public void FadeOutUpgradeSE()
	{
		this.sfxPlayer.Stop();
	}

	// Token: 0x06000EAB RID: 3755 RVA: 0x00022D30 File Offset: 0x00020F30
	[Token(Token = "0x6000EAB")]
	[Address(RVA = "0x3088F0", Offset = "0x3076F0", VA = "0x1803088F0")]
	public GameAudioManager()
	{
	}

	// Token: 0x04001928 RID: 6440
	[FieldOffset(Offset = "0x18")]
	[Token(Token = "0x4001928")]
	[SerializeField]
	private float standardSEVolume;

	// Token: 0x04001929 RID: 6441
	[FieldOffset(Offset = "0x1C")]
	[Token(Token = "0x4001929")]
	[SerializeField]
	private float vocalSEVolume;

	// Token: 0x0400192A RID: 6442
	[FieldOffset(Offset = "0x20")]
	[Token(Token = "0x400192A")]
	[SerializeField]
	private AudioSource sfxPlayer;

	// Token: 0x0400192B RID: 6443
	[FieldOffset(Offset = "0x28")]
	[Token(Token = "0x400192B")]
	[SerializeField]
	private GameAudioPackage uiCanvasPack;

	// Token: 0x0400192C RID: 6444
	[FieldOffset(Offset = "0x30")]
	[Token(Token = "0x400192C")]
	[SerializeField]
	private GameAudioPackage uiHandlerPack;

	// Token: 0x0400192D RID: 6445
	[FieldOffset(Offset = "0x38")]
	[Token(Token = "0x400192D")]
	[SerializeField]
	private AudioClip upgradeSound;
}
