using System;
using Cpp2IlInjected;
using UnityEngine;
using UnityEngine.Audio;

// Token: 0x0200001E RID: 30
[Token(Token = "0x200001E")]
public class SoundEffect : MonoBehaviour
{
	// Token: 0x17000010 RID: 16
	// (get) Token: 0x060000BE RID: 190 RVA: 0x00003E68 File Offset: 0x00002068
	[Token(Token = "0x17000010")]
	private VolumeSettings volumeSettings
	{
		[Token(Token = "0x60000BE")]
		[Address(RVA = "0x1468900", Offset = "0x1467900", VA = "0x181468900")]
		get
		{
			return Game.Config.volumeSettings;
		}
	}

	// Token: 0x060000BF RID: 191 RVA: 0x00003E88 File Offset: 0x00002088
	[Token(Token = "0x60000BF")]
	[Address(RVA = "0x1466DC0", Offset = "0x1465DC0", VA = "0x181466DC0")]
	public void InitData(string type)
	{
		while (!this.isInitialized)
		{
			this.isInitialized = true;
			this.soundEffectType = type;
			int audioSourceNum = this.AudioSourceNum;
			if (audioSourceNum > 0)
			{
				AudioSource[] array = new AudioSource[audioSourceNum];
				this.g_AS = array;
				int num = 0;
				if (this.AudioSourceNum > num)
				{
					AudioSource[] array2 = this.g_AS;
					AudioSource audioSource = base.gameObject.AddComponent<AudioSource>();
					if (audioSource != 0 && audioSource == 0)
					{
						continue;
					}
					array2[0] = audioSource;
					string text = this.soundEffectType;
					if (text != 0)
					{
						if (!string.Equals(text, "SoundEffect") && !string.Equals(text, "AreaAffectPlayer"))
						{
							if (!string.Equals(text, "Voice"))
							{
								goto IL_CF;
							}
							AudioSource[] array3 = this.g_AS;
							float voiceVolume = this.volumeSettings.GetVoiceVolume();
						}
						AudioSource[] array4 = this.g_AS;
						float soundEffectVolume = this.volumeSettings.GetSoundEffectVolume();
					}
					IL_CF:
					AudioSource audioSource2 = this.g_AS[num];
					float wholeVolume = this.volumeSettings.GetWholeVolume();
					audioSource2.volume = wholeVolume;
					AudioSource audioSource3 = this.g_AS[num];
					AudioMixerGroup amg = this.AMG;
					audioSource3.outputAudioMixerGroup = amg;
					AudioSource audioSource4 = this.g_AS[num];
					float pitch = this.Pitch;
					audioSource4.pitch = pitch;
					AudioSource audioSource5 = this.g_AS[num];
					bool playOnAwake = this.PlayOnAwake;
					audioSource5.playOnAwake = playOnAwake;
					AudioSource audioSource6 = this.g_AS[num];
					float spatialBlend = this.SpatialBlend;
					audioSource6.spatialBlend = spatialBlend;
					AudioSource audioSource7 = this.g_AS[num];
					float distanceMin = this.DistanceMin;
					audioSource7.minDistance = distanceMin;
					AudioSource audioSource8 = this.g_AS[num];
					float distanceMax = this.DistanceMax;
					audioSource8.maxDistance = distanceMax;
					AudioSource audioSource9 = this.g_AS[num];
					int priority = this.Priority;
					audioSource9.priority = priority;
					AudioSource audioSource10 = this.g_AS[num];
					AudioRolloffMode rolloff = this.Rolloff;
					audioSource10.rolloffMode = rolloff;
					num++;
				}
				this.g_iASIndex = (int)((ulong)0L);
				this.g_fVolumeSet = 1f;
				this.g_fPitchSet = 1f;
				this.g_fTimeScale = 1f;
				break;
			}
			break;
		}
	}

	// Token: 0x060000C0 RID: 192 RVA: 0x000040B4 File Offset: 0x000022B4
	[Token(Token = "0x60000C0")]
	[Address(RVA = "0x1466D80", Offset = "0x1465D80", VA = "0x181466D80")]
	public void InitData()
	{
		string tag = base.gameObject.tag;
		this.InitData(tag);
	}

	// Token: 0x060000C1 RID: 193 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60000C1")]
	[Address(RVA = "0x1467840", Offset = "0x1466840", VA = "0x181467840")]
	public void Play(int iIndex, float fVolume = 1f, float fPitch = 1f)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000C2 RID: 194 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60000C2")]
	[Address(RVA = "0x1467350", Offset = "0x1466350", VA = "0x181467350")]
	public void PlayRandom(float fVolume = 1f, float fPitch = 1f)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000C3 RID: 195 RVA: 0x000040DC File Offset: 0x000022DC
	[Token(Token = "0x60000C3")]
	[Address(RVA = "0x1468760", Offset = "0x1467760", VA = "0x181468760")]
	public void Stop()
	{
		AudioSource[] array = this.g_AS;
		if (array != 0)
		{
			int num = 0;
			int num2 = 0;
			if (num2 < array.Length)
			{
				AudioSource audioSource = array[num];
				int num3 = 0;
				if (audioSource != num3 && this.g_AS[num].isPlaying)
				{
					this.g_AS[num].Stop();
				}
				AudioSource[] array2 = this.g_AS;
				num++;
			}
			this.g_iASIndex = (int)((ulong)0L);
		}
	}

