using System;
using System.Collections.Generic;
using System.Xml.Schema;
using Cpp2IlInjected;
using DG.Tweening;
using DG.Tweening.Core;
using DG.Tweening.Plugins.Options;
using MarsSDK;
using UnityEngine;
using UnityEngine.UI;

// Token: 0x0200026B RID: 619
[Token(Token = "0x200026B")]
public class UIDialogueSelect : GameCanvasBase
{
	// Token: 0x0600171C RID: 5916 RVA: 0x00034190 File Offset: 0x00032390
	[Token(Token = "0x600171C")]
	[Address(RVA = "0x19DB080", Offset = "0x19DA080", VA = "0x1819DB080", Slot = "11")]
	public override void Init()
	{
		UIDialogueLabelHandler[] handlers = this.Handlers;
		int num = 0;
		UIDialogueLabelHandler[] handlers2;
		if (num < handlers.Length)
		{
			handlers[num].index = num;
			UIDialogueLabelHandler uidialogueLabelHandler = this.Handlers[num];
			Action<UIHandlerBase> action = new Action(this.OnHandlerSelected);
			uidialogueLabelHandler.onSelectedHandler = action;
			UIDialogueLabelHandler uidialogueLabelHandler2 = this.Handlers[num];
			Action<UIHandlerBase> action2 = new Action(this.OnHandlerDeselected);
			uidialogueLabelHandler2.onDeselectedHandler = action2;
			handlers2 = this.Handlers;
			num++;
		}
		this.navigator.BindPointerEnterEvent(handlers2);
		UINavigator navigator = this.navigator;
		UIDialogueLabelHandler[] handlers3 = this.Handlers;
		navigator.BindPointerExitEvent(handlers3);
		List<UIHandlerBase> list = new List(this.Handlers);
		int num2 = 0;
		UINavigationSetter uinavigationSetter = UINavigationSetter.Get(UINavigationMode.Vertical, true, num2);
		UIHandlerBase[] array = list.ToArray();
		uinavigationSetter.Apply(array);
	}

	// Token: 0x0600171D RID: 5917 RVA: 0x00034268 File Offset: 0x00032468
	[Token(Token = "0x600171D")]
	[Address(RVA = "0x672E50", Offset = "0x671E50", VA = "0x180672E50")]
	public void SetDialogueSelectEvent(SceneEvent[] Event)
	{
		/*
An exception occurred when decompiling this method (0600171D)

ICSharpCode.Decompiler.DecompilerException: Error decompiling System.Void UIDialogueSelect::SetDialogueSelectEvent(SceneEvent[])

 ---> System.Exception: Basic block has to end with unconditional control flow. 
{; 	Block_0:; 	stfld:class SceneEvent[](UIDialogueSelect::dialogueSelectEvent, ldloc:UIDialogueSelect(this), ldloc:class SceneEvent[](Event)); }; 
   at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.FlattenBasicBlocks(ILNode node) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 1810
   at ICSharpCode.Decompiler.ILAst.ILAstOptimizer.Optimize(DecompilerContext context, ILBlock method, AutoPropertyProvider autoPropertyProvider, StateMachineKind& stateMachineKind, MethodDef& inlinedMethod, AsyncMethodDebugInfo& asyncInfo, ILAstOptimizationStep abortBeforeStep) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\ILAst\ILAstOptimizer.cs:line 344
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(IEnumerable`1 parameters, MethodDebugInfoBuilder& builder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 123
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 88
   --- End of inner exception stack trace ---
   at ICSharpCode.Decompiler.Ast.AstMethodBodyBuilder.CreateMethodBody(MethodDef methodDef, DecompilerContext context, AutoPropertyProvider autoPropertyProvider, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, StringBuilder sb, MethodDebugInfoBuilder& stmtsBuilder) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstMethodBodyBuilder.cs:line 92
   at ICSharpCode.Decompiler.Ast.AstBuilder.AddMethodBody(EntityDeclaration methodNode, EntityDeclaration& updatedNode, MethodDef method, IEnumerable`1 parameters, Boolean valueParameterIsKeyword, MethodKind methodKind) in D:\a\dnSpy\dnSpy\Extensions\ILSpy.Decompiler\ICSharpCode.Decompiler\ICSharpCode.Decompiler\Ast\AstBuilder.cs:line 1618
*/;
	}

