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

// Token: 0x0200024C RID: 588
[Token(Token = "0x200024C")]
public class UISettings : GameCanvasBase
{
	// Token: 0x060016AF RID: 5807 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016AF")]
	[Address(RVA = "0x18A8630", Offset = "0x18A7430", VA = "0x1818A8630", Slot = "11")]
	public override void Init()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016B0 RID: 5808 RVA: 0x000365D0 File Offset: 0x000347D0
	[Token(Token = "0x60016B0")]
	[Address(RVA = "0x18A7ED0", Offset = "0x18A6CD0", VA = "0x1818A7ED0")]
	private void InitHandlers(UILabelHandler[] activeTopHandlers)
	{
		int num2;
		UINavigator navigator2;
		UIHandlerBase[] array3;
		UILabelHandler uilabelHandler11;
		for (;;)
		{
			UILabelHandler uilabelHandler = activeTopHandlers[0];
			this.defaultHandler = uilabelHandler;
			List<UIHandlerBase> list = new List(activeTopHandlers);
			UILabelHandler uilabelHandler2 = this.backHandler;
			list.Add(uilabelHandler2);
			int num = 0;
			UINavigationSetter uinavigationSetter = UINavigationSetter.Get(UINavigationMode.Vertical, true, num);
			UIHandlerBase[] array = list.ToArray();
			uinavigationSetter.Apply(array);
			num2 = 0;
			int length = activeTopHandlers.Length;
			if (num2 < length)
			{
				UILabelHandler uilabelHandler3 = activeTopHandlers[num2];
				Action<UIHandlerBase> action = new Action(this.OnTopHandlerSelected);
				uilabelHandler3.onSelectedHandler = action;
				Action<UIHandlerBase> action2 = new Action(this.OnTopHandlerDeselected);
				uilabelHandler3.onDeselectedHandler = action2;
				num2++;
			}
			this.navigator.BindPointerEnterEvent(activeTopHandlers);
			this.navigator.BindPointerExitEvent(activeTopHandlers);
			this.backHandler.index = (int)((ulong)100L);
			int length2 = activeTopHandlers.Length;
			UILabelHandler uilabelHandler4 = this.backHandler;
			int num3 = length2 - 1;
			UILabelHandler uilabelHandler5 = activeTopHandlers[num3];
			uilabelHandler4.SetupNavigationHandler(Direction2D.Up, uilabelHandler5);
			UILabelHandler uilabelHandler6 = this.backHandler;
			UILabelHandler uilabelHandler7 = activeTopHandlers[0];
			uilabelHandler6.SetupNavigationHandler(Direction2D.Down, uilabelHandler7);
			UILabelHandler uilabelHandler8 = this.backHandler;
			Action<UIHandlerBase> action3 = new Action(this.OnBottomHandlerSelected);
			uilabelHandler8.onSelectedHandler = action3;
			UILabelHandler uilabelHandler9 = this.backHandler;
			Action<UIHandlerBase> action4 = new Action(this.OnBottomHandlerDeselected);
			uilabelHandler9.onDeselectedHandler = action4;
			UINavigator navigator = this.navigator;
			UIHandlerBase[] array2 = new UIHandlerBase[1];
			UILabelHandler uilabelHandler10 = this.backHandler;
			if (uilabelHandler10 == 0 || array2 != 0)
			{
				array2[0] = uilabelHandler10;
				navigator.BindPointerEnterEvent(array2);
				navigator2 = this.navigator;
				array3 = new UIHandlerBase[1];
				uilabelHandler11 = this.backHandler;
				if (uilabelHandler11 == 0 || array3 != 0)
				{
					break;
				}
			}
		}
		array3[0] = uilabelHandler11;
		navigator2.BindPointerExitEvent(array3);
		UILabelHandler[] array4 = this.topHandlers;
		int length3 = activeTopHandlers.Length;
		if (array4.Length != length3)
		{
			UILabelHandler[] array5 = Enumerable.ToArray<UILabelHandler>(Enumerable.Except<UILabelHandler>(array4, activeTopHandlers));
			int length4 = array5.Length;
			if (num2 < length4)
			{
				GameObject gameObject = array5[num2].gameObject;
				int num4 = 0;
				gameObject.SetActive(num4 != 0);
				num2++;
			}
			this.layoutGroup.enabled = true;
			LayoutRebuilder.ForceRebuildLayoutImmediate(this.layoutGroup.GetComponent<RectTransform>());
			LayoutGroup layoutGroup = this.layoutGroup;
			int num5 = 0;
			layoutGroup.enabled = num5 != 0;
		}
	}

