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

namespace Obi.CrossPlatformInput
{
	// Token: 0x02000558 RID: 1368
	[Token(Token = "0x2000558")]
	[RequireComponent(typeof(Image))]
	public class TouchPad : MonoBehaviour, IPointerDownHandler, IEventSystemHandler, IPointerUpHandler
	{
		// Token: 0x06002F67 RID: 12135 RVA: 0x00067B1C File Offset: 0x00065D1C
		[Token(Token = "0x6002F67")]
		[Address(RVA = "0xF60970", Offset = "0xF5F970", VA = "0x180F60970")]
		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: 0x06002F68 RID: 12136 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F68")]
		[Address(RVA = "0xF60C90", Offset = "0xF5FC90", VA = "0x180F60C90")]
		private void Start()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F69 RID: 12137 RVA: 0x00067BA0 File Offset: 0x00065DA0
		[Token(Token = "0x6002F69")]
		[Address(RVA = "0xF60970", Offset = "0xF5F970", VA = "0x180F60970")]
		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: 0x06002F6A RID: 12138 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F6A")]
		[Address(RVA = "0xF60D30", Offset = "0xF5FD30", VA = "0x180F60D30")]
		private void UpdateVirtualAxes(Vector3 value)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F6B RID: 12139 RVA: 0x00067C24 File Offset: 0x00065E24
		[Token(Token = "0x6002F6B")]
		[Address(RVA = "0xF60BA0", Offset = "0xF5FBA0", VA = "0x180F60BA0", 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: 0x06002F6C RID: 12140 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F6C")]
		[Address(RVA = "0xF60DB0", Offset = "0xF5FDB0", VA = "0x180F60DB0")]
		private void Update()
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F6D RID: 12141 RVA: 0x000020D3 File Offset: 0x000002D3
		[Token(Token = "0x6002F6D")]
		[Address(RVA = "0xF60C00", Offset = "0xF5FC00", VA = "0x180F60C00", Slot = "5")]
		public void OnPointerUp(PointerEventData data)
		{
			throw new AnalysisFailedException("CPP2IL failed to recover any usable IL for this method.");
		}

		// Token: 0x06002F6E RID: 12142 RVA: 0x00067C64 File Offset: 0x00065E64
		[Token(Token = "0x6002F6E")]
		[Address(RVA = "0xF60AB0", Offset = "0xF5FAB0", VA = "0x180F60AB0")]
		private void OnDisable()
		{
			if (CrossPlatformInputManager.AxisExists(this.horizontalAxisName))
			{
				CrossPlatformInputManager.UnRegisterVirtualAxis(this.horizontalAxisName);
			}
			if (CrossPlatformInputManager.AxisExists(this.verticalAxisName))
			{
				CrossPlatformInputManager.UnRegisterVirtualAxis(this.verticalAxisName);
			}
		}

		// Token: 0x06002F6F RID: 12143 RVA: 0x00067CA4 File Offset: 0x00065EA4
		[Token(Token = "0x6002F6F")]
		[Address(RVA = "0xF60FD0", Offset = "0xF5FFD0", VA = "0x180F60FD0")]
		public TouchPad()
		{
		}

		// Token: 0x040037CF RID: 14287
		[FieldOffset(Offset = "0x18")]
		[Token(Token = "0x40037CF")]
		public TouchPad.AxisOption axesToUse;

		// Token: 0x040037D0 RID: 14288
		[FieldOffset(Offset = "0x1C")]
		[Token(Token = "0x40037D0")]
		public TouchPad.ControlStyle controlStyle;

		// Token: 0x040037D1 RID: 14289
		[FieldOffset(Offset = "0x20")]
		[Token(Token = "0x40037D1")]
		public string horizontalAxisName = "Horizontal";

		// Token: 0x040037D2 RID: 14290
		[FieldOffset(Offset = "0x28")]
		[Token(Token = "0x40037D2")]
		public string verticalAxisName = "Vertical";

		// Token: 0x040037D3 RID: 14291
		[FieldOffset(Offset = "0x30")]
		[Token(Token = "0x40037D3")]
		public float Xsensitivity = 1f;

		// Token: 0x040037D4 RID: 14292
		[FieldOffset(Offset = "0x34")]
		[Token(Token = "0x40037D4")]
		public float Ysensitivity = 1f;

		// Token: 0x040037D5 RID: 14293
		[FieldOffset(Offset = "0x38")]
		[Token(Token = "0x40037D5")]
		private Vector3 m_StartPos;

		// Token: 0x040037D6 RID: 14294
		[FieldOffset(Offset = "0x44")]
		[Token(Token = "0x40037D6")]
		private Vector2 m_PreviousDelta;

		// Token: 0x040037D7 RID: 14295
		[FieldOffset(Offset = "0x4C")]
		[Token(Token = "0x40037D7")]
		private Vector3 m_JoytickOutput;

		// Token: 0x040037D8 RID: 14296
		[FieldOffset(Offset = "0x58")]
		[Token(Token = "0x40037D8")]
		private bool m_UseX;

		// Token: 0x040037D9 RID: 14297
		[FieldOffset(Offset = "0x59")]
		[Token(Token = "0x40037D9")]
		private bool m_UseY;

		// Token: 0x040037DA RID: 14298
		[FieldOffset(Offset = "0x60")]
		[Token(Token = "0x40037DA")]
		private CrossPlatformInputManager.VirtualAxis m_HorizontalVirtualAxis;

		// Token: 0x040037DB RID: 14299
		[FieldOffset(Offset = "0x68")]
		[Token(Token = "0x40037DB")]
		private CrossPlatformInputManager.VirtualAxis m_VerticalVirtualAxis;

		// Token: 0x040037DC RID: 14300
		[FieldOffset(Offset = "0x70")]
		[Token(Token = "0x40037DC")]
		private bool m_Dragging;

		// Token: 0x040037DD RID: 14301
		[FieldOffset(Offset = "0x74")]
		[Token(Token = "0x40037DD")]
		private int m_Id = (int)((ulong)4294967295L);

		// Token: 0x040037DE RID: 14302
		[FieldOffset(Offset = "0x78")]
		[Token(Token = "0x40037DE")]
		private Vector2 m_PreviousTouchPos;

		// Token: 0x040037DF RID: 14303
		[FieldOffset(Offset = "0x80")]
		[Token(Token = "0x40037DF")]
		private Vector3 m_Center;

		// Token: 0x040037E0 RID: 14304
		[FieldOffset(Offset = "0x90")]
		[Token(Token = "0x40037E0")]
		private Image m_Image;

		// Token: 0x02000559 RID: 1369
		[Token(Token = "0x2000559")]
		public enum AxisOption
		{
			// Token: 0x040037E2 RID: 14306
			[Token(Token = "0x40037E2")]
			Both,
			// Token: 0x040037E3 RID: 14307
			[Token(Token = "0x40037E3")]
			OnlyHorizontal,
			// Token: 0x040037E4 RID: 14308
			[Token(Token = "0x40037E4")]
			OnlyVertical
		}

		// Token: 0x0200055A RID: 1370
		[Token(Token = "0x200055A")]
		public enum ControlStyle
		{
			// Token: 0x040037E6 RID: 14310
			[Token(Token = "0x40037E6")]
			Absolute,
			// Token: 0x040037E7 RID: 14311
			[Token(Token = "0x40037E7")]
			Relative,
			// Token: 0x040037E8 RID: 14312
			[Token(Token = "0x40037E8")]
			Swipe
		}
	}
}
