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

namespace Obi.CrossPlatformInput
{
	// Token: 0x020004F9 RID: 1273
	[Token(Token = "0x20004F9")]
	public class Joystick : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IDragHandler
	{
		// Token: 0x06002C8B RID: 11403 RVA: 0x000605F4 File Offset: 0x0005E7F4
		[Token(Token = "0x6002C8B")]
		[Address(RVA = "0x10E2210", Offset = "0x10E1010", VA = "0x1810E2210")]
		private void OnEnable()
		{
			bool flag;
			do
			{
				Joystick.AxisOption axisOption = this.axesToUse;
				if (axisOption == Joystick.AxisOption.Both)
				{
					this.m_UseX = true;
				}
				flag = axisOption == Joystick.AxisOption.OnlyHorizontal;
				this.m_UseX = flag;
				bool flag2 = axisOption == Joystick.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: 0x06002C8C RID: 11404 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002C8C")]
		[Address(RVA = "0x10E2600", Offset = "0x10E1400", VA = "0x1810E2600")]
		private void Start()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002C8D RID: 11405 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002C8D")]
		[Address(RVA = "0x10E2640", Offset = "0x10E1440", VA = "0x1810E2640")]
		private void UpdateVirtualAxes(Vector3 value)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002C8E RID: 11406 RVA: 0x00060678 File Offset: 0x0005E878
		[Token(Token = "0x6002C8E")]
		[Address(RVA = "0x10E2210", Offset = "0x10E1010", VA = "0x1810E2210")]
		private void CreateVirtualAxes()
		{
			bool flag;
			do
			{
				Joystick.AxisOption axisOption = this.axesToUse;
				if (axisOption == Joystick.AxisOption.Both)
				{
					this.m_UseX = true;
				}
				flag = axisOption == Joystick.AxisOption.OnlyHorizontal;
				this.m_UseX = flag;
				bool flag2 = axisOption == Joystick.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: 0x06002C8F RID: 11407 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002C8F")]
		[Address(RVA = "0x10E23A0", Offset = "0x10E11A0", VA = "0x1810E23A0", Slot = "6")]
		public void OnDrag(PointerEventData data)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002C90 RID: 11408 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002C90")]
		[Address(RVA = "0x10E2550", Offset = "0x10E1350", VA = "0x1810E2550", Slot = "5")]
		public void OnPointerUp(PointerEventData data)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002C91 RID: 11409 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002C91")]
		[Address(RVA = "0x297F00", Offset = "0x296D00", VA = "0x180297F00", Slot = "4")]
		public void OnPointerDown(PointerEventData data)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002C92 RID: 11410 RVA: 0x000606FC File Offset: 0x0005E8FC
		[Token(Token = "0x6002C92")]
		[Address(RVA = "0x10E2350", Offset = "0x10E1150", VA = "0x1810E2350")]
		private void OnDisable()
		{
			if (this.m_UseX)
			{
				this.m_HorizontalVirtualAxis.Remove();
			}
			if (this.m_UseY)
			{
				this.m_VerticalVirtualAxis.Remove();
				return;
			}
		}

		// Token: 0x06002C93 RID: 11411 RVA: 0x00060738 File Offset: 0x0005E938
		[Token(Token = "0x6002C93")]
		[Address(RVA = "0x10E26C0", Offset = "0x10E14C0", VA = "0x1810E26C0")]
		public Joystick()
		{
		}

		// Token: 0x040034C9 RID: 13513
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x40034C9")]
		public int MovementRange = (int)((ulong)100L);

		// Token: 0x040034CA RID: 13514
		[FieldOffset(Offset = "0x1C")]
		[Token(Token = "0x40034CA")]
		public Joystick.AxisOption axesToUse;

		// Token: 0x040034CB RID: 13515
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x40034CB")]
		public string horizontalAxisName = "Horizontal";

		// Token: 0x040034CC RID: 13516
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x40034CC")]
		public string verticalAxisName = "Vertical";

		// Token: 0x040034CD RID: 13517
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x40034CD")]
		private Vector3 m_StartPos;

		// Token: 0x040034CE RID: 13518
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x40034CE")]
		private bool m_UseX;

		// Token: 0x040034CF RID: 13519
		[FieldOffset(Offset = "0x3D")]
		[Token(Token = "0x40034CF")]
		private bool m_UseY;

		// Token: 0x040034D0 RID: 13520
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x40034D0")]
		private CrossPlatformInputManager.VirtualAxis m_HorizontalVirtualAxis;

		// Token: 0x040034D1 RID: 13521
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x40034D1")]
		private CrossPlatformInputManager.VirtualAxis m_VerticalVirtualAxis;

		// Token: 0x020004FA RID: 1274
		[Token(Token = "0x20004FA")]
		public enum AxisOption
		{
			// Token: 0x040034D3 RID: 13523
			[Token(Token = "0x40034D3")]
			Both,
			// Token: 0x040034D4 RID: 13524
			[Token(Token = "0x40034D4")]
			OnlyHorizontal,
			// Token: 0x040034D5 RID: 13525
			[Token(Token = "0x40034D5")]
			OnlyVertical
		}
	}
}
