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

// Token: 0x02000230 RID: 560
[Token(Token = "0x2000230")]
public class UIMagicStats : GameCanvasBase
{
	// Token: 0x06001579 RID: 5497 RVA: 0x00030B74 File Offset: 0x0002ED74
	[Token(Token = "0x6001579")]
	[Address(RVA = "0x10200D0", Offset = "0x101EED0", VA = "0x1810200D0", Slot = "11")]
	public override void Init()
	{
		UINavigator navigator4;
		UIHandlerBase[] array6;
		UILabelHandler uilabelHandler4;
		for (;;)
		{
			UIMagicStatsHandler[] array = this.topHandlers;
			int num = 0;
			UIMagicStatsHandler[] array2;
			if (num < array.Length)
			{
				array[num].index = num;
				num++;
				array2 = this.topHandlers;
			}
			int length = array2.Length;
			if (num < length)
			{
				UIMagicStatsHandler uimagicStatsHandler = array2[num];
				Action<UIHandlerBase> action = new Action(this.OnTopHandlerSelected);
				uimagicStatsHandler.onSelectedHandler = action;
				Action<UIHandlerBase> action2 = new Action(this.OnTopHandlerDeselected);
				uimagicStatsHandler.onDeselectedHandler = action2;
				num++;
			}
			UINavigator navigator = this.navigator;
			UIMagicStatsHandler[] array3 = this.topHandlers;
			navigator.BindPointerEnterEvent(array3);
			UINavigator navigator2 = this.navigator;
			UIMagicStatsHandler[] array4 = this.topHandlers;
			navigator2.BindPointerExitEvent(array4);
			this.confirmHandler.index = (int)((ulong)99L);
			UILabelHandler uilabelHandler = this.confirmHandler;
			Action<UIHandlerBase> action3 = new Action(this.OnBottomHandlerSelected);
			uilabelHandler.onSelectedHandler = action3;
			UILabelHandler uilabelHandler2 = this.confirmHandler;
			Action<UIHandlerBase> action4 = new Action(this.OnBottomHandlerDeselected);
			uilabelHandler2.onDeselectedHandler = action4;
			UINavigator navigator3 = this.navigator;
			UIHandlerBase[] array5 = new UIHandlerBase[1];
			UILabelHandler uilabelHandler3 = this.confirmHandler;
			if (uilabelHandler3 == 0 || array5 != 0)
			{
				array5[0] = uilabelHandler3;
				navigator3.BindPointerEnterEvent(array5);
				navigator4 = this.navigator;
				array6 = new UIHandlerBase[1];
				uilabelHandler4 = this.confirmHandler;
				if (uilabelHandler4 == 0 || array6 != 0)
				{
					break;
				}
			}
		}
		array6[0] = uilabelHandler4;
		navigator4.BindPointerExitEvent(array6);
		UINavigationSetter uinavigationSetter = UINavigationSetter.Get(UINavigationMode.MatrixVerticalFirst, true, 3);
		UIMagicStatsHandler[] array7 = this.topHandlers;
		uinavigationSetter.Apply(array7);
		UIMagicStatsHandler uimagicStatsHandler2 = this.topHandlers[0];
		UILabelHandler uilabelHandler5 = this.confirmHandler;
		uimagicStatsHandler2.SetupNavigationHandler(Direction2D.Up, uilabelHandler5);
		UIMagicStatsHandler uimagicStatsHandler3 = this.topHandlers[3];
		UILabelHandler uilabelHandler6 = this.confirmHandler;
		uimagicStatsHandler3.SetupNavigationHandler(Direction2D.Up, uilabelHandler6);
		UIMagicStatsHandler uimagicStatsHandler4 = this.topHandlers[2];
		UILabelHandler uilabelHandler7 = this.confirmHandler;
		uimagicStatsHandler4.SetupNavigationHandler(Direction2D.Down, uilabelHandler7);
		UIMagicStatsHandler uimagicStatsHandler5 = this.topHandlers[5];
		UILabelHandler uilabelHandler8 = this.confirmHandler;
		uimagicStatsHandler5.SetupNavigationHandler(Direction2D.Down, uilabelHandler8);
		UIMagicStatsHandler[] array8 = this.topHandlers;
		UILabelHandler uilabelHandler9 = this.confirmHandler;
		UIMagicStatsHandler uimagicStatsHandler6 = array8[2];
		uilabelHandler9.SetupNavigationHandler(Direction2D.Up, uimagicStatsHandler6);
		UIMagicStatsHandler[] array9 = this.topHandlers;
		UILabelHandler uilabelHandler10 = this.confirmHandler;
		UIMagicStatsHandler uimagicStatsHandler7 = array9[0];
		uilabelHandler10.SetupNavigationHandler(Direction2D.Down, uimagicStatsHandler7);
	}

