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

// Token: 0x02000394 RID: 916
[Token(Token = "0x2000394")]
public class CFX_SpawnSystem : MonoBehaviour
{
	// Token: 0x06002369 RID: 9065 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6002369")]
	[Address(RVA = "0xB8B2B0", Offset = "0xB8A2B0", VA = "0x180B8B2B0")]
	public static GameObject GetNextObject(GameObject sourceObj, bool activateObject = true)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600236A RID: 9066 RVA: 0x00054E10 File Offset: 0x00053010
	[Token(Token = "0x600236A")]
	[Address(RVA = "0xB8BA20", Offset = "0xB8AA20", VA = "0x180B8BA20")]
	public static void PreloadObject(GameObject sourceObj, int poolSize = 1)
	{
		CFX_SpawnSystem.instance.addObjectToPool(sourceObj, poolSize);
	}

	// Token: 0x0600236B RID: 9067 RVA: 0x00054E30 File Offset: 0x00053030
	[Token(Token = "0x600236B")]
	[Address(RVA = "0xB8BB80", Offset = "0xB8AB80", VA = "0x180B8BB80")]
	public static void UnloadObjects(GameObject sourceObj)
	{
		CFX_SpawnSystem.instance.removeObjectsFromPool(sourceObj);
	}

	// Token: 0x170001F3 RID: 499
	// (get) Token: 0x0600236C RID: 9068 RVA: 0x00054E50 File Offset: 0x00053050
	[Token(Token = "0x170001F3")]
	public static bool AllObjectsLoaded
	{
		[Token(Token = "0x600236C")]
		[Address(RVA = "0xB8C000", Offset = "0xB8B000", VA = "0x180B8C000")]
		get
		{
			return CFX_SpawnSystem.instance.allObjectsLoaded;
		}
	}

	// Token: 0x0600236D RID: 9069 RVA: 0x00054E70 File Offset: 0x00053070
	[Token(Token = "0x600236D")]
	[Address(RVA = "0xB8BD00", Offset = "0xB8AD00", VA = "0x180B8BD00")]
	private void addObjectToPool(GameObject sourceObject, int number)
	{
		int instanceID = sourceObject.GetInstanceID();
		Dictionary<int, List<GameObject>> dictionary = this.instantiatedObjects;
		throw new NullReferenceException();
	}

	// Token: 0x0600236E RID: 9070 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600236E")]
	[Address(RVA = "0xB8C1B0", Offset = "0xB8B1B0", VA = "0x180B8C1B0")]
	private void removeObjectsFromPool(GameObject sourceObject)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600236F RID: 9071 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600236F")]
	[Address(RVA = "0xB8C050", Offset = "0xB8B050", VA = "0x180B8C050")]
	private void increasePoolCursor(int uniqueId)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06002370 RID: 9072 RVA: 0x00054F84 File Offset: 0x00053184
	[Token(Token = "0x6002370")]
	[Address(RVA = "0xB8B1C0", Offset = "0xB8A1C0", VA = "0x180B8B1C0")]
	private void Awake()
	{
		/*
An exception occurred when decompiling this method (06002370)

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: 0x06002371 RID: 9073 RVA: 0x00054FBC File Offset: 0x000531BC
	[Token(Token = "0x6002371")]
	[Address(RVA = "0xB8BA80", Offset = "0xB8AA80", VA = "0x180B8BA80")]
	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: 0x06002372 RID: 9074 RVA: 0x0005501C File Offset: 0x0005321C
	[Token(Token = "0x6002372")]
	[Address(RVA = "0xB8BBE0", Offset = "0xB8ABE0", VA = "0x180B8BBE0")]
	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: 0x04002CD1 RID: 11473
	[Token(Token = "0x4002CD1")]
	private static CFX_SpawnSystem instance;

	// Token: 0x04002CD2 RID: 11474
	[FieldOffset(Offset = "0x18")]
	[Token(Token = "0x4002CD2")]
	public GameObject[] objectsToPreload;

	// Token: 0x04002CD3 RID: 11475
	[FieldOffset(Offset = "0x20")]
	[Token(Token = "0x4002CD3")]
	public int[] objectsToPreloadTimes;

	// Token: 0x04002CD4 RID: 11476
	[FieldOffset(Offset = "0x28")]
	[Token(Token = "0x4002CD4")]
	public bool hideObjectsInHierarchy;

	// Token: 0x04002CD5 RID: 11477
	[FieldOffset(Offset = "0x29")]
	[Token(Token = "0x4002CD5")]
	public bool spawnAsChildren;

	// Token: 0x04002CD6 RID: 11478
	[FieldOffset(Offset = "0x2A")]
	[Token(Token = "0x4002CD6")]
	public bool onlyGetInactiveObjects;

	// Token: 0x04002CD7 RID: 11479
	[FieldOffset(Offset = "0x2B")]
	[Token(Token = "0x4002CD7")]
	public bool instantiateIfNeeded;

	// Token: 0x04002CD8 RID: 11480
	[FieldOffset(Offset = "0x2C")]
	[Token(Token = "0x4002CD8")]
	private bool allObjectsLoaded;

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

	// Token: 0x04002CDA RID: 11482
	[FieldOffset(Offset = "0x38")]
	[Token(Token = "0x4002CDA")]
	private Dictionary<int, int> poolCursors;
}
