using System;
using System.Runtime.CompilerServices;
using Cpp2IlInjected;
using UnityEngine;

// Token: 0x02000131 RID: 305
[Token(Token = "0x2000131")]
public sealed class AssetLoader
{
	// Token: 0x17000054 RID: 84
	// (get) Token: 0x06000F96 RID: 3990 RVA: 0x00024590 File Offset: 0x00022790
	[Token(Token = "0x17000054")]
	public bool IsHandling
	{
		[Token(Token = "0x6000F96")]
		[Address(RVA = "0x335430", Offset = "0x334430", VA = "0x180335430")]
		get
		{
			return this.isHandling;
		}
	}

	// Token: 0x17000055 RID: 85
	// (get) Token: 0x06000F97 RID: 3991 RVA: 0x000245A4 File Offset: 0x000227A4
	// (set) Token: 0x06000F98 RID: 3992 RVA: 0x000245B8 File Offset: 0x000227B8
	[Token(Token = "0x17000055")]
	public Action<AssetRequestBase, UnityEngine.Object[]> OnFinished
	{
		[Token(Token = "0x6000F97")]
		[Address(RVA = "0x2EF530", Offset = "0x2EE530", VA = "0x1802EF530")]
		[CompilerGenerated]
		get
		{
			return this.<OnFinished>k__BackingField;
		}
		[Token(Token = "0x6000F98")]
		[Address(RVA = "0x475600", Offset = "0x474600", VA = "0x180475600")]
		[CompilerGenerated]
		set
		{
			/*
An exception occurred when decompiling this method (06000F98)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void AssetLoader::set_OnFinished(System.Action`2<AssetRequestBase,UnityEngine.Object[]>)

 ---> System.Exception: Basic block has to end with unconditional control flow. 
{; 	Block_0:; 	stfld:class [mscorlib]System.Action`2<class AssetRequestBase, class [UnityEngine.CoreModule]UnityEngine.Object[]>(AssetLoader::<OnFinished>k__BackingField, ldloc:AssetLoader(this), ldloc:class [mscorlib]System.Action`2<class AssetRequestBase, class [UnityEngine.CoreModule]UnityEngine.Object[]>(value)); }; 
   at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1810
   at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 344
   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 123
   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: 0x06000F99 RID: 3993 RVA: 0x000245CC File Offset: 0x000227CC
	[Token(Token = "0x6000F99")]
	[Address(RVA = "0xDB47B0", Offset = "0xDB37B0", VA = "0x180DB47B0")]
	public void Load(AssetRequestBase req)
	{
		if (!this.isHandling)
		{
			this.isHandling = true;
			this.LoadFromResources(req);
			return;
		}
	}

	// Token: 0x06000F9A RID: 3994 RVA: 0x000245F4 File Offset: 0x000227F4
	[Token(Token = "0x6000F9A")]
	[Address(RVA = "0xDB45C0", Offset = "0xDB35C0", VA = "0x180DB45C0")]
	private void LoadFromResources(AssetRequestBase req)
	{
		UnityEngine.Object @object;
		UnityEngine.Object[] array;
		do
		{
			int num = 0;
			if ((req.<IncludeSubAssets>k__BackingField ? 1 : 0) != num)
			{
				goto IL_53;
			}
			string rootPath = req.RootPath;
			string <AssetName>k__BackingField = req.<AssetName>k__BackingField;
			@object = Resources.Load(rootPath + "/" + <AssetName>k__BackingField);
			int num2 = 0;
			if (!(@object != num2))
			{
				goto IL_78;
			}
			array = new UnityEngine.Object[1];
		}
		while (@object != 0 && array == 0);
		array[0] = @object;
		IL_53:
		string rootPath2 = req.RootPath;
		string <AssetName>k__BackingField2 = req.<AssetName>k__BackingField;
		UnityEngine.Object[] array2 = Resources.LoadAll(rootPath2 + "/" + <AssetName>k__BackingField2);
		IL_78:
		this.<OnFinished>k__BackingField(req, array2);
	}

	// Token: 0x06000F9B RID: 3995 RVA: 0x00024690 File Offset: 0x00022890
	[Token(Token = "0x6000F9B")]
	[Address(RVA = "0x36ABD0", Offset = "0x369BD0", VA = "0x18036ABD0")]
	public AssetLoader()
	{
	}

	// Token: 0x04001A10 RID: 6672
	[FieldOffset(Offset = "0x10")]
	[Token(Token = "0x4001A10")]
	private bool isHandling;
}
