using System;
using System.Collections.Generic;
using System.Linq;
using Cpp2IlInjected;
using DG.Tweening;
using MarsSDK;
using UnityEngine;
using UnityEngine.UI;

// Token: 0x0200024E RID: 590
[Token(Token = "0x200024E")]
public class UISkin : GameCanvasBase
{
	// Token: 0x060016C4 RID: 5828 RVA: 0x00036C8C File Offset: 0x00034E8C
	[Token(Token = "0x60016C4")]
	[Address(RVA = "0x18AB0B0", Offset = "0x18A9EB0", VA = "0x1818AB0B0", Slot = "11")]
	public override void Init()
	{
		GameTextDataAdvance gameTextDataAdvance = Game.GetAchievementText();
		this.achievementText = gameTextDataAdvance;
		this.InitIcons();
		this.InitHandlers();
		this.switchPageTip.Init();
	}

	// Token: 0x060016C5 RID: 5829 RVA: 0x00036CC8 File Offset: 0x00034EC8
	[Token(Token = "0x60016C5")]
	[Address(RVA = "0x18AAD80", Offset = "0x18A9B80", VA = "0x1818AAD80")]
	private void InitIcons()
	{
		Dictionary<GameSkin, UISkinIcon> dictionary = new Dictionary();
		this.iconMap = dictionary;
		IGamePlatform <Platform>k__BackingField = Game.<Platform>k__BackingField;
		int num = 0;
		bool useAchievement = Game.useAchievement;
		if (num < (useAchievement ? 1 : 0))
		{
			GameObject gameObject = Resources.Load<GameObject>(string.Format("SkinUI/{0}", num));
			int num2 = 0;
			if (gameObject == num2)
			{
				GameSkin gameSkin;
				GameObject gameObject2 = Resources.Load<GameObject>(string.Format("SkinUI/{0}", gameSkin));
			}
			RectTransform rectTransform = this.skinIconRoot;
			GameObject gameObject3 = UnityEngine.Object.Instantiate<GameObject>(gameObject, rectTransform).GetComponent<UISkinIcon>().gameObject;
			int num3 = 0;
			gameObject3.SetActive(num3 != 0);
			Dictionary<GameSkin, UISkinIcon> dictionary2 = this.iconMap;
			throw new NullReferenceException();
		}
	}

	// Token: 0x060016C6 RID: 5830 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016C6")]
	[Address(RVA = "0x18AA530", Offset = "0x18A9330", VA = "0x1818AA530")]
	private void InitHandlers()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016C7 RID: 5831 RVA: 0x00036D6C File Offset: 0x00034F6C
	[Token(Token = "0x60016C7")]
	[Address(RVA = "0x18A9B30", Offset = "0x18A8930", VA = "0x1818A9B30", Slot = "12")]
	protected override void Appear(Action completeHandler)
	{
		this.UpdateActiveSkins();
		GameSkin[] array = this.activeSkins;
		int num = 0;
		if (num < array.Length)
		{
			GameSkin gameSkin = array[num];
			GameCollection collection = Game.Collection;
			if (gameSkin != collection.currentSkin)
			{
				GameSkin[] array2 = this.activeSkins;
				num++;
			}
		}
		this.selectionIndex = num;
		UISkinIcon[] array3 = this.activeIcons;
		if (num < array3.Length)
		{
			UISkinIcon uiskinIcon = array3[num];
			uiskinIcon.index = num;
			int num2 = 0;
			uiskinIcon.UpdatePosition(num2);
			UISkinIcon[] array4 = this.activeIcons;
			num++;
			while (array4 != 0)
			{
			}
		}
		this.UpdateUnlockStats();
		GameSkin[] array5 = this.activeSkins;
		Func<GameSkin, string> func = new Func(this.GetUnlockConditionText);
		string[] array6 = Enumerable.ToArray<string>(Enumerable.Select<GameSkin, string>(array5, func));
		this.unlockConditionText = array6;
		this.UpdateSkinText();
		UINavigator navigator = this.navigator;
		UILabelHandler uilabelHandler = this.cancel;
		navigator.SetDefaultHandler(uilabelHandler);
		GameObject gameObject = this.submissionEffect.gameObject;
		int num3 = 0;
		gameObject.SetActive(num3 != 0);
		UISkinIcon[] array7 = this.activeIcons;
		UISwitchArrowController uiswitchArrowController = this.arrowController;
		int num4 = this.selectionIndex;
		int length = array7.Length;
		uiswitchArrowController.pageAmount = length;
		uiswitchArrowController.UpdateArrowState(num4);
		base.Appear(completeHandler);
	}