	// Token: 0x060000C4 RID: 196 RVA: 0x0000415C File Offset: 0x0000235C
	[Token(Token = "0x60000C4")]
	[Address(RVA = "0x14672C0", Offset = "0x14662C0", VA = "0x1814672C0")]
	public void Pause()
	{
		AudioSource[] array = this.g_AS;
		if (array != 0)
		{
			int num = this.g_iASIndex;
			if (array[num].isPlaying)
			{
				AudioSource[] array2 = this.g_AS;
				int num2 = this.g_iASIndex;
				array2[num2].Pause();
				return;
			}
		}
	}

	// Token: 0x060000C5 RID: 197 RVA: 0x000041AC File Offset: 0x000023AC
	[Token(Token = "0x60000C5")]
	[Address(RVA = "0x1466C50", Offset = "0x1465C50", VA = "0x181466C50")]
	public void Continue()
	{
		AudioSource[] array = this.g_AS;
		if (array != 0)
		{
			int num = this.g_iASIndex;
			if (!array[num].isPlaying)
			{
				AudioSource[] array2 = this.g_AS;
				int num2 = this.g_iASIndex;
				array2[num2].Play();
				return;
			}
		}
	}

	// Token: 0x060000C6 RID: 198 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60000C6")]
	[Address(RVA = "0x1468200", Offset = "0x1467200", VA = "0x181468200")]
	public void SetVolume(float fVolume)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000C7 RID: 199 RVA: 0x000041FC File Offset: 0x000023FC
	[Token(Token = "0x60000C7")]
	[Address(RVA = "0x1466D30", Offset = "0x1465D30", VA = "0x181466D30")]
	public float GetVolume()
	{
		AudioSource[] array = this.g_AS;
		int num = this.g_iASIndex;
		return array[num].volume;
	}

	// Token: 0x060000C8 RID: 200 RVA: 0x0000422C File Offset: 0x0000242C
	[Token(Token = "0x60000C8")]
	[Address(RVA = "0x1467FD0", Offset = "0x1466FD0", VA = "0x181467FD0")]
	public void SetPith(float fPitch)
	{
		/*
An exception occurred when decompiling this method (060000C8)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void SoundEffect::SetPith(System.Single)

 ---> System.ArgumentOutOfRangeException: Non-negative number required. (Parameter 'length')
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Array destinationArray, Int32 length)
   at ICSharpCode.Decompiler.ILAst.ILAstBuilder.StackSlot.ModifyStack(StackSlot[] stack, Int32 popCount, Int32 pushCount, ByteCode pushDefinition) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs:line 51
   at ICSharpCode.Decompiler.ILAst.ILAstBuilder.StackAnalysis(MethodDef methodDef) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs:line 401
   at ICSharpCode.Decompiler.ILAst.ILAstBuilder.Build(MethodDef methodDef, Boolean optimize, DecompilerContext context) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs:line 276
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 112
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
   --- End of inner exception stack trace ---
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
   at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1618
*/;
	}

	// Token: 0x060000C9 RID: 201 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60000C9")]
	[Address(RVA = "0x1468460", Offset = "0x1467460", VA = "0x181468460")]
	public void Set(float fVolume, float fPitch)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000CA RID: 202 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60000CA")]
	[Address(RVA = "0x1466CE0", Offset = "0x1465CE0", VA = "0x181466CE0")]
	public bool GetIsPlaying()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000CB RID: 203 RVA: 0x000042B0 File Offset: 0x000024B0
	[Token(Token = "0x60000CB")]
	[Address(RVA = "0x14680F0", Offset = "0x14670F0", VA = "0x1814680F0")]
	public void SetTimeScale(float fScale)
	{
		/*
An exception occurred when decompiling this method (060000CB)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void SoundEffect::SetTimeScale(System.Single)

 ---> System.ArgumentOutOfRangeException: Non-negative number required. (Parameter 'length')
   at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length, Boolean reliable)
   at System.Array.Copy(Array sourceArray, Array destinationArray, Int32 length)
   at ICSharpCode.Decompiler.ILAst.ILAstBuilder.StackSlot.ModifyStack(StackSlot[] stack, Int32 popCount, Int32 pushCount, ByteCode pushDefinition) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs:line 51
   at ICSharpCode.Decompiler.ILAst.ILAstBuilder.StackAnalysis(MethodDef methodDef) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs:line 401
   at ICSharpCode.Decompiler.ILAst.ILAstBuilder.Build(MethodDef methodDef, Boolean optimize, DecompilerContext context) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstBuilder.cs:line 276
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 112
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
   --- End of inner exception stack trace ---
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
   at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1618
*/;
	}

