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

// Token: 0x0200033C RID: 828
[Token(Token = "0x200033C")]
public class CFX_SpawnSystem : MonoBehaviour
{
	// Token: 0x060020A0 RID: 8352 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60020A0")]
	[Address(RVA = "0x134A9D0", Offset = "0x13497D0", VA = "0x18134A9D0")]
	public static GameObject GetNextObject(GameObject sourceObj, bool activateObject = true)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060020A1 RID: 8353 RVA: 0x0004DB90 File Offset: 0x0004BD90
	[Token(Token = "0x60020A1")]
	[Address(RVA = "0x134B140", Offset = "0x1349F40", VA = "0x18134B140")]
	public static void PreloadObject(GameObject sourceObj, int poolSize = 1)
	{
		CFX_SpawnSystem.instance.addObjectToPool(sourceObj, poolSize);
	}

	// Token: 0x060020A2 RID: 8354 RVA: 0x0004DBB0 File Offset: 0x0004BDB0
	[Token(Token = "0x60020A2")]
	[Address(RVA = "0x134B2A0", Offset = "0x134A0A0", VA = "0x18134B2A0")]
	public static void UnloadObjects(GameObject sourceObj)
	{
		CFX_SpawnSystem.instance.removeObjectsFromPool(sourceObj);
	}

	// Token: 0x170001CE RID: 462
	// (get) Token: 0x060020A3 RID: 8355 RVA: 0x0004DBD0 File Offset: 0x0004BDD0
	[Token(Token = "0x170001CE")]
	public static bool AllObjectsLoaded
	{
		[Token(Token = "0x60020A3")]
		[Address(RVA = "0x134B720", Offset = "0x134A520", VA = "0x18134B720")]
		get
		{
			return CFX_SpawnSystem.instance.allObjectsLoaded;
		}
	}

	// Token: 0x060020A4 RID: 8356 RVA: 0x0004DBF0 File Offset: 0x0004BDF0
	[Token(Token = "0x60020A4")]
	[Address(RVA = "0x134B420", Offset = "0x134A220", VA = "0x18134B420")]
	private void addObjectToPool(GameObject sourceObject, int number)
	{
		int instanceID = sourceObject.GetInstanceID();
		Dictionary<int, List<GameObject>> dictionary = this.instantiatedObjects;
		throw new NullReferenceException();
	}

	// Token: 0x060020A5 RID: 8357 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60020A5")]
	[Address(RVA = "0x134B8D0", Offset = "0x134A6D0", VA = "0x18134B8D0")]
	private void removeObjectsFromPool(GameObject sourceObject)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060020A6 RID: 8358 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60020A6")]
	[Address(RVA = "0x134B770", Offset = "0x134A570", VA = "0x18134B770")]
	private void increasePoolCursor(int uniqueId)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060020A7 RID: 8359 RVA: 0x0004DD04 File Offset: 0x0004BF04
	[Token(Token = "0x60020A7")]
	[Address(RVA = "0x134A8E0", Offset = "0x13496E0", VA = "0x18134A8E0")]
	private void Awake()
	{
		/*
An exception occurred when decompiling this method (060020A7)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void CFX_SpawnSystem::Awake()

 ---> System.Exception: Basic block has to end with unconditional control flow. 
{; 	IL_24:; 	stsfld:CFX_SpawnSystem(CFX_SpawnSystem::instance, ldloc:CFX_SpawnSystem(this)); }; 
   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: 0x060020A8 RID: 8360 RVA: 0x0004DD3C File Offset: 0x0004BF3C
	[Token(Token = "0x60020A8")]
	[Address(RVA = "0x134B1A0", Offset = "0x1349FA0", VA = "0x18134B1A0")]
	private void Start()
	{
		this.allObjectsLoaded = false;
		int num = 0;
		GameObject[] array = this.objectsToPreload;
		if (num < array.Length)
		{
			GameObject gameObject = array[num];
			int num2 = this.objectsToPreloadTimes[num];
			CFX_SpawnSystem.instance.addObjectToPool(gameObject, num2);
			GameObject[] array2 = this.objectsToPreload;
			num++;
		}
		this.allObjectsLoaded = true;
	}

	// Token: 0x060020A9 RID: 8361 RVA: 0x0004DD9C File Offset: 0x0004BF9C
	[Token(Token = "0x60020A9")]
	[Address(RVA = "0x134B300", Offset = "0x134A100", VA = "0x18134B300")]
	public CFX_SpawnSystem()
	{
		GameObject[] array = new GameObject[0];
		this.objectsToPreload = array;
		int[] array2 = new int[0];
		this.objectsToPreloadTimes = array2;
		this.spawnAsChildren = true;
		Dictionary<int, List<GameObject>> dictionary = new Dictionary();
		this.instantiatedObjects = dictionary;
		Dictionary<int, int> dictionary2 = new Dictionary();
		this.poolCursors = dictionary2;
		base..ctor();
	}

	// Token: 0x040029E7 RID: 10727
	[Token(Token = "0x40029E7")]
	private static CFX_SpawnSystem instance;

	// Token: 0x040029E8 RID: 10728
	[FieldOffset(Offset = "0x18")]
	[Token(Token = "0x40029E8")]
	public GameObject[] objectsToPreload;

	// Token: 0x040029E9 RID: 10729
	[FieldOffset(Offset = "0x20")]
	[Token(Token = "0x40029E9")]
	public int[] objectsToPreloadTimes;

	// Token: 0x040029EA RID: 10730
	[FieldOffset(Offset = "0x28")]
	[Token(Token = "0x40029EA")]
	public bool hideObjectsInHierarchy;

	// Token: 0x040029EB RID: 10731
	[FieldOffset(Offset = "0x29")]
	[Token(Token = "0x40029EB")]
	public bool spawnAsChildren;

	// Token: 0x040029EC RID: 10732
	[FieldOffset(Offset = "0x2A")]
	[Token(Token = "0x40029EC")]
	public bool onlyGetInactiveObjects;

	// Token: 0x040029ED RID: 10733
	[FieldOffset(Offset = "0x2B")]
	[Token(Token = "0x40029ED")]
	public bool instantiateIfNeeded;

	// Token: 0x040029EE RID: 10734
	[FieldOffset(Offset = "0x2C")]
	[Token(Token = "0x40029EE")]
	private bool allObjectsLoaded;

	// Token: 0x040029EF RID: 10735
	[FieldOffset(Offset = "0x30")]
	[Token(Token = "0x40029EF")]
	private Dictionary<int, List<GameObject>> instantiatedObjects;

	// Token: 0x040029F0 RID: 10736
	[FieldOffset(Offset = "0x38")]
	[Token(Token = "0x40029F0")]
	private Dictionary<int, int> poolCursors;
}
