using System;
using System.Linq;
using Cpp2IlInjected;
using MarsSDK;
using UnityEngine;
using UnityEngine.UI;

// Token: 0x02000279 RID: 633
[Token(Token = "0x2000279")]
public class UILanguageSetup : GameCanvasBase
{
	// Token: 0x06001788 RID: 6024 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001788")]
	[Address(RVA = "0xE73160", Offset = "0xE72160", VA = "0x180E73160", Slot = "11")]
	public override void Init()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001789 RID: 6025 RVA: 0x00035840 File Offset: 0x00033A40
	[Token(Token = "0x6001789")]
	[Address(RVA = "0xE72D10", Offset = "0xE71D10", VA = "0x180E72D10", Slot = "12")]
	protected override void Appear(Action completeHandler)
	{
		base.Appear(completeHandler);
		UILabelHandler[] array = this.activeHandlers;
		UINavigator navigator = this.navigator;
		UILabelHandler uilabelHandler = array[0];
		navigator.SetDefaultHandler(uilabelHandler);
		Game.PlayCanvasSE(UICanvasSFX.Option);
	}

	// Token: 0x0600178A RID: 6026 RVA: 0x00035880 File Offset: 0x00033A80
	[Token(Token = "0x600178A")]
	[Address(RVA = "0x94CB50", Offset = "0x94BB50", VA = "0x18094CB50", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		this.navigator.Move(direction);
	}

	// Token: 0x0600178B RID: 6027 RVA: 0x000358A0 File Offset: 0x00033AA0
	[Token(Token = "0x600178B")]
	[Address(RVA = "0xE734C0", Offset = "0xE724C0", VA = "0x180E734C0")]
	private void OnHandlerSelected(UIHandlerBase handler)
	{
		UINavigationEffect uinavigationEffect = this.navigationEffect;
		int index = handler.index;
		Vector2 interactionPos = this.GetInteractionPos(index);
		uinavigationEffect.root.anchoredPosition = interactionPos;
		UILabelHandler[] array = this.activeHandlers;
		UINavigationEffect uinavigationEffect2 = this.navigationEffect;
		int index2 = handler.index;
		UILabelHandler uilabelHandler = array[index2];
		uinavigationEffect2.UpdateArrowPos(uilabelHandler);
		this.navigationEffect.Appear();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x0600178C RID: 6028 RVA: 0x00035910 File Offset: 0x00033B10
	[Token(Token = "0x600178C")]
	[Address(RVA = "0xE734A0", Offset = "0xE724A0", VA = "0x180E734A0")]
	private void OnHandlerDeselected(UIHandlerBase handler)
	{
		this.navigationEffect.Hide();
	}

	// Token: 0x0600178D RID: 6029 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600178D")]
	[Address(RVA = "0xE735C0", Offset = "0xE725C0", VA = "0x180E735C0", Slot = "21")]
	public override void Submit()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600178E RID: 6030 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600178E")]
	[Address(RVA = "0xE72DC0", Offset = "0xE71DC0", VA = "0x180E72DC0")]
	private Vector2 GetInteractionPos(int index)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600178F RID: 6031 RVA: 0x00035930 File Offset: 0x00033B30
	[Token(Token = "0x600178F")]
	[Address(RVA = "0xE72E60", Offset = "0xE71E60", VA = "0x180E72E60")]
	private void InitLayout(GameLanguage[] languages)
	{
		Func<GameLanguage, UILabelHandler> func = delegate(GameLanguage lan)
		{
			UILabelHandler[] array6 = this.allHandlers;
			return array6[(int)lan];
		};
		UILabelHandler[] array = Enumerable.ToArray<UILabelHandler>(Enumerable.Select<GameLanguage, UILabelHandler>(languages, func));
		this.activeHandlers = array;
		UILabelHandler[] array2 = this.activeHandlers;
		UILabelHandler[] array3 = Enumerable.ToArray<UILabelHandler>(Enumerable.Except<UILabelHandler>(this.allHandlers, array2));
		int num = 0;
		int length = array3.Length;
		if (num < length)
		{
			GameObject gameObject = array3[num].gameObject;
			int num2 = 0;
			gameObject.SetActive(num2 != 0);
			num++;
		}
		UILabelHandler[] array4 = this.activeHandlers;
		int length2 = array4.Length;
		int length3 = array4.Length;
		if (num < length3)
		{
			UILabelHandler uilabelHandler = array4[num];
			Transform transform = uilabelHandler.transform;
			Transform transform2 = this.gridLayout.transform;
			transform.parentInternal = transform2;
			uilabelHandler.transform.SetAsLastSibling();
			num++;
		}
		GridLayoutGroup gridLayoutGroup = this.gridLayout;
		bool flag = (length2 > 6) + true;
		gridLayoutGroup.constraintCount = (flag ? 1 : 0);
		this.gridLayout.enabled = true;
		LayoutRebuilder.ForceRebuildLayoutImmediate(this.gridLayout.GetComponent<RectTransform>());
		GridLayoutGroup gridLayoutGroup2 = this.gridLayout;
		int num3 = 0;
		gridLayoutGroup2.enabled = num3 != 0;
		if (length2 > 6)
		{
		}
		int num4 = 0;
		UINavigationSetter uinavigationSetter = UINavigationSetter.Get(UINavigationMode.Vertical, true, num4);
		UILabelHandler[] array5 = this.activeHandlers;
		uinavigationSetter.Apply(array5);
	}

	// Token: 0x06001790 RID: 6032 RVA: 0x00035A7C File Offset: 0x00033C7C
	[Token(Token = "0x6001790")]
	[Address(RVA = "0x94D9C0", Offset = "0x94C9C0", VA = "0x18094D9C0")]
	public UILanguageSetup()
	{
	}

	// Token: 0x040022FA RID: 8954
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x40022FA")]
	[SerializeField]
	private UILabelHandler[] allHandlers;

	// Token: 0x040022FB RID: 8955
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x40022FB")]
	[SerializeField]
	private UILabelHandler[] activeHandlers;

	// Token: 0x040022FC RID: 8956
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x40022FC")]
	[SerializeField]
	private UINavigationEffect navigationEffect;

	// Token: 0x040022FD RID: 8957
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x40022FD")]
	[SerializeField]
	private RectTransform submissionEffect;

	// Token: 0x040022FE RID: 8958
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x40022FE")]
	[SerializeField]
	private GridLayoutGroup gridLayout;
}
