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

// Token: 0x0200022F RID: 559
[Token(Token = "0x200022F")]
public class UILanguageSetup : GameCanvasBase
{
	// Token: 0x0600156F RID: 5487 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600156F")]
	[Address(RVA = "0x101A040", Offset = "0x1018E40", VA = "0x18101A040", Slot = "11")]
	public override void Init()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001570 RID: 5488 RVA: 0x00030900 File Offset: 0x0002EB00
	[Token(Token = "0x6001570")]
	[Address(RVA = "0x1019BF0", Offset = "0x10189F0", VA = "0x181019BF0", 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: 0x06001571 RID: 5489 RVA: 0x00030940 File Offset: 0x0002EB40
	[Token(Token = "0x6001571")]
	[Address(RVA = "0x764EC0", Offset = "0x763CC0", VA = "0x180764EC0", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		this.navigator.Move(direction);
	}

	// Token: 0x06001572 RID: 5490 RVA: 0x00030960 File Offset: 0x0002EB60
	[Token(Token = "0x6001572")]
	[Address(RVA = "0x101A3A0", Offset = "0x10191A0", VA = "0x18101A3A0")]
	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: 0x06001573 RID: 5491 RVA: 0x000309D0 File Offset: 0x0002EBD0
	[Token(Token = "0x6001573")]
	[Address(RVA = "0x101A380", Offset = "0x1019180", VA = "0x18101A380")]
	private void OnHandlerDeselected(UIHandlerBase handler)
	{
		this.navigationEffect.Hide();
	}

	// Token: 0x06001574 RID: 5492 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001574")]
	[Address(RVA = "0x101A4A0", Offset = "0x10192A0", VA = "0x18101A4A0", Slot = "21")]
	public override void Submit()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001575 RID: 5493 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001575")]
	[Address(RVA = "0x1019CA0", Offset = "0x1018AA0", VA = "0x181019CA0")]
	private Vector2 GetInteractionPos(int index)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001576 RID: 5494 RVA: 0x000309F0 File Offset: 0x0002EBF0
	[Token(Token = "0x6001576")]
	[Address(RVA = "0x1019D40", Offset = "0x1018B40", VA = "0x181019D40")]
	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: 0x06001577 RID: 5495 RVA: 0x00030B3C File Offset: 0x0002ED3C
	[Token(Token = "0x6001577")]
	[Address(RVA = "0x769BF0", Offset = "0x7689F0", VA = "0x180769BF0")]
	public UILanguageSetup()
	{
	}

	// Token: 0x040020B2 RID: 8370
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x40020B2")]
	[SerializeField]
	private UILabelHandler[] allHandlers;

	// Token: 0x040020B3 RID: 8371
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x40020B3")]
	[SerializeField]
	private UILabelHandler[] activeHandlers;

	// Token: 0x040020B4 RID: 8372
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x40020B4")]
	[SerializeField]
	private UINavigationEffect navigationEffect;

	// Token: 0x040020B5 RID: 8373
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x40020B5")]
	[SerializeField]
	private RectTransform submissionEffect;

	// Token: 0x040020B6 RID: 8374
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x40020B6")]
	[SerializeField]
	private GridLayoutGroup gridLayout;
}
