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

// Token: 0x0200027A RID: 634
[Token(Token = "0x200027A")]
public class UIMagicStats : GameCanvasBase
{
	// Token: 0x06001792 RID: 6034 RVA: 0x00035AB4 File Offset: 0x00033CB4
	[Token(Token = "0x6001792")]
	[Address(RVA = "0xE791E0", Offset = "0xE781E0", VA = "0x180E791E0", 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: 0x06001793 RID: 6035 RVA: 0x00035D0C File Offset: 0x00033F0C
	[Token(Token = "0x6001793")]
	[Address(RVA = "0xE79080", Offset = "0xE78080", VA = "0x180E79080", 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: 0x06001794 RID: 6036 RVA: 0x00035DA4 File Offset: 0x00033FA4
	[Token(Token = "0x6001794")]
	[Address(RVA = "0x94CB50", Offset = "0x94BB50", VA = "0x18094CB50", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		this.navigator.Move(direction);
	}

	// Token: 0x06001795 RID: 6037 RVA: 0x00035DC4 File Offset: 0x00033FC4
	[Token(Token = "0x6001795")]
	[Address(RVA = "0xE799B0", Offset = "0xE789B0", VA = "0x180E799B0")]
	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: 0x06001796 RID: 6038 RVA: 0x00035EDC File Offset: 0x000340DC
	[Token(Token = "0x6001796")]
	[Address(RVA = "0xE70210", Offset = "0xE6F210", VA = "0x180E70210")]
	private void OnTopHandlerDeselected(UIHandlerBase handler)
	{
		this.topNavigationEffect.Hide();
	}

	// Token: 0x06001797 RID: 6039 RVA: 0x00035EFC File Offset: 0x000340FC
	[Token(Token = "0x6001797")]
	[Address(RVA = "0xE798F0", Offset = "0xE788F0", VA = "0x180E798F0")]
	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: 0x06001798 RID: 6040 RVA: 0x00035F44 File Offset: 0x00034144
	[Token(Token = "0x6001798")]
	[Address(RVA = "0x95C100", Offset = "0x95B100", VA = "0x18095C100")]
	private void OnBottomHandlerDeselected(UIHandlerBase handler)
	{
		this.bottomNavigationEffect.Hide();
	}

	// Token: 0x06001799 RID: 6041 RVA: 0x00035F64 File Offset: 0x00034164
	[Token(Token = "0x6001799")]
	[Address(RVA = "0xE79CC0", Offset = "0xE78CC0", VA = "0x180E79CC0", 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: 0x0600179A RID: 6042 RVA: 0x00035FC8 File Offset: 0x000341C8
	[Token(Token = "0x600179A")]
	[Address(RVA = "0xE79750", Offset = "0xE78750", VA = "0x180E79750", 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: 0x0600179B RID: 6043 RVA: 0x000360E8 File Offset: 0x000342E8
	[Token(Token = "0x600179B")]
	[Address(RVA = "0x94D9C0", Offset = "0x94C9C0", VA = "0x18094D9C0")]
	public UIMagicStats()
	{
	}

	// Token: 0x040022FF RID: 8959
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x40022FF")]
	[SerializeField]
	private Text title;

	// Token: 0x04002300 RID: 8960
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x4002300")]
	[SerializeField]
	private Text description;

	// Token: 0x04002301 RID: 8961
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x4002301")]
	[SerializeField]
	private UIMagicStatsHandler[] topHandlers;

	// Token: 0x04002302 RID: 8962
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x4002302")]
	[SerializeField]
	private UILabelHandler confirmHandler;

	// Token: 0x04002303 RID: 8963
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x4002303")]
	[SerializeField]
	private UINavigationEffect topNavigationEffect;

	// Token: 0x04002304 RID: 8964
	[FieldOffset(Offset = "0x80")]
	[Token(Token = "0x4002304")]
	[SerializeField]
	private UINavigationEffect bottomNavigationEffect;

	// Token: 0x04002305 RID: 8965
	[FieldOffset(Offset = "0x88")]
	[Token(Token = "0x4002305")]
	[SerializeField]
	private Image bottomSubmissionEffect;
}
