using System;
using Cpp2IlInjected;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;

namespace Obi.CrossPlatformInput
{
	// Token: 0x02000500 RID: 1280
	[Token(Token = "0x2000500")]
	[RequireComponent(typeof(Image))]
	public class TouchPad : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler
	{
		// Token: 0x06002C9E RID: 11422 RVA: 0x00060888 File Offset: 0x0005EA88
		[Token(Token = "0x6002C9E")]
		[Address(RVA = "0x1302B40", Offset = "0x1301940", VA = "0x181302B40")]
		private void OnEnable()
		{
			bool flag;
			do
			{
				TouchPad.AxisOption axisOption = this.axesToUse;
				if (axisOption == TouchPad.AxisOption.Both)
				{
					this.m_UseX = true;
				}
				flag = axisOption == TouchPad.AxisOption.OnlyHorizontal;
				this.m_UseX = flag;
				bool flag2 = axisOption == TouchPad.AxisOption.OnlyVertical;
				this.m_UseY = flag2;
			}
			while (!flag);
			CrossPlatformInputManager.VirtualAxis virtualAxis = new CrossPlatformInputManager.VirtualAxis(this.horizontalAxisName);
			this.m_HorizontalVirtualAxis = virtualAxis;
			CrossPlatformInputManager.RegisterVirtualAxis(this.m_HorizontalVirtualAxis);
			if (this.m_UseY)
			{
				CrossPlatformInputManager.VirtualAxis virtualAxis2 = new CrossPlatformInputManager.VirtualAxis(this.verticalAxisName);
				this.m_VerticalVirtualAxis = virtualAxis2;
				CrossPlatformInputManager.RegisterVirtualAxis(this.m_VerticalVirtualAxis);
			}
		}

		// Token: 0x06002C9F RID: 11423 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002C9F")]
		[Address(RVA = "0x1302E60", Offset = "0x1301C60", VA = "0x181302E60")]
		private void Start()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002CA0 RID: 11424 RVA: 0x0006090C File Offset: 0x0005EB0C
		[Token(Token = "0x6002CA0")]
		[Address(RVA = "0x1302B40", Offset = "0x1301940", VA = "0x181302B40")]
		private void CreateVirtualAxes()
		{
			bool flag;
			do
			{
				TouchPad.AxisOption axisOption = this.axesToUse;
				if (axisOption == TouchPad.AxisOption.Both)
				{
					this.m_UseX = true;
				}
				flag = axisOption == TouchPad.AxisOption.OnlyHorizontal;
				this.m_UseX = flag;
				bool flag2 = axisOption == TouchPad.AxisOption.OnlyVertical;
				this.m_UseY = flag2;
			}
			while (!flag);
			CrossPlatformInputManager.VirtualAxis virtualAxis = new CrossPlatformInputManager.VirtualAxis(this.horizontalAxisName);
			this.m_HorizontalVirtualAxis = virtualAxis;
			CrossPlatformInputManager.RegisterVirtualAxis(this.m_HorizontalVirtualAxis);
			if (this.m_UseY)
			{
				CrossPlatformInputManager.VirtualAxis virtualAxis2 = new CrossPlatformInputManager.VirtualAxis(this.verticalAxisName);
				this.m_VerticalVirtualAxis = virtualAxis2;
				CrossPlatformInputManager.RegisterVirtualAxis(this.m_VerticalVirtualAxis);
			}
		}

		// Token: 0x06002CA1 RID: 11425 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002CA1")]
		[Address(RVA = "0x1302F00", Offset = "0x1301D00", VA = "0x181302F00")]
		private void UpdateVirtualAxes(Vector3 value)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002CA2 RID: 11426 RVA: 0x00060990 File Offset: 0x0005EB90
		[Token(Token = "0x6002CA2")]
		[Address(RVA = "0x1302D70", Offset = "0x1301B70", VA = "0x181302D70", Slot = "4")]
		public void OnPointerDown(PointerEventData data)
		{
			this.m_Dragging = true;
			int <pointerId>k__BackingField = data.<pointerId>k__BackingField;
			this.m_Id = <pointerId>k__BackingField;
			if (this.controlStyle != TouchPad.ControlStyle.Absolute)
			{
				int num = 0;
				this.m_Center.z = (float)num;
			}
		}

