using System;
using System.Collections.Generic;
using Cpp2IlInjected;
using MEC;
using UnityEngine;

// Token: 0x02000018 RID: 24
[Token(Token = "0x2000018")]
public class BGM : MonoBehaviour
{
	// Token: 0x06000094 RID: 148 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6000094")]
	[Address(RVA = "0x8D3390", Offset = "0x8D2190", VA = "0x1808D3390")]
	public void Init()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06000095 RID: 149 RVA: 0x000039FC File Offset: 0x00001BFC
	[Token(Token = "0x6000095")]
	[Address(RVA = "0x8D3570", Offset = "0x8D2370", VA = "0x1808D3570")]
	public void PlayBGM(float playingTime = 0f)
	{
		if (!this.isPlaying)
		{
			float length = this.Begin.length;
			Debug.LogError("BGM播放長度錯誤");
			this.Prepare();
			bool flag = this.audioSource.isPlaying;
			AudioSource audioSource = this.audioSource;
			if (flag)
			{
				AudioClip clip = audioSource.clip;
				AudioClip begin = this.Begin;
				if (!(clip == begin))
				{
					goto IL_B9;
				}
				AudioClip loop = this.Loop;
				int num = 0;
				bool flag2 = loop != num;
			}
			AudioClip begin2 = this.Begin;
			audioSource.clip = begin2;
			this.audioSource.time = playingTime;
			this.audioSource.Play();
			if (this.Loop)
			{
				CoroutineHandle coroutineHandle = MECExtensionMethods1.RunCoroutine(this.WaitForLoop());
				this.playProcessor = coroutineHandle;
			}
			IL_B9:
			this.VerifyFadeInProcessor();
		}
	}

	// Token: 0x06000096 RID: 150 RVA: 0x00003AD0 File Offset: 0x00001CD0
	[Token(Token = "0x6000096")]
	[Address(RVA = "0x8D38F0", Offset = "0x8D26F0", VA = "0x1808D38F0")]
	public void SwitchBGM(float playingTime)
	{
		if (!this.isPlaying)
		{
			this.Prepare();
			if (this.CheckLength.length <= playingTime)
			{
				AudioClip checkLength = this.CheckLength;
				AudioClip loop = this.Loop;
				float length = checkLength.length;
				this.audioSource.clip = loop;
				this.audioSource.time = playingTime;
				this.audioSource.Play();
			}
			AudioSource audioSource = this.audioSource;
			AudioClip begin = this.Begin;
			audioSource.clip = begin;
			this.audioSource.time = playingTime;
			this.audioSource.Play();
			if (this.Loop)
			{
				CoroutineHandle coroutineHandle = MECExtensionMethods1.RunCoroutine(this.WaitForLoop());
				this.playProcessor = coroutineHandle;
			}
			this.VerifyFadeInProcessor();
		}
	}

	// Token: 0x06000097 RID: 151 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6000097")]
	[Address(RVA = "0x8D3760", Offset = "0x8D2560", VA = "0x1808D3760")]
	private void Prepare()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06000098 RID: 152 RVA: 0x00003B94 File Offset: 0x00001D94
	[Token(Token = "0x6000098")]
	[Address(RVA = "0x8D3510", Offset = "0x8D2310", VA = "0x1808D3510")]
	private void PlayAudio(AudioClip clip, float playingTime = 0f)
	{
		this.audioSource.clip = clip;
		this.audioSource.time = playingTime;
		this.audioSource.Play();
	}

	// Token: 0x06000099 RID: 153 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6000099")]
	[Address(RVA = "0x8D3C50", Offset = "0x8D2A50", VA = "0x1808D3C50")]
	private IEnumerator<float> WaitForLoop()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600009A RID: 154 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600009A")]
	[Address(RVA = "0x8D3B50", Offset = "0x8D2950", VA = "0x1808D3B50")]
	private void VerifyFadeInProcessor()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600009B RID: 155 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600009B")]
	[Address(RVA = "0x8D3160", Offset = "0x8D1F60", VA = "0x1808D3160")]
	private IEnumerator<float> FadeIn()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600009C RID: 156 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600009C")]
	[Address(RVA = "0x8D3240", Offset = "0x8D2040", VA = "0x1808D3240")]
	public float GetPlayingTime()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600009D RID: 157 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600009D")]
	[Address(RVA = "0x8D37D0", Offset = "0x8D25D0", VA = "0x1808D37D0")]
	public void StopBGM()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600009E RID: 158 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600009E")]
	[Address(RVA = "0x8D31D0", Offset = "0x8D1FD0", VA = "0x1808D31D0")]
	private IEnumerator<float> FadeOut()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600009F RID: 159 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600009F")]
	[Address(RVA = "0x8D3A70", Offset = "0x8D2870", VA = "0x1808D3A70")]
	public void UpdateVolume(VolumeSettings settings)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000A0 RID: 160 RVA: 0x00003BCC File Offset: 0x00001DCC
	[Token(Token = "0x60000A0")]
	[Address(RVA = "0x8D3AA0", Offset = "0x8D28A0", VA = "0x1808D3AA0")]
	public void UpdateVolume()
	{
		/*
An exception occurred when decompiling this method (060000A0)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void BGM::UpdateVolume()

 ---> 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: 0x060000A1 RID: 161 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60000A1")]
	[Address(RVA = "0x8D30B0", Offset = "0x8D1EB0", VA = "0x1808D30B0")]
	public void Dispose()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000A2 RID: 162 RVA: 0x00003C08 File Offset: 0x00001E08
	[Token(Token = "0x60000A2")]
	[Address(RVA = "0x3088F0", Offset = "0x3076F0", VA = "0x1803088F0")]
	public BGM()
	{
	}

	// Token: 0x040000F7 RID: 247
	[FieldOffset(Offset = "0x18")]
	[Token(Token = "0x40000F7")]
	public AudioClip Begin;

	// Token: 0x040000F8 RID: 248
	[FieldOffset(Offset = "0x20")]
	[Token(Token = "0x40000F8")]
	public AudioClip Loop;

	// Token: 0x040000F9 RID: 249
	[FieldOffset(Offset = "0x28")]
	[Token(Token = "0x40000F9")]
	public AudioClip CheckLength;

	// Token: 0x040000FA RID: 250
	[FieldOffset(Offset = "0x30")]
	[Token(Token = "0x40000FA")]
	public float g_fPlayFadeIn;

	// Token: 0x040000FB RID: 251
	[FieldOffset(Offset = "0x34")]
	[Token(Token = "0x40000FB")]
	[SerializeField]
	private float originalVolume;

	// Token: 0x040000FC RID: 252
	[FieldOffset(Offset = "0x38")]
	[Token(Token = "0x40000FC")]
	[SerializeField]
	private float volumeFactor;

	// Token: 0x040000FD RID: 253
	[FieldOffset(Offset = "0x3C")]
	[Token(Token = "0x40000FD")]
	[SerializeField]
	private bool isPlaying;

	// Token: 0x040000FE RID: 254
	[FieldOffset(Offset = "0x40")]
	[Token(Token = "0x40000FE")]
	private AudioSource audioSource;

	// Token: 0x040000FF RID: 255
	[Token(Token = "0x40000FF")]
	private const float STOP_FADE_OUT_DURATION = 4f;

	// Token: 0x04000100 RID: 256
	[FieldOffset(Offset = "0x48")]
	[Token(Token = "0x4000100")]
	private CoroutineHandle playProcessor;

	// Token: 0x04000101 RID: 257
	[FieldOffset(Offset = "0x4C")]
	[Token(Token = "0x4000101")]
	private CoroutineHandle fadingProcessor;
}
