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: 0x02000296 RID: 662
[Token(Token = "0x2000296")]
public class UISettings : GameCanvasBase
{
	// Token: 0x060018CC RID: 6348 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018CC")]
	[Address(RVA = "0x95B910", Offset = "0x95A910", VA = "0x18095B910", Slot = "11")]
	public override void Init()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018CD RID: 6349 RVA: 0x0003B8E4 File Offset: 0x00039AE4
	[Token(Token = "0x60018CD")]
	[Address(RVA = "0x95B1B0", Offset = "0x95A1B0", VA = "0x18095B1B0")]
	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: 0x060018CE RID: 6350 RVA: 0x0003BB2C File Offset: 0x00039D2C
	[Token(Token = "0x60018CE")]
	[Address(RVA = "0x95B790", Offset = "0x95A790", VA = "0x18095B790")]
	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: 0x060018CF RID: 6351 RVA: 0x0003BBC0 File Offset: 0x00039DC0
	[Token(Token = "0x60018CF")]
	[Address(RVA = "0x95AF00", Offset = "0x959F00", VA = "0x18095AF00", 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: 0x060018D0 RID: 6352 RVA: 0x0003BCB0 File Offset: 0x00039EB0
	[Token(Token = "0x60018D0")]
	[Address(RVA = "0x95B180", Offset = "0x95A180", VA = "0x18095B180", Slot = "13")]
	protected override void Hide(Action completeHandler)
	{
		this.TrySaveConfig();
		base.Hide(completeHandler);
	}

	// Token: 0x060018D1 RID: 6353 RVA: 0x0003BCCC File Offset: 0x00039ECC
	[Token(Token = "0x60018D1")]
	[Address(RVA = "0x94CB50", Offset = "0x94BB50", VA = "0x18094CB50", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		this.navigator.Move(direction);
	}

	// Token: 0x060018D2 RID: 6354 RVA: 0x0003BCEC File Offset: 0x00039EEC
	[Token(Token = "0x60018D2")]
	[Address(RVA = "0x95C130", Offset = "0x95B130", VA = "0x18095C130")]
	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: 0x060018D3 RID: 6355 RVA: 0x0003BDF8 File Offset: 0x00039FF8
	[Token(Token = "0x60018D3")]
	[Address(RVA = "0x95C100", Offset = "0x95B100", VA = "0x18095C100")]
	private void OnTopHandlerDeselected(UIHandlerBase handler)
	{
		this.topNavigationEffect.Hide();
	}

	// Token: 0x060018D4 RID: 6356 RVA: 0x0003BE18 File Offset: 0x0003A018
	[Token(Token = "0x60018D4")]
	[Address(RVA = "0x95C090", Offset = "0x95B090", VA = "0x18095C090")]
	private void OnBottomHandlerSelected(UIHandlerBase handler)
	{
		this.bottomNavigationEffect.Appear();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x060018D5 RID: 6357 RVA: 0x0003BE3C File Offset: 0x0003A03C
	[Token(Token = "0x60018D5")]
	[Address(RVA = "0x95C060", Offset = "0x95B060", VA = "0x18095C060")]
	private void OnBottomHandlerDeselected(UIHandlerBase handler)
	{
		this.bottomNavigationEffect.Hide();
	}

	// Token: 0x060018D6 RID: 6358 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018D6")]
	[Address(RVA = "0x95C3D0", Offset = "0x95B3D0", VA = "0x18095C3D0", Slot = "21")]
	public override void Submit()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018D7 RID: 6359 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018D7")]
	[Address(RVA = "0x95C320", Offset = "0x95B320", VA = "0x18095C320")]
	private void PerformSubmitEffect()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018D8 RID: 6360 RVA: 0x0003BE5C File Offset: 0x0003A05C
	[Token(Token = "0x60018D8")]
	[Address(RVA = "0x95ADC0", Offset = "0x959DC0", VA = "0x18095ADC0")]
	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: 0x060018D9 RID: 6361 RVA: 0x0003BED8 File Offset: 0x0003A0D8
	[Token(Token = "0x60018D9")]
	[Address(RVA = "0x95B0B0", Offset = "0x95A0B0", VA = "0x18095B0B0")]
	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: 0x060018DA RID: 6362 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018DA")]
	[Address(RVA = "0x95C6B0", Offset = "0x95B6B0", VA = "0x18095C6B0")]
	private void TrySaveConfig()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018DB RID: 6363 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x60018DB")]
	[Address(RVA = "0x95BC40", Offset = "0x95AC40", VA = "0x18095BC40", Slot = "25")]
	public override void Localize(LocalizationData data)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x060018DC RID: 6364 RVA: 0x0003BF34 File Offset: 0x0003A134
	[Token(Token = "0x60018DC")]
	[Address(RVA = "0x94D9C0", Offset = "0x94C9C0", VA = "0x18094D9C0")]
	public UISettings()
	{
	}

	// Token: 0x04002377 RID: 9079
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x4002377")]
	[SerializeField]
	private CanvasGroup menuCanvasGroup;

	// Token: 0x04002378 RID: 9080
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x4002378")]
	[SerializeField]
	private LayoutGroup layoutGroup;

	// Token: 0x04002379 RID: 9081
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x4002379")]
	[SerializeField]
	private Text title;

	// Token: 0x0400237A RID: 9082
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x400237A")]
	[SerializeField]
	private UILabelHandler[] topHandlers;

	// Token: 0x0400237B RID: 9083
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x400237B")]
	[SerializeField]
	protected UILabelHandler backHandler;

	// Token: 0x0400237C RID: 9084
	[FieldOffset(Offset = "0x80")]
	[Token(Token = "0x400237C")]
	[SerializeField]
	private UINavigationEffect topNavigationEffect;

	// Token: 0x0400237D RID: 9085
	[FieldOffset(Offset = "0x88")]
	[Token(Token = "0x400237D")]
	[SerializeField]
	private UINavigationEffect bottomNavigationEffect;

	// Token: 0x0400237E RID: 9086
	[FieldOffset(Offset = "0x90")]
	[Token(Token = "0x400237E")]
	[SerializeField]
	private Image submissionEffect;

	// Token: 0x0400237F RID: 9087
	[FieldOffset(Offset = "0x98")]
	[Token(Token = "0x400237F")]
	[SerializeField]
	private UISubSettingsBase[] subCanvases;

	// Token: 0x04002380 RID: 9088
	[FieldOffset(Offset = "0xA0")]
	[Token(Token = "0x4002380")]
	[SerializeField]
	private Text newKeyBindingLabel;

	// Token: 0x04002381 RID: 9089
	[FieldOffset(Offset = "0xA8")]
	[Token(Token = "0x4002381")]
	private string titleText;

	// Token: 0x04002382 RID: 9090
	[FieldOffset(Offset = "0xB0")]
	[Token(Token = "0x4002382")]
	private UILabelHandler defaultHandler;

	// Token: 0x04002383 RID: 9091
	[FieldOffset(Offset = "0xB8")]
	[Token(Token = "0x4002383")]
	private UISubSettingsBase currentSubCanvas;

	// Token: 0x04002384 RID: 9092
	[Token(Token = "0x4002384")]
	private const int KEYBOARD_INDEX = 4;

	// Token: 0x04002385 RID: 9093
	[Token(Token = "0x4002385")]
	private const int BACK_HANDLER_INDEX = 100;
}
