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

// Token: 0x02000298 RID: 664
[Token(Token = "0x2000298")]
public class UISkin : GameCanvasBase
{
	// Token: 0x060018E1 RID: 6369 RVA: 0x0003BFA0 File Offset: 0x0003A1A0
	[Token(Token = "0x60018E1")]
	[Address(RVA = "0x95EC10", Offset = "0x95DC10", VA = "0x18095EC10", Slot = "11")]
	public override void Init()
	{
		GameTextDataAdvance gameTextDataAdvance = Game.GetAchievementText();
		this.achievementText = gameTextDataAdvance;
		this.InitIcons();
		this.InitHandlers();
		this.switchPageTip.Init();
	}

	// Token: 0x060018E2 RID: 6370 RVA: 0x0003BFDC File Offset: 0x0003A1DC
	[Token(Token = "0x60018E2")]
	[Address(RVA = "0x95E8E0", Offset = "0x95D8E0", VA = "0x18095E8E0")]
	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: 0x060018E3 RID: 6371 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018E3")]
	[Address(RVA = "0x95E090", Offset = "0x95D090", VA = "0x18095E090")]
	private void InitHandlers()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018E4 RID: 6372 RVA: 0x0003C080 File Offset: 0x0003A280
	[Token(Token = "0x60018E4")]
	[Address(RVA = "0x95D5E0", Offset = "0x95C5E0", VA = "0x18095D5E0", 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: 0x060018E5 RID: 6373 RVA: 0x0003C1C0 File Offset: 0x0003A3C0
	[Token(Token = "0x60018E5")]
	[Address(RVA = "0x95E050", Offset = "0x95D050", VA = "0x18095E050", 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: 0x060018E6 RID: 6374 RVA: 0x0003C1E8 File Offset: 0x0003A3E8
	[Token(Token = "0x60018E6")]
	[Address(RVA = "0x95F7F0", Offset = "0x95E7F0", VA = "0x18095F7F0", 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: 0x060018E7 RID: 6375 RVA: 0x0003C230 File Offset: 0x0003A430
	[Token(Token = "0x60018E7")]
	[Address(RVA = "0x95FB90", Offset = "0x95EB90", VA = "0x18095FB90")]
	private int TrySwitchLeftward()
	{
		int num = this.selectionIndex;
		if (num != 0)
		{
			this.selectionIndex = num;
			this.SwitchSkinPreviews();
			return this.selectionIndex;
		}
		return -1;
	}

	// Token: 0x060018E8 RID: 6376 RVA: 0x0003C260 File Offset: 0x0003A460
	[Token(Token = "0x60018E8")]
	[Address(RVA = "0x95F890", Offset = "0x95E890", VA = "0x18095F890", 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: 0x060018E9 RID: 6377 RVA: 0x0003C2A8 File Offset: 0x0003A4A8
	[Token(Token = "0x60018E9")]
	[Address(RVA = "0x95FBD0", Offset = "0x95EBD0", VA = "0x18095FBD0")]
	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: 0x060018EA RID: 6378 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018EA")]
	[Address(RVA = "0x95F930", Offset = "0x95E930", VA = "0x18095F930")]
	private void SwitchSkinPreviews()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018EB RID: 6379 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018EB")]
	[Address(RVA = "0x95ECA0", Offset = "0x95DCA0", VA = "0x18095ECA0")]
	private void JoinSelectionArrowEffect(Sequence sequence, float duration)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018EC RID: 6380 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018EC")]
	[Address(RVA = "0x95F350", Offset = "0x95E350", VA = "0x18095F350", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018ED RID: 6381 RVA: 0x0003C2EC File Offset: 0x0003A4EC
	[Token(Token = "0x60018ED")]
	[Address(RVA = "0x95F3B0", Offset = "0x95E3B0", VA = "0x18095F3B0")]
	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: 0x060018EE RID: 6382 RVA: 0x0003C348 File Offset: 0x0003A548
	[Token(Token = "0x60018EE")]
	[Address(RVA = "0x95F380", Offset = "0x95E380", VA = "0x18095F380")]
	private void OnHandlerDeselected(UIHandlerBase handler)
	{
		this.navigationEffect.Hide();
	}

	// Token: 0x060018EF RID: 6383 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018EF")]
	[Address(RVA = "0x95F590", Offset = "0x95E590", VA = "0x18095F590", Slot = "21")]
	public override void Submit()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018F0 RID: 6384 RVA: 0x0003C368 File Offset: 0x0003A568
	[Token(Token = "0x60018F0")]
	[Address(RVA = "0x95F4A0", Offset = "0x95E4A0", VA = "0x18095F4A0")]
	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: 0x060018F1 RID: 6385 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018F1")]
	[Address(RVA = "0x95F150", Offset = "0x95E150", VA = "0x18095F150", Slot = "25")]
	public override void Localize(LocalizationData data)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018F2 RID: 6386 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018F2")]
	[Address(RVA = "0x95FC90", Offset = "0x95EC90", VA = "0x18095FC90")]
	private void UpdateActiveSkins()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018F3 RID: 6387 RVA: 0x0003C3C8 File Offset: 0x0003A5C8
	[Token(Token = "0x60018F3")]
	[Address(RVA = "0x9600C0", Offset = "0x95F0C0", VA = "0x1809600C0")]
	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: 0x060018F4 RID: 6388 RVA: 0x0003C42C File Offset: 0x0003A62C
	[Token(Token = "0x60018F4")]
	[Address(RVA = "0x9601B0", Offset = "0x95F1B0", VA = "0x1809601B0")]
	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: 0x060018F5 RID: 6389 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018F5")]
	[Address(RVA = "0x960480", Offset = "0x95F480", VA = "0x180960480")]
	private void UpdateUnlockStats()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018F6 RID: 6390 RVA: 0x0003C478 File Offset: 0x0003A678
	[Token(Token = "0x60018F6")]
	[Address(RVA = "0x9603B0", Offset = "0x95F3B0", VA = "0x1809603B0")]
	private void UpdateUnlockConditionText()
	{
		/*
An exception occurred when decompiling this method (060018F6)

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: 0x060018F7 RID: 6391 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018F7")]
	[Address(RVA = "0x960240", Offset = "0x95F240", VA = "0x180960240")]
	private void UpdateSkinText()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018F8 RID: 6392 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018F8")]
	[Address(RVA = "0x95DD00", Offset = "0x95CD00", VA = "0x18095DD00")]
	private bool HasSkinUnlocked(GameSkin skin)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018F9 RID: 6393 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018F9")]
	[Address(RVA = "0x95D890", Offset = "0x95C890", VA = "0x18095D890")]
	private string GetUnlockConditionText(GameSkin skin)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018FA RID: 6394 RVA: 0x0003C4AC File Offset: 0x0003A6AC
	[Token(Token = "0x60018FA")]
	[Address(RVA = "0x94D9C0", Offset = "0x94C9C0", VA = "0x18094D9C0")]
	public UISkin()
	{
	}

	// Token: 0x04002388 RID: 9096
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x4002388")]
	[SerializeField]
	private Text title;

	// Token: 0x04002389 RID: 9097
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x4002389")]
	[SerializeField]
	private Text skinName;

	// Token: 0x0400238A RID: 9098
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x400238A")]
	[SerializeField]
	private Text unlockCondition;

	// Token: 0x0400238B RID: 9099
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x400238B")]
	[SerializeField]
	private UISwitchPageTip switchPageTip;

	// Token: 0x0400238C RID: 9100
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x400238C")]
	[SerializeField]
	private RectTransform skinIconRoot;

	// Token: 0x0400238D RID: 9101
	[FieldOffset(Offset = "0x80")]
	[Token(Token = "0x400238D")]
	[SerializeField]
	private int selectionIndex;

	// Token: 0x0400238E RID: 9102
	[FieldOffset(Offset = "0x88")]
	[Token(Token = "0x400238E")]
	[SerializeField]
	private GameSkin[] activeSkins;

	// Token: 0x0400238F RID: 9103
	[FieldOffset(Offset = "0x90")]
	[Token(Token = "0x400238F")]
	[SerializeField]
	private UISkinIcon[] activeIcons;

	// Token: 0x04002390 RID: 9104
	[FieldOffset(Offset = "0x98")]
	[Token(Token = "0x4002390")]
	[SerializeField]
	private CanvasGroup selectionTransparency;

	// Token: 0x04002391 RID: 9105
	[FieldOffset(Offset = "0xA0")]
	[Token(Token = "0x4002391")]
	[SerializeField]
	private Image[] selectionArrows;

	// Token: 0x04002392 RID: 9106
	[FieldOffset(Offset = "0xA8")]
	[Token(Token = "0x4002392")]
	[SerializeField]
	private UISwitchArrowController arrowController;

	// Token: 0x04002393 RID: 9107
	[FieldOffset(Offset = "0xB0")]
	[Token(Token = "0x4002393")]
	[SerializeField]
	private UILabelHandler cancel;

	// Token: 0x04002394 RID: 9108
	[FieldOffset(Offset = "0xB8")]
	[Token(Token = "0x4002394")]
	[SerializeField]
	private UILabelHandler confirm;

	// Token: 0x04002395 RID: 9109
	[FieldOffset(Offset = "0xC0")]
	[Token(Token = "0x4002395")]
	[SerializeField]
	private UINavigationEffect navigationEffect;

	// Token: 0x04002396 RID: 9110
	[FieldOffset(Offset = "0xC8")]
	[Token(Token = "0x4002396")]
	[SerializeField]
	private Image submissionEffect;

	// Token: 0x04002397 RID: 9111
	[Token(Token = "0x4002397")]
	private const int SKIN_NAME_INDEX = 600;

	// Token: 0x04002398 RID: 9112
	[Token(Token = "0x4002398")]
	private const float DURATION = 0.3f;

	// Token: 0x04002399 RID: 9113
	[Token(Token = "0x4002399")]
	private const float OFFSET = 55f;

	// Token: 0x0400239A RID: 9114
	[FieldOffset(Offset = "0xD0")]
	[Token(Token = "0x400239A")]
	private Vector2[] selectionArrowPos;

	// Token: 0x0400239B RID: 9115
	[FieldOffset(Offset = "0xD8")]
	[Token(Token = "0x400239B")]
	private Sequence sequence;

	// Token: 0x0400239C RID: 9116
	[FieldOffset(Offset = "0xE0")]
	[Token(Token = "0x400239C")]
	private bool[] unlockFlags;

	// Token: 0x0400239D RID: 9117
	[FieldOffset(Offset = "0xE8")]
	[Token(Token = "0x400239D")]
	private string[] unlockConditionText;

	// Token: 0x0400239E RID: 9118
	[FieldOffset(Offset = "0xF0")]
	[Token(Token = "0x400239E")]
	private GameTextDataAdvance achievementText;

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