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

// Token: 0x02000261 RID: 609
[Token(Token = "0x2000261")]
public class UITrade : GameCanvasBase
{
	// Token: 0x0600177D RID: 6013 RVA: 0x000396F0 File Offset: 0x000378F0
	[Token(Token = "0x600177D")]
	[Address(RVA = "0x18B5490", Offset = "0x18B4290", VA = "0x1818B5490")]
	public void InitAndOpen(Action closedHandler, SavePoint savePointData)
	{
		this.InitDisplayInfo(savePointData);
		base.Open(closedHandler);
	}

	// Token: 0x0600177E RID: 6014 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600177E")]
	[Address(RVA = "0x18B5FB0", Offset = "0x18B4DB0", VA = "0x1818B5FB0", Slot = "11")]
	public override void Init()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600177F RID: 6015 RVA: 0x0003970C File Offset: 0x0003790C
	[Token(Token = "0x600177F")]
	[Address(RVA = "0x18B50F0", Offset = "0x18B3EF0", VA = "0x1818B50F0", Slot = "12")]
	protected override void Appear(Action completeHandler)
	{
		this.returnNavigation.HideImmediate();
		this.tradeNavigation.HideImmediate();
		UITradeHandler[] array = this.handlers;
		UINavigator navigator = this.navigator;
		UITradeHandler uitradeHandler = array[0];
		navigator.SetDefaultHandler(uitradeHandler);
		GameObject gameObject = this.buttonSelectionIcon.gameObject;
		int num = 0;
		gameObject.SetActive(num != 0);
		base.Appear(completeHandler);
	}

	// Token: 0x06001780 RID: 6016 RVA: 0x00039770 File Offset: 0x00037970
	[Token(Token = "0x6001780")]
	[Address(RVA = "0x18B51A0", Offset = "0x18B3FA0", VA = "0x1818B51A0", Slot = "13")]
	protected override void Hide(Action completeHandler)
	{
		UITradeHandler uitradeHandler = this.currentTradeHandler;
		int num = 0;
		if (uitradeHandler != num)
		{
			this.currentTradeHandler.CancelTrade();
		}
		base.Hide(completeHandler);
	}

	// Token: 0x06001781 RID: 6017 RVA: 0x000397A8 File Offset: 0x000379A8
	[Token(Token = "0x6001781")]
	[Address(RVA = "0x764EC0", Offset = "0x763CC0", VA = "0x180764EC0", Slot = "18")]
	public override void Move(Direction2D direction)
	{
		this.navigator.Move(direction);
	}

	// Token: 0x06001782 RID: 6018 RVA: 0x000397C8 File Offset: 0x000379C8
	[Token(Token = "0x6001782")]
	[Address(RVA = "0x18B6B40", Offset = "0x18B5940", VA = "0x1818B6B40", Slot = "21")]
	public override void Submit()
	{
		UIHandlerBase currentHandler = this.navigator.currentHandler;
		int num = 0;
		bool flag = currentHandler == num;
		if (flag)
		{
			return;
		}
		if (this.navigator.currentHandler.index == 998)
		{
			this.PerformSubmitEffect();
			base.Close();
			Game.PlayHandlerScaleEffect(this.navigator.currentHandler);
			Game.PlayCanvasSE(UICanvasSFX.Close);
			return;
		}
		while (!flag)
		{
		}
		this.PerformSubmitEffect();
		Game.CloseStageUI();
		UINavigator navigator = this.navigator;
		throw new NullReferenceException();
	}