	// Token: 0x060016B1 RID: 5809 RVA: 0x00036818 File Offset: 0x00034A18
	[Token(Token = "0x60016B1")]
	[Address(RVA = "0x18A84B0", Offset = "0x18A72B0", VA = "0x1818A84B0")]
	private void InitTopHandlerLayout(UILabelHandler[] activeHandlers)
	{
		UILabelHandler[] array = this.topHandlers;
		int length = activeHandlers.Length;
		if (array.Length != length)
		{
			UILabelHandler[] array2 = Enumerable.ToArray<UILabelHandler>(Enumerable.Except<UILabelHandler>(array, activeHandlers));
			int num = 0;
			int length2 = array2.Length;
			if (num < length2)
			{
				GameObject gameObject = array2[num].gameObject;
				int num2 = 0;
				gameObject.SetActive(num2 != 0);
				num++;
			}
			this.layoutGroup.enabled = true;
			LayoutRebuilder.ForceRebuildLayoutImmediate(this.layoutGroup.GetComponent<RectTransform>());
			LayoutGroup layoutGroup = this.layoutGroup;
			int num3 = 0;
			layoutGroup.enabled = num3 != 0;
		}
	}

	// Token: 0x060016B2 RID: 5810 RVA: 0x000368AC File Offset: 0x00034AAC
	[Token(Token = "0x60016B2")]
	[Address(RVA = "0x18A7C20", Offset = "0x18A6A20", VA = "0x1818A7C20", Slot = "12")]
	protected override void Appear(Action completeHandler)
	{
		Text text = this.title;
		string text2 = this.titleText;
		text.text = text2;
		int num = 0;
		this.currentSubCanvas = num;
		UISubSettingsBase[] array = this.subCanvases;
		int length = array.Length;
		if (num < length)
		{
			UISubSettingsBase uisubSettingsBase = array[num];
			uisubSettingsBase.UpdateDirtyCheckValue();
			CanvasGroup subCanvasGroup = uisubSettingsBase.subCanvasGroup;
			int num2 = 0;
			subCanvasGroup.alpha = (float)num2;
			CanvasGroup subCanvasGroup2 = uisubSettingsBase.subCanvasGroup;
			int num3 = 0;
			subCanvasGroup2.blocksRaycasts = num3 != 0;
			num++;
		}
		this.menuCanvasGroup.alpha = 1f;
		this.menuCanvasGroup.blocksRaycasts = true;
		this.topNavigationEffect.HideImmediate();
		this.bottomNavigationEffect.HideImmediate();
		GameObject gameObject = this.submissionEffect.gameObject;
		int num4 = 0;
		gameObject.SetActive(num4 != 0);
		UINavigator navigator = this.navigator;
		UILabelHandler uilabelHandler = this.defaultHandler;
		navigator.SetDefaultHandler(uilabelHandler);
		base.Appear(completeHandler);
	}

	// Token: 0x060016B3 RID: 5811 RVA: 0x0003699C File Offset: 0x00034B9C
	[Token(Token = "0x60016B3")]
	[Address(RVA = "0x18A7EA0", Offset = "0x18A6CA0", VA = "0x1818A7EA0", Slot = "13")]
	protected override void Hide(Action completeHandler)
	{
		this.TrySaveConfig();
		base.Hide(completeHandler);
	}

