using System;
using Cpp2IlInjected;
using Steamworks;
using UnityEngine;

// Token: 0x02000104 RID: 260
[Token(Token = "0x2000104")]
public class SteamAchievementSystem : IAchievementSystem
{
	// Token: 0x06000E54 RID: 3668 RVA: 0x00022500 File Offset: 0x00020700
	[Token(Token = "0x6000E54")]
	[Address(RVA = "0x44F860", Offset = "0x44E660", VA = "0x18044F860")]
	public SteamAchievementSystem(string[] achievementKeys)
	{
		/*
An exception occurred when decompiling this method (06000E54)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void SteamAchievementSystem::.ctor(System.String[])

 ---> System.Exception: Basic block has to end with unconditional control flow. 
{; 	Block_0:; 	call:void(object::.ctor, ldloc:SteamAchievementSystem[exp:object](this)); 	stfld:string[](SteamAchievementSystem::achievementKeys, ldloc:SteamAchievementSystem(this), ldloc:string[](achievementKeys)); }; 
   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: 0x06000E55 RID: 3669 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6000E55")]
	[Address(RVA = "0xAB54B0", Offset = "0xAB42B0", VA = "0x180AB54B0", Slot = "4")]
	public bool HasUnlocked(int index)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06000E56 RID: 3670 RVA: 0x0002251C File Offset: 0x0002071C
	[Token(Token = "0x6000E56")]
	[Address(RVA = "0xAB5500", Offset = "0xAB4300", VA = "0x180AB5500", Slot = "5")]
	public void Unlock(int index)
	{
		bool flag = SteamUserStats.SetAchievement(this.achievementKeys[index]);
		bool flag2 = SteamUserStats.StoreStats();
	}

	// Token: 0x06000E57 RID: 3671 RVA: 0x0002254C File Offset: 0x0002074C
	[Token(Token = "0x6000E57")]
	[Address(RVA = "0xAB5290", Offset = "0xAB4090", VA = "0x180AB5290")]
	public void ClearAll()
	{
		string[] array = this.achievementKeys;
		int num = 0;
		if (num < array.Length)
		{
			string text = this.achievementKeys[num];
			if (!SteamUserStats.ClearAchievement(text))
			{
				Debug.LogError("Clear steam achievement failed: " + text);
			}
			string[] array2 = this.achievementKeys;
			num++;
		}
		if (!SteamUserStats.StoreStats())
		{
			Debug.LogError("Store all steam achievements failed.");
		}
	}

	// Token: 0x06000E58 RID: 3672 RVA: 0x000225B8 File Offset: 0x000207B8
	[Token(Token = "0x6000E58")]
	[Address(RVA = "0xAB53F0", Offset = "0xAB41F0", VA = "0x180AB53F0")]
	private void Clear(int index)
	{
		string text = this.achievementKeys[index];
		if (!SteamUserStats.ClearAchievement(text))
		{
			Debug.LogError("Clear steam achievement failed: " + text);
		}
	}

	// Token: 0x04001904 RID: 6404
	[FieldOffset(Offset = "0x10")]
	[Token(Token = "0x4001904")]
	private string[] achievementKeys;
}