	// Token: 0x06001783 RID: 6019 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001783")]
	[Address(RVA = "0x18B5240", Offset = "0x18B4040", VA = "0x1818B5240", Slot = "22")]
	public override void Hold(bool isHolding)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001784 RID: 6020 RVA: 0x00039848 File Offset: 0x00037A48
	[Token(Token = "0x6001784")]
	[Address(RVA = "0x18B6080", Offset = "0x18B4E80", VA = "0x1818B6080", Slot = "25")]
	public override void Localize(LocalizationData data)
	{
		Text text = this.title;
		string text2 = data.systemText.GetText(181);
		text.text = text2;
		GameTextData systemText = data.systemText;
		Text text3 = this.hold;
		string text4 = systemText.GetText(184);
		text3.text = text4;
		GameTextData systemText2 = data.systemText;
		UILabelHandler uilabelHandler = this.backHandler;
		string text5 = systemText2.GetText(12);
		uilabelHandler.SetLabel(text5);
		GameTextData systemText3 = data.systemText;
		UILabelHandler uilabelHandler2 = this.confirmHandler;
		string text6 = systemText3.GetText(13);
		uilabelHandler2.SetLabel(text6);
		GameFontPack fontPack = data.fontPack;
		Text text7 = this.title;
		Font light = fontPack.light;
		text7.font = light;
		UITradeHandler[] array = this.handlers;
		int num = 0;
		int length = array.Length;
		if (num < length)
		{
			UITradeHandler uitradeHandler = array[num];
			GameFontPack fontPack2 = data.fontPack;
			Text number = uitradeHandler.number;
			Font regular = fontPack2.regular;
			number.font = regular;
			Text cost = uitradeHandler.cost;
			Font regular2 = fontPack2.regular;
			cost.font = regular2;
			num++;
		}
		GameFontPack fontPack3 = data.fontPack;
		Text text8 = this.hold;
		Font regular3 = fontPack3.regular;
		text8.font = regular3;
		GameFontPack fontPack4 = data.fontPack;
		Text text9 = this.keyboardText;
		Font regular4 = fontPack4.regular;
		text9.font = regular4;
		GameFontPack fontPack5 = data.fontPack;
		Text text10 = this.description;
		Font regular5 = fontPack5.regular;
		text10.font = regular5;
		GameFontPack fontPack6 = data.fontPack;
		UILabelHandler uilabelHandler3 = this.backHandler;
		Font medium = fontPack6.medium;
		uilabelHandler3.SetFont(medium);
		GameFontPack fontPack7 = data.fontPack;
		UILabelHandler uilabelHandler4 = this.confirmHandler;
		Font medium2 = fontPack7.medium;
		uilabelHandler4.SetFont(medium2);
	}

	// Token: 0x06001785 RID: 6021 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001785")]
	[Address(RVA = "0x18B56A0", Offset = "0x18B44A0", VA = "0x1818B56A0")]
	private void InitHandlers()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001786 RID: 6022 RVA: 0x00039A1C File Offset: 0x00037C1C
	[Token(Token = "0x6001786")]
	[Address(RVA = "0x18B54D0", Offset = "0x18B42D0", VA = "0x1818B54D0")]
	private void InitDisplayInfo(SavePoint savePointData)
	{
		int num = 0;
		if (!(savePointData != num))
		{
			Debug.Log("UIBuy-NULL");
			UITradeHandler[] array = this.handlers;
			int num2 = 0;
			if (num2 >= array.Length)
			{
				return;
			}
			UITradeHandler uitradeHandler = array[num2];
			int num3 = 0;
			uitradeHandler.UpdateItemInfo((ItemSystem.ItemType)num3);
			UITradeHandler[] array2 = this.handlers;
			num2++;
		}
		UITradeHandler[] array3 = this.handlers;
		int num4 = 0;
		if (num4 < array3.Length)
		{
			UITradeHandler uitradeHandler2 = array3[num4];
			ItemSystem.ItemType[] sellItem = savePointData.SellItem;
			if (num4 < sellItem.Length)
			{
			}
			uitradeHandler2.UpdateItemInfo((ItemSystem.ItemType)num4);
			UITradeHandler[] array4 = this.handlers;
			num4++;
			while (array4 != 0)
			{
			}
		}
	}

	// Token: 0x06001787 RID: 6023 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001787")]
	[Address(RVA = "0x18B6820", Offset = "0x18B5620", VA = "0x1818B6820")]
	private void RefreshActionTip(ControllerDevice device)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x06001788 RID: 6024 RVA: 0x00039AC8 File Offset: 0x00037CC8
	[Token(Token = "0x6001788")]
	[Address(RVA = "0x18B63F0", Offset = "0x18B51F0", VA = "0x1818B63F0")]
	private void OnTradeFailed()
	{
		Text text = this.description;
		string text2 = Game.<UISystemText>k__BackingField.GetText(218);
		bool dtdValidation = ((IDtdParserAdapterWithValidation)text).DtdValidation;
	}

	// Token: 0x06001789 RID: 6025 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x6001789")]
	[Address(RVA = "0x18B65D0", Offset = "0x18B53D0", VA = "0x1818B65D0")]
	private void OnTradeHandlerSelected(UIHandlerBase handler)
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600178A RID: 6026 RVA: 0x00039AFC File Offset: 0x00037CFC
	[Token(Token = "0x600178A")]
	[Address(RVA = "0x18B64D0", Offset = "0x18B52D0", VA = "0x1818B64D0")]
	private void OnTradeHandlerDeselected(UIHandlerBase handler)
	{
		this.tradeNavigation.Hide();
		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>>();
		UITradeHandler uitradeHandler = this.currentTradeHandler;
		int num2 = 0;
		if (uitradeHandler != num2)
		{
			this.currentTradeHandler.CancelTrade();
			return;
		}
	}