		// Token: 0x06002CA3 RID: 11427 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002CA3")]
		[Address(RVA = "0x1302F80", Offset = "0x1301D80", VA = "0x181302F80")]
		private void Update()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002CA4 RID: 11428 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002CA4")]
		[Address(RVA = "0x1302DD0", Offset = "0x1301BD0", VA = "0x181302DD0", Slot = "5")]
		public void OnPointerUp(PointerEventData data)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002CA5 RID: 11429 RVA: 0x000609D0 File Offset: 0x0005EBD0
		[Token(Token = "0x6002CA5")]
		[Address(RVA = "0x1302C80", Offset = "0x1301A80", VA = "0x181302C80")]
		private void OnDisable()
		{
			if (CrossPlatformInputManager.AxisExists(this.horizontalAxisName))
			{
				CrossPlatformInputManager.UnRegisterVirtualAxis(this.horizontalAxisName);
			}
			if (CrossPlatformInputManager.AxisExists(this.verticalAxisName))
			{
				CrossPlatformInputManager.UnRegisterVirtualAxis(this.verticalAxisName);
			}
		}

		// Token: 0x06002CA6 RID: 11430 RVA: 0x00060A10 File Offset: 0x0005EC10
		[Token(Token = "0x6002CA6")]
		[Address(RVA = "0x13031A0", Offset = "0x1301FA0", VA = "0x1813031A0")]
		public TouchPad()
		{
		}

		// Token: 0x040034E5 RID: 13541
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x40034E5")]
		public TouchPad.AxisOption axesToUse;

		// Token: 0x040034E6 RID: 13542
		[FieldOffset(Offset = "0x1C")]
		[Token(Token = "0x40034E6")]
		public TouchPad.ControlStyle controlStyle;

		// Token: 0x040034E7 RID: 13543
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x40034E7")]
		public string horizontalAxisName = "Horizontal";

		// Token: 0x040034E8 RID: 13544
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x40034E8")]
		public string verticalAxisName = "Vertical";

		// Token: 0x040034E9 RID: 13545
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x40034E9")]
		public float Xsensitivity = 1f;

		// Token: 0x040034EA RID: 13546
		[FieldOffset(Offset = "0x34")]
		[Token(Token = "0x40034EA")]
		public float Ysensitivity = 1f;

		// Token: 0x040034EB RID: 13547
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x40034EB")]
		private Vector3 m_StartPos;

		// Token: 0x040034EC RID: 13548
		[FieldOffset(Offset = "0x44")]
		[Token(Token = "0x40034EC")]
		private Vector2 m_PreviousDelta;

		// Token: 0x040034ED RID: 13549
		[FieldOffset(Offset = "0x4C")]
		[Token(Token = "0x40034ED")]
		private Vector3 m_JoytickOutput;

		// Token: 0x040034EE RID: 13550
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x40034EE")]
		private bool m_UseX;

		// Token: 0x040034EF RID: 13551
		[FieldOffset(Offset = "0x59")]
		[Token(Token = "0x40034EF")]
		private bool m_UseY;

		// Token: 0x040034F0 RID: 13552
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x40034F0")]
		private CrossPlatformInputManager.VirtualAxis m_HorizontalVirtualAxis;

		// Token: 0x040034F1 RID: 13553
		[FieldOffset(Offset = "0x68")]
		[Token(Token = "0x40034F1")]
		private CrossPlatformInputManager.VirtualAxis m_VerticalVirtualAxis;

		// Token: 0x040034F2 RID: 13554
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x40034F2")]
		private bool m_Dragging;

		// Token: 0x040034F3 RID: 13555
		[FieldOffset(Offset = "0x74")]
		[Token(Token = "0x40034F3")]
		private int m_Id = (int)((ulong)4294967295L);

		// Token: 0x040034F4 RID: 13556
		[FieldOffset(Offset = "0x78")]
		[Token(Token = "0x40034F4")]
		private Vector2 m_PreviousTouchPos;

		// Token: 0x040034F5 RID: 13557
		[FieldOffset(Offset = "0x80")]
		[Token(Token = "0x40034F5")]
		private Vector3 m_Center;

		// Token: 0x040034F6 RID: 13558
		[FieldOffset(Offset = "0x90")]
		[Token(Token = "0x40034F6")]
		private Image m_Image;

		// Token: 0x02000501 RID: 1281
		[Token(Token = "0x2000501")]
		public enum AxisOption
		{
			// Token: 0x040034F8 RID: 13560
			[Token(Token = "0x40034F8")]
			Both,
			// Token: 0x040034F9 RID: 13561
			[Token(Token = "0x40034F9")]
			OnlyHorizontal,
			// Token: 0x040034FA RID: 13562
			[Token(Token = "0x40034FA")]
			OnlyVertical
		}

		// Token: 0x02000502 RID: 1282
		[Token(Token = "0x2000502")]
		public enum ControlStyle
		{
			// Token: 0x040034FC RID: 13564
			[Token(Token = "0x40034FC")]
			Absolute,
			// Token: 0x040034FD RID: 13565
			[Token(Token = "0x40034FD")]
			Relative,
			// Token: 0x040034FE RID: 13566
			[Token(Token = "0x40034FE")]
			Swipe
		}
	}
}
