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

// Token: 0x02000019 RID: 25
[Token(Token = "0x2000019")]
public class BGM : MonoBehaviour
{
	// Token: 0x06000095 RID: 149 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6000095")]
	[Address(RVA = "0x79EA50", Offset = "0x79DA50", VA = "0x18079EA50")]
	public void Init()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06000096 RID: 150 RVA: 0x0000395C File Offset: 0x00001B5C
	[Token(Token = "0x6000096")]
	[Address(RVA = "0x79EC30", Offset = "0x79DC30", VA = "0x18079EC30")]
	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: 0x06000097 RID: 151 RVA: 0x00003A30 File Offset: 0x00001C30
	[Token(Token = "0x6000097")]
	[Address(RVA = "0x79EFB0", Offset = "0x79DFB0", VA = "0x18079EFB0")]
	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: 0x06000098 RID: 152 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6000098")]
	[Address(RVA = "0x79EE20", Offset = "0x79DE20", VA = "0x18079EE20")]
	private void Prepare()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06000099 RID: 153 RVA: 0x00003AF4 File Offset: 0x00001CF4
	[Token(Token = "0x6000099")]
	[Address(RVA = "0x79EBD0", Offset = "0x79DBD0", VA = "0x18079EBD0")]
	private void PlayAudio(AudioClip clip, float playingTime = 0f)
	{
		this.audioSource.clip = clip;
		this.audioSource.time = playingTime;
		this.audioSource.Play();
	}

	// Token: 0x0600009A RID: 154 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600009A")]
	[Address(RVA = "0x79F310", Offset = "0x79E310", VA = "0x18079F310")]
	private IEnumerator<float> WaitForLoop()
	{
		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 = "0x79F210", Offset = "0x79E210", VA = "0x18079F210")]
	private void VerifyFadeInProcessor()
	{
		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 = "0x79E820", Offset = "0x79D820", VA = "0x18079E820")]
	private IEnumerator<float> FadeIn()
	{
		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 = "0x79E900", Offset = "0x79D900", VA = "0x18079E900")]
	public float GetPlayingTime()
	{
		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 = "0x79EE90", Offset = "0x79DE90", VA = "0x18079EE90")]
	public void StopBGM()
	{
		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 = "0x79E890", Offset = "0x79D890", VA = "0x18079E890")]
	private IEnumerator<float> FadeOut()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000A0 RID: 160 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60000A0")]
	[Address(RVA = "0x79F130", Offset = "0x79E130", VA = "0x18079F130")]
	public void UpdateVolume(VolumeSettings settings)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000A1 RID: 161 RVA: 0x00003B2C File Offset: 0x00001D2C
	[Token(Token = "0x60000A1")]
	[Address(RVA = "0x79F160", Offset = "0x79E160", VA = "0x18079F160")]
	public void UpdateVolume()
	{
		/*
An exception occurred when decompiling this method (060000A1)

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: 0x060000A2 RID: 162 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60000A2")]
	[Address(RVA = "0x79E770", Offset = "0x79D770", VA = "0x18079E770")]
	public void Dispose()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060000A3 RID: 163 RVA: 0x00003B68 File Offset: 0x00001D68
	[Token(Token = "0x60000A3")]
	[Address(RVA = "0x328C40", Offset = "0x327C40", VA = "0x180328C40")]
	public BGM()
	{
	}

	// Token: 0x040000FC RID: 252
	[FieldOffset(Offset = "0x18")]
	[Token(Token = "0x40000FC")]
	public AudioClip Begin;

	// Token: 0x040000FD RID: 253
	[FieldOffset(Offset = "0x20")]
	[Token(Token = "0x40000FD")]
	public AudioClip Loop;

	// Token: 0x040000FE RID: 254
	[FieldOffset(Offset = "0x28")]
	[Token(Token = "0x40000FE")]
	public AudioClip CheckLength;

	// Token: 0x040000FF RID: 255
	[FieldOffset(Offset = "0x30")]
	[Token(Token = "0x40000FF")]
	public float g_fPlayFadeIn;

	// Token: 0x04000100 RID: 256
	[FieldOffset(Offset = "0x34")]
	[Token(Token = "0x4000100")]
	[SerializeField]
	private float originalVolume;

	// Token: 0x04000101 RID: 257
	[FieldOffset(Offset = "0x38")]
	[Token(Token = "0x4000101")]
	[SerializeField]
	private float volumeFactor;

	// Token: 0x04000102 RID: 258
	[FieldOffset(Offset = "0x3C")]
	[Token(Token = "0x4000102")]
	[SerializeField]
	private bool isPlaying;

	// Token: 0x04000103 RID: 259
	[FieldOffset(Offset = "0x40")]
	[Token(Token = "0x4000103")]
	private AudioSource audioSource;

	// Token: 0x04000104 RID: 260
	[Token(Token = "0x4000104")]
	private const float STOP_FADE_OUT_DURATION = 4f;

	// Token: 0x04000105 RID: 261
	[FieldOffset(Offset = "0x48")]
	[Token(Token = "0x4000105")]
	private CoroutineHandle playProcessor;

	// Token: 0x04000106 RID: 262
	[FieldOffset(Offset = "0x4C")]
	[Token(Token = "0x4000106")]
	private CoroutineHandle fadingProcessor;
}