	// Token: 0x060000CC RID: 204 RVA: 0x0000433C File Offset: 0x0000253C
	[Token(Token = "0x60000CC")]
	[Address(RVA = "0x1467D70", Offset = "0x1466D70", VA = "0x181467D70")]
	public void ResetVolume()
	{
		AudioSource[] array = this.g_AS;
		if (array != 0)
		{
			int num = 0;
			if (num < array.Length)
			{
				if (array[num].isPlaying)
				{
					string text = this.soundEffectType;
					if (text != 0)
					{
						if (!string.Equals(text, "SoundEffect") && !string.Equals(text, "AreaAffectPlayer"))
						{
							if (!string.Equals(text, "Voice"))
							{
								goto IL_8C;
							}
							AudioSource[] array2 = this.g_AS;
							float voiceVolume = this.volumeSettings.GetVoiceVolume();
						}
						AudioSource[] array3 = this.g_AS;
						float soundEffectVolume = this.volumeSettings.GetSoundEffectVolume();
					}
					IL_8C:
					AudioSource audioSource = this.g_AS[num];
					float num2 = this.g_fVolumeSet;
					float wholeVolume = this.volumeSettings.GetWholeVolume();
					audioSource.volume = num2;
				}
				AudioSource[] array4 = this.g_AS;
				num++;
			}
		}
	}

	// Token: 0x060000CD RID: 205 RVA: 0x00004414 File Offset: 0x00002614
	[Token(Token = "0x60000CD")]
	[Address(RVA = "0x14688B0", Offset = "0x14678B0", VA = "0x1814688B0")]
	public SoundEffect()
	{
	}

	// Token: 0x04000115 RID: 277
	[FieldOffset(Offset = "0x18")]
	[Token(Token = "0x4000115")]
	public AudioClip[] Sound;

	// Token: 0x04000116 RID: 278
	[FieldOffset(Offset = "0x20")]
	[Token(Token = "0x4000116")]
	public int AudioSourceNum = (int)((ulong)1L);

	// Token: 0x04000117 RID: 279
	[FieldOffset(Offset = "0x28")]
	[Token(Token = "0x4000117")]
	public AudioMixerGroup AMG;

	// Token: 0x04000118 RID: 280
	[FieldOffset(Offset = "0x30")]
	[Token(Token = "0x4000118")]
	public float Volume = 1f;

	// Token: 0x04000119 RID: 281
	[FieldOffset(Offset = "0x34")]
	[Token(Token = "0x4000119")]
	public float Pitch = 1f;

	// Token: 0x0400011A RID: 282
	[FieldOffset(Offset = "0x38")]
	[Token(Token = "0x400011A")]
	public bool PitchRandom;

	// Token: 0x0400011B RID: 283
	[FieldOffset(Offset = "0x3C")]
	[Token(Token = "0x400011B")]
	public float PitchRandomRange;

	// Token: 0x0400011C RID: 284
	[FieldOffset(Offset = "0x40")]
	[Token(Token = "0x400011C")]
	public bool Loop;

	// Token: 0x0400011D RID: 285
	[FieldOffset(Offset = "0x44")]
	[Token(Token = "0x400011D")]
	public float SpatialBlend;

	// Token: 0x0400011E RID: 286
	[FieldOffset(Offset = "0x48")]
	[Token(Token = "0x400011E")]
	public float DistanceMin = 1f;

	// Token: 0x0400011F RID: 287
	[FieldOffset(Offset = "0x4C")]
	[Token(Token = "0x400011F")]
	public float DistanceMax = 500f;

	// Token: 0x04000120 RID: 288
	[FieldOffset(Offset = "0x50")]
	[Token(Token = "0x4000120")]
	public bool PlayOnAwake;

	// Token: 0x04000121 RID: 289
	[FieldOffset(Offset = "0x54")]
	[Token(Token = "0x4000121")]
	public AudioRolloffMode Rolloff;

	// Token: 0x04000122 RID: 290
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x4000122")]
	public int Priority = (int)((ulong)128L);

	// Token: 0x04000123 RID: 291
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x4000123")]
	private AudioSource[] g_AS;

	// Token: 0x04000124 RID: 292
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x4000124")]
	private int g_iASIndex;

	// Token: 0x04000125 RID: 293
	[FieldOffset(Offset = "0x6C")]
	[Token(Token = "0x4000125")]
	private float g_fVolumeSet = 1f;

	// Token: 0x04000126 RID: 294
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x4000126")]
	private float g_fPitchRandom;

	// Token: 0x04000127 RID: 295
	[FieldOffset(Offset = "0x74")]
	[Token(Token = "0x4000127")]
	private float g_fPitchSet = 1f;

	// Token: 0x04000128 RID: 296
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x4000128")]
	private float g_fTimeScale = 1f;

	// Token: 0x04000129 RID: 297
	[FieldOffset(Offset = "0x7C")]
	[Token(Token = "0x4000129")]
	private bool isInitialized;

	// Token: 0x0400012A RID: 298
	[FieldOffset(Offset = "0x80")]
	[Token(Token = "0x400012A")]
	private string soundEffectType;
}