	// Token: 0x060016C8 RID: 5832 RVA: 0x00036EAC File Offset: 0x000350AC
	[Token(Token = "0x60016C8")]
	[Address(RVA = "0x18AA4F0", Offset = "0x18A92F0", VA = "0x1818AA4F0", Slot = "13")]
	protected override void Hide(Action completeHandler)
	{
		Sequence sequence = this.sequence;
		if (sequence != 0)
		{
			int num = 0;
			sequence.Kill(num != 0);
		}
		base.Hide(completeHandler);
	}

	// Token: 0x060016C9 RID: 5833 RVA: 0x00036ED4 File Offset: 0x000350D4
	[Token(Token = "0x60016C9")]
	[Address(RVA = "0x18ABC60", Offset = "0x18AAA60", VA = "0x1818ABC60", Slot = "19")]
	public override void SwitchLeftward()
	{
		UISwitchArrowController uiswitchArrowController = this.arrowController;
		Func<int> trySwitchLeftward = uiswitchArrowController.trySwitchLeftward;
		if (trySwitchLeftward != 0)
		{
			int num = trySwitchLeftward();
			if (num != -1)
			{
				uiswitchArrowController.switchArrows[0].PerformClickEffect();
				uiswitchArrowController.UpdateArrowState(num);
			}
		}
	}

	// Token: 0x060016CA RID: 5834 RVA: 0x00036F1C File Offset: 0x0003511C
	[Token(Token = "0x60016CA")]
	[Address(RVA = "0x18AC000", Offset = "0x18AAE00", VA = "0x1818AC000")]
	private int TrySwitchLeftward()
	{
		int num = this.selectionIndex;
		if (num != 0)
		{
			this.selectionIndex = num;
			this.SwitchSkinPreviews();
			return this.selectionIndex;
		}
		return -1;
	}

	// Token: 0x060016CB RID: 5835 RVA: 0x00036F4C File Offset: 0x0003514C
	[Token(Token = "0x60016CB")]
	[Address(RVA = "0x18ABD00", Offset = "0x18AAB00", VA = "0x1818ABD00", Slot = "20")]
	public override void SwitchRightward()
	{
		UISwitchArrowController uiswitchArrowController = this.arrowController;
		Func<int> trySwitchRightward = uiswitchArrowController.trySwitchRightward;
		if (trySwitchRightward != 0)
		{
			int num = trySwitchRightward();
			if (num != -1)
			{
				uiswitchArrowController.switchArrows[1].PerformClickEffect();
				uiswitchArrowController.UpdateArrowState(num);
			}
		}
	}

	// Token: 0x060016CC RID: 5836 RVA: 0x00036F94 File Offset: 0x00035194
	[Token(Token = "0x60016CC")]
	[Address(RVA = "0x18AC040", Offset = "0x18AAE40", VA = "0x1818AC040")]
	private int TrySwitchRightward()
	{
		int length = this.activeSkins.Length;
		int num = this.selectionIndex;
		if (num != length)
		{
			int num2 = num + 1;
			this.selectionIndex = num2;
			this.SwitchSkinPreviews();
			return this.selectionIndex;
		}
		return -1;
	}