	// Token: 0x0600171E RID: 5918 RVA: 0x0003427C File Offset: 0x0003247C
	[Token(Token = "0x600171E")]
	[Address(RVA = "0x19DAD50", Offset = "0x19D9D50", VA = "0x1819DAD50", Slot = "12")]
	protected override void Appear(Action completeHandler)
	{
		UIDialogueLabelHandler[] handlers = this.Handlers;
		int num = 0;
		if (num < handlers.Length)
		{
			UIDialogueLabelHandler uidialogueLabelHandler = handlers[num];
			GameDialoguePackage dialoguePack = Game.GetDialoguePack();
			Image labelImage = uidialogueLabelHandler.labelImage;
			Sprite dialogueSelect = dialoguePack.dialogueSelect;
			labelImage.sprite = dialogueSelect;
			UIDialogueLabelHandler[] handlers2 = this.Handlers;
			num++;
		}
		Image submitImage = this.SubmitImage;
		Sprite dialogueSelected = Game.GetDialoguePack().dialogueSelected;
		submitImage.sprite = dialogueSelected;
		StageFlagData flags = Game.GameSave.flags;
		UIDialogueLabelHandler[] handlers3 = this.Handlers;
		if (!flags.stageBRTest)
		{
			UIDialogueLabelHandler uidialogueLabelHandler2 = handlers3[1];
		}
		UIDialogueLabelHandler uidialogueLabelHandler3 = handlers3[1];
		string text = this.strRemoveTestMode;
		uidialogueLabelHandler3.SetLabelText(text);
		UIDialogueLabelHandler[] handlers4 = this.Handlers;
		UINavigator navigator = this.navigator;
		UIDialogueLabelHandler uidialogueLabelHandler4 = handlers4[2];
		navigator.SetDefaultHandler(uidialogueLabelHandler4);
		TweenerCore<Vector3, Vector3, VectorOptions> tweenerCore = ShortcutExtensions.DOScale(this.SubmitRoot, 1f, 0.01f).SetEase((Ease)((uint)3)).SetUpdate(true)
			.Play<TweenerCore<Vector3, Vector3, VectorOptions>>();
		GameObject gameObject = this.SubmitRoot.gameObject;
		int num2 = 0;
		gameObject.SetActive(num2 != 0);
		base.Appear(completeHandler);
	}