	// Token: 0x0600178B RID: 6027 RVA: 0x00039B60 File Offset: 0x00037D60
	[Token(Token = "0x600178B")]
	[Address(RVA = "0x18B6310", Offset = "0x18B5110", VA = "0x1818B6310")]
	private void OnHandlerButtonSelected(UIHandlerBase handler)
	{
		UINavigationEffect uinavigationEffect = this.returnNavigation;
		Vector2 anchoredPosition = handler.rectTransform.anchoredPosition;
		uinavigationEffect.UpdatePos(anchoredPosition);
		UINavigationEffect uinavigationEffect2 = this.returnNavigation;
		if (handler.index != 998)
		{
		}
		UILabelHandler uilabelHandler = this.backHandler;
		uinavigationEffect2.UpdateArrowPos(uilabelHandler);
		this.returnNavigation.Appear();
		Game.PlayHandlerSE(UIHandlerSFX.Navigation);
	}

	// Token: 0x0600178C RID: 6028 RVA: 0x00039BC0 File Offset: 0x00037DC0
	[Token(Token = "0x600178C")]
	[Address(RVA = "0x18A8CE0", Offset = "0x18A7AE0", VA = "0x1818A8CE0")]
	private void OnHandlerButtonDeselected(UIHandlerBase handler)
	{
		this.returnNavigation.Hide();
	}

	// Token: 0x0600178D RID: 6029 RVA: 0x000020D3 File Offset: 0x000002D3
	[Token(Token = "0x600178D")]
	[Address(RVA = "0x18B6760", Offset = "0x18B5560", VA = "0x1818B6760")]
	private void PerformSubmitEffect()
	{
		throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
	}

	// Token: 0x0600178E RID: 6030 RVA: 0x00039BE0 File Offset: 0x00037DE0
	[Token(Token = "0x600178E")]
	[Address(RVA = "0x769BF0", Offset = "0x7689F0", VA = "0x180769BF0")]
	public UITrade()
	{
	}

	// Token: 0x040021B2 RID: 8626
	[FieldOffset(Offset = "0x58")]
	[Token(Token = "0x40021B2")]
	[SerializeField]
	private Text title;

	// Token: 0x040021B3 RID: 8627
	[FieldOffset(Offset = "0x60")]
	[Token(Token = "0x40021B3")]
	[SerializeField]
	private UITradeHandler[] handlers;

	// Token: 0x040021B4 RID: 8628
	[FieldOffset(Offset = "0x68")]
	[Token(Token = "0x40021B4")]
	[SerializeField]
	private UILabelHandler backHandler;

	// Token: 0x040021B5 RID: 8629
	[FieldOffset(Offset = "0x70")]
	[Token(Token = "0x40021B5")]
	[SerializeField]
	private UILabelHandler confirmHandler;

	// Token: 0x040021B6 RID: 8630
	[FieldOffset(Offset = "0x78")]
	[Token(Token = "0x40021B6")]
	[SerializeField]
	private Text description;

	// Token: 0x040021B7 RID: 8631
	[FieldOffset(Offset = "0x80")]
	[Token(Token = "0x40021B7")]
	[SerializeField]
	private RectTransform buttonSelectionIcon;

	// Token: 0x040021B8 RID: 8632
	[FieldOffset(Offset = "0x88")]
	[Token(Token = "0x40021B8")]
	[SerializeField]
	private UINavigationEffect returnNavigation;

	// Token: 0x040021B9 RID: 8633
	[FieldOffset(Offset = "0x90")]
	[Token(Token = "0x40021B9")]
	[SerializeField]
	private UINavigationEffect tradeNavigation;

	// Token: 0x040021BA RID: 8634
	[FieldOffset(Offset = "0x98")]
	[Token(Token = "0x40021BA")]
	[SerializeField]
	private Image controllerImg;

	// Token: 0x040021BB RID: 8635
	[FieldOffset(Offset = "0xA0")]
	[Token(Token = "0x40021BB")]
	[SerializeField]
	private Image keyboardImg;

	// Token: 0x040021BC RID: 8636
	[FieldOffset(Offset = "0xA8")]
	[Token(Token = "0x40021BC")]
	[SerializeField]
	private Text hold;

	// Token: 0x040021BD RID: 8637
	[FieldOffset(Offset = "0xB0")]
	[Token(Token = "0x40021BD")]
	[SerializeField]
	private Text keyboardText;

	// Token: 0x040021BE RID: 8638
	[FieldOffset(Offset = "0xB8")]
	[Token(Token = "0x40021BE")]
	private UITradeHandler currentTradeHandler;

	// Token: 0x040021BF RID: 8639
	[Token(Token = "0x40021BF")]
	private const int BACK_HANDLER_INDEX = 998;

	// Token: 0x040021C0 RID: 8640
	[Token(Token = "0x40021C0")]
	private const int CONFIRM_HANDLER_INDEX = 999;
}