	// Token: 0x060016B4 RID: 5812 RVA: 0x000369B8 File Offset: 0x00034BB8
	[Token(Token = "0x60016B4")]
	[Address(RVA = "0x764EC0", Offset = "0x763CC0", VA = "0x180764EC0", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		this.navigator.Move(direction);
	}

	// Token: 0x060016B5 RID: 5813 RVA: 0x000369D8 File Offset: 0x00034BD8
	[Token(Token = "0x60016B5")]
	[Address(RVA = "0x18A8D80", Offset = "0x18A7B80", VA = "0x1818A8D80")]
	private void OnTopHandlerSelected(UIHandlerBase handler)
	{
		this.topNavigationEffect.Appear();
		UINavigationEffect uinavigationEffect = this.topNavigationEffect;
		Transform parent = handler.transform.parent;
		uinavigationEffect.UpdateParent(parent);
		UINavigationEffect uinavigationEffect2 = this.topNavigationEffect;
		RectTransform rectTransform = handler.rectTransform;
		RectTransform root = uinavigationEffect2.root;
		Vector2 anchorMin = rectTransform.anchorMin;
		root.anchorMin = anchorMin;
		UINavigationEffect uinavigationEffect3 = this.topNavigationEffect;
		RectTransform rectTransform2 = handler.rectTransform;
		RectTransform root2 = uinavigationEffect3.root;
		Vector2 anchorMax = rectTransform2.anchorMax;
		root2.anchorMax = anchorMax;
		UINavigationEffect uinavigationEffect4 = this.topNavigationEffect;
		RectTransform rectTransform3 = handler.rectTransform;
		RectTransform root3 = uinavigationEffect4.root;
		Vector2 pivot = rectTransform3.pivot;
		root3.pivot = pivot;
		RectTransform rectTransform4 = handler.rectTransform;
		UINavigationEffect uinavigationEffect5 = this.topNavigationEffect;
		Vector2 anchoredPosition = rectTransform4.anchoredPosition;
		uinavigationEffect5.UpdatePos(anchoredPosition);
		UILabelHandler[] array = this.topHandlers;
		UINavigationEffect uinavigationEffect6 = this.topNavigationEffect;
		int index = handler.index;
		UILabelHandler uilabelHandler = array[index];
		uinavigationEffect6.UpdateArrowPos(uilabelHandler);
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x060016B6 RID: 5814 RVA: 0x00036AE4 File Offset: 0x00034CE4
	[Token(Token = "0x60016B6")]
	[Address(RVA = "0x1016F00", Offset = "0x1015D00", VA = "0x181016F00")]
	private void OnTopHandlerDeselected(UIHandlerBase handler)
	{
		this.topNavigationEffect.Hide();
	}

	// Token: 0x060016B7 RID: 5815 RVA: 0x00036B04 File Offset: 0x00034D04
	[Token(Token = "0x60016B7")]
	[Address(RVA = "0x18A8D10", Offset = "0x18A7B10", VA = "0x1818A8D10")]
	private void OnBottomHandlerSelected(UIHandlerBase handler)
	{
		this.bottomNavigationEffect.Appear();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x060016B8 RID: 5816 RVA: 0x00036B28 File Offset: 0x00034D28
	[Token(Token = "0x60016B8")]
	[Address(RVA = "0x18A8CE0", Offset = "0x18A7AE0", VA = "0x1818A8CE0")]
	private void OnBottomHandlerDeselected(UIHandlerBase handler)
	{
		this.bottomNavigationEffect.Hide();
	}

	// Token: 0x060016B9 RID: 5817 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016B9")]
	[Address(RVA = "0x18A9020", Offset = "0x18A7E20", VA = "0x1818A9020", Slot = "21")]
	public override void Submit()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016BA RID: 5818 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016BA")]
	[Address(RVA = "0x18A8F70", Offset = "0x18A7D70", VA = "0x1818A8F70")]
	private void PerformSubmitEffect()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016BB RID: 5819 RVA: 0x00036B48 File Offset: 0x00034D48
	[Token(Token = "0x60016BB")]
	[Address(RVA = "0x18A7AE0", Offset = "0x18A68E0", VA = "0x1818A7AE0")]
	private void AppearMenu()
	{
		Text text = this.title;
		string text2 = this.titleText;
		text.text = text2;
		GameObject gameObject = this.submissionEffect.gameObject;
		int num = 0;
		gameObject.SetActive(num != 0);
		TweenerCore<float, float, FloatOptions> tweenerCore = DOTweenModuleUI.DOFade(this.menuCanvasGroup, 1f, 0.3f).SetEase((Ease)((uint)15));
		TweenCallback tweenCallback = delegate
		{
			Game.BindUIController(this);
			Game.EnablePauseMenuAction();
			this.menuCanvasGroup.blocksRaycasts = true;
		};
		TweenerCore<float, float, FloatOptions> tweenerCore2 = tweenerCore.OnComplete(tweenCallback).Play<TweenerCore<float, float, FloatOptions>>();
	}

	// Token: 0x060016BC RID: 5820 RVA: 0x00036BC4 File Offset: 0x00034DC4
	[Token(Token = "0x60016BC")]
	[Address(RVA = "0x18A7DD0", Offset = "0x18A6BD0", VA = "0x1818A7DD0")]
	private void HideMenu()
	{
		Game.UnbindUIController();
		Game.DisablePauseMenuAction();
		CanvasGroup canvasGroup = this.menuCanvasGroup;
		int num = 0;
		canvasGroup.blocksRaycasts = num != 0;
		CanvasGroup canvasGroup2 = this.menuCanvasGroup;
		int num2 = 0;
		TweenerCore<float, float, FloatOptions> tweenerCore = DOTweenModuleUI.DOFade(canvasGroup2, (float)num2, 0.5f).SetEase((Ease)((uint)15)).Play<TweenerCore<float, float, FloatOptions>>();
	}

	// Token: 0x060016BD RID: 5821 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016BD")]
	[Address(RVA = "0x18A9300", Offset = "0x18A8100", VA = "0x1818A9300")]
	private void TrySaveConfig()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016BE RID: 5822 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60016BE")]
	[Address(RVA = "0x18A8960", Offset = "0x18A7760", VA = "0x1818A8960", Slot = "25")]
	public override void Localize(LocalizationData data)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060016BF RID: 5823 RVA: 0x00036C20 File Offset: 0x00034E20
	[Token(Token = "0x60016BF")]
	[Address(RVA = "0x769BF0", Offset = "0x7689F0", VA = "0x180769BF0")]
	public UISettings()
	{
	}

	// Token: 0x0400212A RID: 8490
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x400212A")]
	[SerializeField]
	private CanvasGroup menuCanvasGroup;

	// Token: 0x0400212B RID: 8491
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x400212B")]
	[SerializeField]
	private LayoutGroup layoutGroup;

	// Token: 0x0400212C RID: 8492
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x400212C")]
	[SerializeField]
	private Text title;

	// Token: 0x0400212D RID: 8493
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x400212D")]
	[SerializeField]
	private UILabelHandler[] topHandlers;

	// Token: 0x0400212E RID: 8494
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x400212E")]
	[SerializeField]
	protected UILabelHandler backHandler;

	// Token: 0x0400212F RID: 8495
	[FieldOffset(Offset = "0x80")]
	[Token(Token = "0x400212F")]
	[SerializeField]
	private UINavigationEffect topNavigationEffect;

	// Token: 0x04002130 RID: 8496
	[FieldOffset(Offset = "0x88")]
	[Token(Token = "0x4002130")]
	[SerializeField]
	private UINavigationEffect bottomNavigationEffect;

	// Token: 0x04002131 RID: 8497
	[FieldOffset(Offset = "0x90")]
	[Token(Token = "0x4002131")]
	[SerializeField]
	private Image submissionEffect;

	// Token: 0x04002132 RID: 8498
	[FieldOffset(Offset = "0x98")]
	[Token(Token = "0x4002132")]
	[SerializeField]
	private UISubSettingsBase[] subCanvases;

	// Token: 0x04002133 RID: 8499
	[FieldOffset(Offset = "0xA0")]
	[Token(Token = "0x4002133")]
	[SerializeField]
	private Text newKeyBindingLabel;

	// Token: 0x04002134 RID: 8500
	[FieldOffset(Offset = "0xA8")]
	[Token(Token = "0x4002134")]
	private string titleText;

	// Token: 0x04002135 RID: 8501
	[FieldOffset(Offset = "0xB0")]
	[Token(Token = "0x4002135")]
	private UILabelHandler defaultHandler;

	// Token: 0x04002136 RID: 8502
	[FieldOffset(Offset = "0xB8")]
	[Token(Token = "0x4002136")]
	private UISubSettingsBase currentSubCanvas;

	// Token: 0x04002137 RID: 8503
	[Token(Token = "0x4002137")]
	private const int KEYBOARD_INDEX = 4;

	// Token: 0x04002138 RID: 8504
	[Token(Token = "0x4002138")]
	private const int BACK_HANDLER_INDEX = 100;
}
