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

// Token: 0x0200012A RID: 298
[Token(Token = "0x200012A")]
public class SteamAchievementSystem : IAchievementSystem
{
	// Token: 0x06000F7F RID: 3967 RVA: 0x000242D4 File Offset: 0x000224D4
	[Token(Token = "0x6000F7F")]
	[Address(RVA = "0x4940F0", Offset = "0x4930F0", VA = "0x1804940F0")]
	public SteamAchievementSystem(string[] achievementKeys)
	{
		/*
An exception occurred when decompiling this method (06000F7F)

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: 0x06000F80 RID: 3968 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6000F80")]
	[Address(RVA = "0x985EE0", Offset = "0x984EE0", VA = "0x180985EE0", Slot = "4")]
	public bool HasUnlocked(int index)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06000F81 RID: 3969 RVA: 0x000242F0 File Offset: 0x000224F0
	[Token(Token = "0x6000F81")]
	[Address(RVA = "0x985F30", Offset = "0x984F30", VA = "0x180985F30", Slot = "5")]
	public void Unlock(int index)
	{
		bool flag = SteamUserStats.SetAchievement(this.achievementKeys[index]);
		bool flag2 = SteamUserStats.StoreStats();
	}

	// Token: 0x06000F82 RID: 3970 RVA: 0x00024320 File Offset: 0x00022520
	[Token(Token = "0x6000F82")]
	[Address(RVA = "0x985CC0", Offset = "0x984CC0", VA = "0x180985CC0")]
	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: 0x06000F83 RID: 3971 RVA: 0x0002438C File Offset: 0x0002258C
	[Token(Token = "0x6000F83")]
	[Address(RVA = "0x985E20", Offset = "0x984E20", VA = "0x180985E20")]
	private void Clear(int index)
	{
		string text = this.achievementKeys[index];
		if (!SteamUserStats.ClearAchievement(text))
		{
			Debug.LogError("Clear steam achievement failed: " + text);
		}
	}

	// Token: 0x04001A0D RID: 6669
	[FieldOffset(Offset = "0x10")]
	[Token(Token = "0x4001A0D")]
	private string[] achievementKeys;
}
