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

namespace Obi.CrossPlatformInput
{
	// Token: 0x02000551 RID: 1361
	[Token(Token = "0x2000551")]
	public class Joystick : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler, IDragHandler
	{
		// Token: 0x06002F54 RID: 12116 RVA: 0x00067888 File Offset: 0x00065A88
		[Token(Token = "0x6002F54")]
		[Address(RVA = "0x1052130", Offset = "0x1051130", VA = "0x181052130")]
		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: 0x06002F55 RID: 12117 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F55")]
		[Address(RVA = "0x1052520", Offset = "0x1051520", VA = "0x181052520")]
		private void Start()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F56 RID: 12118 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F56")]
		[Address(RVA = "0x1052560", Offset = "0x1051560", VA = "0x181052560")]
		private void UpdateVirtualAxes(Vector3 value)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F57 RID: 12119 RVA: 0x0006790C File Offset: 0x00065B0C
		[Token(Token = "0x6002F57")]
		[Address(RVA = "0x1052130", Offset = "0x1051130", VA = "0x181052130")]
		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: 0x06002F58 RID: 12120 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F58")]
		[Address(RVA = "0x10522C0", Offset = "0x10512C0", VA = "0x1810522C0", Slot = "6")]
		public void OnDrag(PointerEventData data)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F59 RID: 12121 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F59")]
		[Address(RVA = "0x1052470", Offset = "0x1051470", VA = "0x181052470", Slot = "5")]
		public void OnPointerUp(PointerEventData data)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F5A RID: 12122 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F5A")]
		[Address(RVA = "0x29E8B0", Offset = "0x29D8B0", VA = "0x18029E8B0", Slot = "4")]
		public void OnPointerDown(PointerEventData data)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F5B RID: 12123 RVA: 0x00067990 File Offset: 0x00065B90
		[Token(Token = "0x6002F5B")]
		[Address(RVA = "0x1052270", Offset = "0x1051270", VA = "0x181052270")]
		private void OnDisable()
		{
			if (this.m_UseX)
			{
				this.m_HorizontalVirtualAxis.Remove();
			}
			if (this.m_UseY)
			{
				this.m_VerticalVirtualAxis.Remove();
				return;
			}
		}

		// Token: 0x06002F5C RID: 12124 RVA: 0x000679CC File Offset: 0x00065BCC
		[Token(Token = "0x6002F5C")]
		[Address(RVA = "0x10525E0", Offset = "0x10515E0", VA = "0x1810525E0")]
		public Joystick()
		{
		}

		// Token: 0x040037B3 RID: 14259
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x40037B3")]
		public int MovementRange = (int)((ulong)100L);

		// Token: 0x040037B4 RID: 14260
		[FieldOffset(Offset = "0x1C")]
		[Token(Token = "0x40037B4")]
		public Joystick.AxisOption axesToUse;

		// Token: 0x040037B5 RID: 14261
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x40037B5")]
		public string horizontalAxisName = "Horizontal";

		// Token: 0x040037B6 RID: 14262
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x40037B6")]
		public string verticalAxisName = "Vertical";

		// Token: 0x040037B7 RID: 14263
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x40037B7")]
		private Vector3 m_StartPos;

		// Token: 0x040037B8 RID: 14264
		[FieldOffset(Offset = "0x3C")]
		[Token(Token = "0x40037B8")]
		private bool m_UseX;

		// Token: 0x040037B9 RID: 14265
		[FieldOffset(Offset = "0x3D")]
		[Token(Token = "0x40037B9")]
		private bool m_UseY;

		// Token: 0x040037BA RID: 14266
		[FieldOffset(Offset = "0x40")]
		[Token(Token = "0x40037BA")]
		private CrossPlatformInputManager.VirtualAxis m_HorizontalVirtualAxis;

		// Token: 0x040037BB RID: 14267
		[FieldOffset(Offset = "0x48")]
		[Token(Token = "0x40037BB")]
		private CrossPlatformInputManager.VirtualAxis m_VerticalVirtualAxis;

		// Token: 0x02000552 RID: 1362
		[Token(Token = "0x2000552")]
		public enum AxisOption
		{
			// Token: 0x040037BD RID: 14269
			[Token(Token = "0x40037BD")]
			Both,
			// Token: 0x040037BE RID: 14270
			[Token(Token = "0x40037BE")]
			OnlyHorizontal,
			// Token: 0x040037BF RID: 14271
			[Token(Token = "0x40037BF")]
			OnlyVertical
		}
	}
}