	// Token: 0x060016CD RID: 5837 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016CD")]
	[Address(RVA = "0x18ABDA0", Offset = "0x18AABA0", VA = "0x1818ABDA0")]
	private void SwitchSkinPreviews()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016CE RID: 5838 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016CE")]
	[Address(RVA = "0x18AB140", Offset = "0x18A9F40", VA = "0x1818AB140")]
	private void JoinSelectionArrowEffect(Sequence sequence, float duration)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016CF RID: 5839 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016CF")]
	[Address(RVA = "0x18AB7F0", Offset = "0x18AA5F0", VA = "0x1818AB7F0", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016D0 RID: 5840 RVA: 0x00036FD8 File Offset: 0x000351D8
	[Token(Token = "0x60016D0")]
	[Address(RVA = "0x18AB820", Offset = "0x18AA620", VA = "0x1818AB820")]
	private void OnHandlerSelected(UIHandlerBase handler)
	{
		UINavigationEffect uinavigationEffect = this.navigationEffect;
		Vector2 anchoredPosition = handler.rectTransform.anchoredPosition;
		uinavigationEffect.UpdatePos(anchoredPosition);
		UINavigationEffect uinavigationEffect2 = this.navigationEffect;
		if (handler.index != 0)
		{
		}
		UILabelHandler uilabelHandler = this.cancel;
		uinavigationEffect2.UpdateArrowPos(uilabelHandler);
		this.navigationEffect.Appear();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x060016D1 RID: 5841 RVA: 0x00037034 File Offset: 0x00035234
	[Token(Token = "0x60016D1")]
	[Address(RVA = "0x768910", Offset = "0x767710", VA = "0x180768910")]
	private void OnHandlerDeselected(UIHandlerBase handler)
	{
		this.navigationEffect.Hide();
	}

	// Token: 0x060016D2 RID: 5842 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016D2")]
	[Address(RVA = "0x18ABA00", Offset = "0x18AA800", VA = "0x1818ABA00", Slot = "21")]
	public override void Submit()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016D3 RID: 5843 RVA: 0x00037054 File Offset: 0x00035254
	[Token(Token = "0x60016D3")]
	[Address(RVA = "0x18AB910", Offset = "0x18AA710", VA = "0x1818AB910")]
	private void PerformSubmissionEffect()
	{
		RectTransform rectTransform = this.submissionEffect.rectTransform;
		Vector2 anchoredPosition = this.navigator.currentHandler.rectTransform.anchoredPosition;
		rectTransform.anchoredPosition = anchoredPosition;
		this.submissionEffect.gameObject.SetActive(true);
		Game.PlayHandlerScaleEffect(this.navigator.currentHandler);
	}

	// Token: 0x060016D4 RID: 5844 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016D4")]
	[Address(RVA = "0x18AB5F0", Offset = "0x18AA3F0", VA = "0x1818AB5F0", Slot = "25")]
	public override void Localize(LocalizationData data)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016D5 RID: 5845 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016D5")]
	[Address(RVA = "0x18AC100", Offset = "0x18AAF00", VA = "0x1818AC100")]
	private void UpdateActiveSkins()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016D6 RID: 5846 RVA: 0x000370B4 File Offset: 0x000352B4
	[Token(Token = "0x60016D6")]
	[Address(RVA = "0x18AC640", Offset = "0x18AB440", VA = "0x1818AC640")]
	private void UpdateSelection()
	{
		GameSkin[] array = this.activeSkins;
		int num = 0;
		int num2 = 0;
		if (num2 < array.Length)
		{
			GameSkin gameSkin = array[num];
			GameCollection collection = Game.Collection;
			if (gameSkin != collection.currentSkin)
			{
				GameSkin[] array2 = this.activeSkins;
				num++;
			}
			this.selectionIndex = num;
			return;
		}
		this.selectionIndex = (int)((ulong)0L);
	}

	// Token: 0x060016D7 RID: 5847 RVA: 0x00037118 File Offset: 0x00035318
	[Token(Token = "0x60016D7")]
	[Address(RVA = "0x18AC730", Offset = "0x18AB530", VA = "0x1818AC730")]
	private void UpdateSkinIndices()
	{
		UISkinIcon[] array = this.activeIcons;
		int num = 0;
		if (num < array.Length)
		{
			UISkinIcon uiskinIcon = array[num];
			uiskinIcon.index = num;
			int num2 = 0;
			uiskinIcon.UpdatePosition(num2);
			UISkinIcon[] array2 = this.activeIcons;
			num++;
		}
	}

	// Token: 0x060016D8 RID: 5848 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016D8")]
	[Address(RVA = "0x18ACA00", Offset = "0x18AB800", VA = "0x1818ACA00")]
	private void UpdateUnlockStats()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016D9 RID: 5849 RVA: 0x00037164 File Offset: 0x00035364
	[Token(Token = "0x60016D9")]
	[Address(RVA = "0x18AC930", Offset = "0x18AB730", VA = "0x1818AC930")]
	private void UpdateUnlockConditionText()
	{
		/*
An exception occurred when decompiling this method (060016D9)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void UISkin::UpdateUnlockConditionText()

 ---> System.Exception: Basic block has to end with unconditional control flow. 
{; 	Block_0:; 	stloc:valuetype GameSkin[](var_0_06, ldfld:valuetype GameSkin[](UISkin::activeSkins, ldloc:UISkin(this))); 	stloc:class [mscorlib]System.Func`2<valuetype GameSkin, string>(var_1_13, newobj:Func`2[exp:class [mscorlib]System.Func`2<valuetype GameSkin, string>](Func`2::.ctor, ldloc:UISkin[exp:object](this), ldftn:native int(UISkin::GetUnlockConditionText))); 	stloc:string[](var_2_20, call:string[](Enumerable::ToArray, call:IEnumerable`1(Enumerable::Select, ldloc:valuetype GameSkin[][exp:IEnumerable`1](var_0_06), ldloc:class [mscorlib]System.Func`2<valuetype GameSkin, string>[exp:Func`2](var_1_13)))); 	stfld:string[](UISkin::unlockConditionText, ldloc:UISkin(this), ldloc:string[](var_2_20)); }; 
   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: 0x060016DA RID: 5850 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016DA")]
	[Address(RVA = "0x18AC7C0", Offset = "0x18AB5C0", VA = "0x1818AC7C0")]
	private void UpdateSkinText()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016DB RID: 5851 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016DB")]
	[Address(RVA = "0x18AA230", Offset = "0x18A9030", VA = "0x1818AA230")]
	private bool HasSkinUnlocked(GameSkin skin)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016DC RID: 5852 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016DC")]
	[Address(RVA = "0x18A9DE0", Offset = "0x18A8BE0", VA = "0x1818A9DE0")]
	private string GetUnlockConditionText(GameSkin skin)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016DD RID: 5853 RVA: 0x00037198 File Offset: 0x00035398
	[Token(Token = "0x60016DD")]
	[Address(RVA = "0x769BF0", Offset = "0x7689F0", VA = "0x180769BF0")]
	public UISkin()
	{
	}

	// Token: 0x0400213B RID: 8507
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x400213B")]
	[SerializeField]
	private Text title;

	// Token: 0x0400213C RID: 8508
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x400213C")]
	[SerializeField]
	private Text skinName;

	// Token: 0x0400213D RID: 8509
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x400213D")]
	[SerializeField]
	private Text unlockCondition;

	// Token: 0x0400213E RID: 8510
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x400213E")]
	[SerializeField]
	private UISwitchPageTip switchPageTip;

	// Token: 0x0400213F RID: 8511
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x400213F")]
	[SerializeField]
	private RectTransform skinIconRoot;

	// Token: 0x04002140 RID: 8512
	[FieldOffset(Offset = "0x80")]
	[Token(Token = "0x4002140")]
	[SerializeField]
	private int selectionIndex;

	// Token: 0x04002141 RID: 8513
	[FieldOffset(Offset = "0x88")]
	[Token(Token = "0x4002141")]
	[SerializeField]
	private GameSkin[] activeSkins;

	// Token: 0x04002142 RID: 8514
	[FieldOffset(Offset = "0x90")]
	[Token(Token = "0x4002142")]
	[SerializeField]
	private UISkinIcon[] activeIcons;

	// Token: 0x04002143 RID: 8515
	[FieldOffset(Offset = "0x98")]
	[Token(Token = "0x4002143")]
	[SerializeField]
	private CanvasGroup selectionTransparency;

	// Token: 0x04002144 RID: 8516
	[FieldOffset(Offset = "0xA0")]
	[Token(Token = "0x4002144")]
	[SerializeField]
	private Image[] selectionArrows;

	// Token: 0x04002145 RID: 8517
	[FieldOffset(Offset = "0xA8")]
	[Token(Token = "0x4002145")]
	[SerializeField]
	private UISwitchArrowController arrowController;

	// Token: 0x04002146 RID: 8518
	[FieldOffset(Offset = "0xB0")]
	[Token(Token = "0x4002146")]
	[SerializeField]
	private UILabelHandler cancel;

	// Token: 0x04002147 RID: 8519
	[FieldOffset(Offset = "0xB8")]
	[Token(Token = "0x4002147")]
	[SerializeField]
	private UILabelHandler confirm;

	// Token: 0x04002148 RID: 8520
	[FieldOffset(Offset = "0xC0")]
	[Token(Token = "0x4002148")]
	[SerializeField]
	private UINavigationEffect navigationEffect;

	// Token: 0x04002149 RID: 8521
	[FieldOffset(Offset = "0xC8")]
	[Token(Token = "0x4002149")]
	[SerializeField]
	private Image submissionEffect;

	// Token: 0x0400214A RID: 8522
	[Token(Token = "0x400214A")]
	private const int SKIN_NAME_INDEX = 600;

	// Token: 0x0400214B RID: 8523
	[Token(Token = "0x400214B")]
	private const float DURATION = 0.3f;

	// Token: 0x0400214C RID: 8524
	[Token(Token = "0x400214C")]
	private const float OFFSET = 55f;

	// Token: 0x0400214D RID: 8525
	[FieldOffset(Offset = "0xD0")]
	[Token(Token = "0x400214D")]
	private Vector2[] selectionArrowPos;

	// Token: 0x0400214E RID: 8526
	[FieldOffset(Offset = "0xD8")]
	[Token(Token = "0x400214E")]
	private Sequence sequence;

	// Token: 0x0400214F RID: 8527
	[FieldOffset(Offset = "0xE0")]
	[Token(Token = "0x400214F")]
	private bool[] unlockFlags;

	// Token: 0x04002150 RID: 8528
	[FieldOffset(Offset = "0xE8")]
	[Token(Token = "0x4002150")]
	private string[] unlockConditionText;

	// Token: 0x04002151 RID: 8529
	[FieldOffset(Offset = "0xF0")]
	[Token(Token = "0x4002151")]
	private GameTextDataAdvance achievementText;

	// Token: 0x04002152 RID: 8530
	[FieldOffset(Offset = "0xF8")]
	[Token(Token = "0x4002152")]
	private Dictionary<GameSkin, UISkinIcon> iconMap;
}