	// Token: 0x0600157A RID: 5498 RVA: 0x00030DCC File Offset: 0x0002EFCC
	[Token(Token = "0x600157A")]
	[Address(RVA = "0x101FF70", Offset = "0x101ED70", VA = "0x18101FF70", Slot = "12")]
	protected override void Appear(Action completeHandler)
	{
		UIMagicStatsHandler[] array = this.topHandlers;
		int num = 0;
		int length = array.Length;
		if (num < length)
		{
			array[num].UpdateContent();
			num++;
		}
		Game.GameSave.tips.ResetAllTips();
		UIMagicStatsHandler[] array2 = this.topHandlers;
		UINavigator navigator = this.navigator;
		UIMagicStatsHandler uimagicStatsHandler = array2[0];
		navigator.SetDefaultHandler(uimagicStatsHandler);
		this.bottomNavigationEffect.HideImmediate();
		GameObject gameObject = this.bottomSubmissionEffect.gameObject;
		int num2 = 0;
		gameObject.SetActive(num2 != 0);
		base.Appear(completeHandler);
	}

	// Token: 0x0600157B RID: 5499 RVA: 0x00030E64 File Offset: 0x0002F064
	[Token(Token = "0x600157B")]
	[Address(RVA = "0x764EC0", Offset = "0x763CC0", VA = "0x180764EC0", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		this.navigator.Move(direction);
	}

	// Token: 0x0600157C RID: 5500 RVA: 0x00030E84 File Offset: 0x0002F084
	[Token(Token = "0x600157C")]
	[Address(RVA = "0x10208A0", Offset = "0x101F6A0", VA = "0x1810208A0")]
	private void OnTopHandlerSelected(UIHandlerBase handler)
	{
		Text text = this.description;
		UIMagicStatsHandler[] array = this.topHandlers;
		int index = handler.index;
		string text2 = array[index].description;
		text.text = text2;
		TweenerCore<Color, Color, ColorOptions> tweenerCore = DOTweenModuleUI.DOFade(this.description, 1f, 0.5f).SetEase((Ease)((uint)3)).Play<TweenerCore<Color, Color, ColorOptions>>();
		RectTransform root = this.topNavigationEffect.root;
		RectTransform rectTransform = handler.rectTransform;
		root.parentInternal = rectTransform;
		UINavigationEffect uinavigationEffect = this.topNavigationEffect;
		Vector2 zero = Vector2.zero;
		uinavigationEffect.root.anchoredPosition = zero;
		UIMagicStatsHandler[] array2 = this.topHandlers;
		UINavigationEffect uinavigationEffect2 = this.topNavigationEffect;
		int index2 = handler.index;
		float preferredWidth = array2[index2].label.preferredWidth;
		Vector2 right = Vector2.right;
		uinavigationEffect2.icons[0].rectTransform.anchoredPosition = right;
		uinavigationEffect2.icons[1].rectTransform.anchoredPosition = right;
		this.topNavigationEffect.Appear();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x0600157D RID: 5501 RVA: 0x00030F9C File Offset: 0x0002F19C
	[Token(Token = "0x600157D")]
	[Address(RVA = "0x10170C0", Offset = "0x1015EC0", VA = "0x1810170C0")]
	private void OnTopHandlerDeselected(UIHandlerBase handler)
	{
		this.topNavigationEffect.Hide();
	}

	// Token: 0x0600157E RID: 5502 RVA: 0x00030FBC File Offset: 0x0002F1BC
	[Token(Token = "0x600157E")]
	[Address(RVA = "0x10207E0", Offset = "0x101F5E0", VA = "0x1810207E0")]
	private void OnBottomHandlerSelected(UIHandlerBase handler)
	{
		this.bottomNavigationEffect.Appear();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
		Text text = this.description;
		int num = 0;
		TweenerCore<Color, Color, ColorOptions> tweenerCore = DOTweenModuleUI.DOFade(text, (float)num, 0.5f).SetEase((Ease)((uint)3)).Play<TweenerCore<Color, Color, ColorOptions>>();
	}

	// Token: 0x0600157F RID: 5503 RVA: 0x00031004 File Offset: 0x0002F204
	[Token(Token = "0x600157F")]
	[Address(RVA = "0x1016F00", Offset = "0x1015D00", VA = "0x181016F00")]
	private void OnBottomHandlerDeselected(UIHandlerBase handler)
	{
		this.bottomNavigationEffect.Hide();
	}

	// Token: 0x06001580 RID: 5504 RVA: 0x00031024 File Offset: 0x0002F224
	[Token(Token = "0x6001580")]
	[Address(RVA = "0x1020BB0", Offset = "0x101F9B0", VA = "0x181020BB0", Slot = "21")]
	public override void Submit()
	{
		if (this.navigator.currentHandler && this.navigator.currentHandler.index == 99)
		{
			base.Close();
			this.bottomSubmissionEffect.gameObject.SetActive(true);
			Game.PlayHandlerSE(UIHandlerSFX.Submit);
			Game.PlayHandlerScaleEffect(this.confirmHandler);
			return;
		}
	}

	// Token: 0x06001581 RID: 5505 RVA: 0x00031088 File Offset: 0x0002F288
	[Token(Token = "0x6001581")]
	[Address(RVA = "0x1020640", Offset = "0x101F440", VA = "0x181020640", Slot = "25")]
	public override void Localize(LocalizationData data)
	{
		Text text = this.title;
		string text2 = data.systemText.GetText(5);
		text.text = text2;
		GameFontPack fontPack = data.fontPack;
		Text text3 = this.title;
		Font light = fontPack.light;
		text3.font = light;
		GameFontPack fontPack2 = data.fontPack;
		Text text4 = this.description;
		Font regular = fontPack2.regular;
		text4.font = regular;
		GameTextData systemText = data.systemText;
		UILabelHandler uilabelHandler = this.confirmHandler;
		string text5 = systemText.GetText(12);
		uilabelHandler.SetLabel(text5);
		GameFontPack fontPack3 = data.fontPack;
		Text label = this.confirmHandler.label;
		Font medium = fontPack3.medium;
		label.font = medium;
		UIMagicStatsHandler[] array = this.topHandlers;
		int num = 0;
		int length = array.Length;
		if (num < length)
		{
			UIMagicStatsHandler uimagicStatsHandler = array[num];
			GameFontPack fontPack4 = data.fontPack;
			Text label2 = uimagicStatsHandler.label;
			Font regular2 = fontPack4.regular;
			label2.font = regular2;
			num++;
		}
		UINavigationEffect uinavigationEffect = this.bottomNavigationEffect;
		UILabelHandler uilabelHandler2 = this.confirmHandler;
		uinavigationEffect.UpdateArrowPos(uilabelHandler2);
	}

	// Token: 0x06001582 RID: 5506 RVA: 0x000311A8 File Offset: 0x0002F3A8
	[Token(Token = "0x6001582")]
	[Address(RVA = "0x769BF0", Offset = "0x7689F0", VA = "0x180769BF0")]
	public UIMagicStats()
	{
	}

	// Token: 0x040020B7 RID: 8375
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x40020B7")]
	[SerializeField]
	private Text title;

	// Token: 0x040020B8 RID: 8376
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x40020B8")]
	[SerializeField]
	private Text description;

	// Token: 0x040020B9 RID: 8377
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x40020B9")]
	[SerializeField]
	private UIMagicStatsHandler[] topHandlers;

	// Token: 0x040020BA RID: 8378
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x40020BA")]
	[SerializeField]
	private UILabelHandler confirmHandler;

	// Token: 0x040020BB RID: 8379
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x40020BB")]
	[SerializeField]
	private UINavigationEffect topNavigationEffect;

	// Token: 0x040020BC RID: 8380
	[FieldOffset(Offset = "0x80")]
	[Token(Token = "0x40020BC")]
	[SerializeField]
	private UINavigationEffect bottomNavigationEffect;

	// Token: 0x040020BD RID: 8381
	[FieldOffset(Offset = "0x88")]
	[Token(Token = "0x40020BD")]
	[SerializeField]
	private Image bottomSubmissionEffect;
}