	// Token: 0x0600171F RID: 5919 RVA: 0x000343AC File Offset: 0x000325AC
	[Token(Token = "0x600171F")]
	[Address(RVA = "0x94CB50", Offset = "0x94BB50", VA = "0x18094CB50", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		this.navigator.Move(direction);
	}

	// Token: 0x06001720 RID: 5920 RVA: 0x000343CC File Offset: 0x000325CC
	[Token(Token = "0x6001720")]
	[Address(RVA = "0x19DB550", Offset = "0x19DA550", VA = "0x1819DB550")]
	private void OnHandlerSelected(UIHandlerBase handler)
	{
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
		UIDialogueLabelHandler[] handlers = this.Handlers;
		int index = handler.index;
		UIDialogueLabelHandler uidialogueLabelHandler = handlers[index];
		GameDialoguePackage dialoguePack = Game.GetDialoguePack();
		Image labelImage = uidialogueLabelHandler.labelImage;
		Sprite dialogueSelected = dialoguePack.dialogueSelected;
		labelImage.sprite = dialogueSelected;
	}

	// Token: 0x06001721 RID: 5921 RVA: 0x00034420 File Offset: 0x00032620
	[Token(Token = "0x6001721")]
	[Address(RVA = "0x19DB4A0", Offset = "0x19DA4A0", VA = "0x1819DB4A0")]
	private void OnHandlerDeselected(UIHandlerBase handler)
	{
		UIDialogueLabelHandler[] handlers = this.Handlers;
		int index = handler.index;
		UIDialogueLabelHandler uidialogueLabelHandler = handlers[index];
		GameDialoguePackage dialoguePack = Game.GetDialoguePack();
		Image labelImage = uidialogueLabelHandler.labelImage;
		Sprite dialogueSelect = dialoguePack.dialogueSelect;
		labelImage.sprite = dialogueSelect;
	}

	// Token: 0x06001722 RID: 5922 RVA: 0x0003446C File Offset: 0x0003266C
	[Token(Token = "0x6001722")]
	[Address(RVA = "0x19DB610", Offset = "0x19DA610", VA = "0x1819DB610", Slot = "21")]
	public override void Submit()
	{
		UIHandlerBase currentHandler = this.navigator.currentHandler;
		int num = 0;
		if (!(currentHandler == num))
		{
			UIHandlerBase currentHandler2 = this.navigator.currentHandler;
			SceneEvent[] array = this.dialogueSelectEvent;
			int index = currentHandler2.index;
			array[index].OpenEvent();
			base.Close();
			this.SubmitRoot.gameObject.SetActive(true);
			UIDialogueLabelHandler[] handlers = this.Handlers;
			RectTransform submitRoot = this.SubmitRoot;
			Vector2 anchoredPosition = handlers[index].rectTransform.anchoredPosition;
			submitRoot.anchoredPosition = anchoredPosition;
			UIDialogueLabelHandler[] handlers2 = this.Handlers;
			Text submitText = this.SubmitText;
			string text = handlers2[index].labelText.text;
			submitText.text = text;
			TweenerCore<Vector3, Vector3, VectorOptions> tweenerCore = ShortcutExtensions.DOScale(this.SubmitRoot, 1.8f, 0.2f).SetEase((Ease)((uint)3)).SetUpdate(true)
				.Play<TweenerCore<Vector3, Vector3, VectorOptions>>();
			Game.PlayHandlerSE(UIHandlerSFX.Submit);
		}
	}

	// Token: 0x06001723 RID: 5923 RVA: 0x00034564 File Offset: 0x00032764
	[Token(Token = "0x6001723")]
	[Address(RVA = "0x19DB020", Offset = "0x19DA020", VA = "0x1819DB020", Slot = "23")]
	public override void Cancel()
	{
		base.Cancel();
		XmlSchemaType xmlType = this.dialogueSelectEvent[2].XmlType;
	}

	// Token: 0x06001724 RID: 5924 RVA: 0x00034590 File Offset: 0x00032790
	[Token(Token = "0x6001724")]
	[Address(RVA = "0x19DB2F0", Offset = "0x19DA2F0", VA = "0x1819DB2F0", Slot = "25")]
	public override void Localize(LocalizationData data)
	{
		UIDialogueLabelHandler uidialogueLabelHandler = this.Handlers[0];
		string text = data.systemText.GetText(1308);
		uidialogueLabelHandler.SetLabelText(text);
		string text2 = data.systemText.GetText(1309);
		this.strRemoveTestMode = text2;
		string text3 = data.systemText.GetText(1313);
		this.strResetBossRush = text3;
		UIDialogueLabelHandler[] handlers = this.Handlers;
		GameTextData systemText = data.systemText;
		UIDialogueLabelHandler uidialogueLabelHandler2 = handlers[2];
		string text4 = systemText.GetText(14);
		uidialogueLabelHandler2.SetLabelText(text4);
		UIDialogueLabelHandler[] handlers2 = this.Handlers;
		int num = 0;
		int length = handlers2.Length;
		if (num < length)
		{
			GameFontPack fontPack = data.fontPack;
			Text labelText = handlers2[num].labelText;
			Font medium = fontPack.medium;
			labelText.font = medium;
			num++;
		}
	}

	// Token: 0x06001725 RID: 5925 RVA: 0x00034670 File Offset: 0x00032870
	[Token(Token = "0x6001725")]
	[Address(RVA = "0x94D9C0", Offset = "0x94C9C0", VA = "0x18094D9C0")]
	public UIDialogueSelect()
	{
	}

	// Token: 0x040022B3 RID: 8883
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x40022B3")]
	[SerializeField]
	private UIDialogueLabelHandler[] Handlers;

	// Token: 0x040022B4 RID: 8884
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x40022B4")]
	[SerializeField]
	private RectTransform SubmitRoot;

	// Token: 0x040022B5 RID: 8885
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x40022B5")]
	[SerializeField]
	private Image SubmitImage;

	// Token: 0x040022B6 RID: 8886
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x40022B6")]
	[SerializeField]
	private Text SubmitText;

	// Token: 0x040022B7 RID: 8887
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x40022B7")]
	private string strRemoveTestMode;

	// Token: 0x040022B8 RID: 8888
	[FieldOffset(Offset = "0x80")]
	[Token(Token = "0x40022B8")]
	private string strResetBossRush;

	// Token: 0x040022B9 RID: 8889
	[FieldOffset(Offset = "0x88")]
	[Token(Token = "0x40022B9")]
	private SceneEvent[] dialogueSelectEvent;
}
