using System;
using System.Collections;
using UnityEngine;

public class VRControllerLaserCastDummy : VRControllerLaserCast
{
	private IEnumerator Start()
	{
		while (VRTestInputModule.Instance == null)
		{
			yield return null;
		}
		VRTestInputModule.Instance.AddController(this);
		yield break;
	}

	private void Update()
	{
		if (GameMain.Instance == null)
		{
			return;
		}
		if (VRTestInputModule.Instance == null)
		{
			return;
		}
		if (VRCanvasManager.Instance == null)
		{
			return;
		}
		if (this.m_FollowGameObject == null)
		{
			this.m_FollowGameObject = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.gameObject;
			if (this.m_FollowGameObject == null)
			{
				return;
			}
		}
		Transform transform = VRCanvasManager.Instance.transform;
		Canvas vrcanvas = VRCanvasManager.Instance.GetVRCanvas(VRCanvasManager.VRCanvasType.MainMenu);
		RectTransform rectTransform = null;
		if (vrcanvas)
		{
			rectTransform = vrcanvas.GetComponent<RectTransform>();
		}
		Vector3 vector = GameMain.Instance.OvrMgr.SystemUICamera.GetOvrVirtualMouseCurrentSidePos();
		vector.x /= 1280f;
		vector.y /= 720f;
		vector.x -= 0.5f;
		vector.y -= 0.5f;
		vector.x *= rectTransform.rect.width;
		vector.y *= rectTransform.rect.height;
		vector.z = -100f;
		bool isRotDown = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsRotDown;
		bool isSideBack = GameMain.Instance.OvrMgr.OvrCamera.OvrTablet.IsSideBack;
		if (isRotDown && !isSideBack)
		{
			vector.x *= -1f;
			vector.y *= -1f;
		}
		if (!isRotDown && isSideBack)
		{
			vector.x *= -1f;
		}
		if (isRotDown && isSideBack)
		{
			vector.y *= -1f;
		}
		vector = rectTransform.localToWorldMatrix.MultiplyPoint(vector);
		base.transform.position = vector;
	}

	public override bool GetButtonDown()
	{
		bool flag = false;
		OvrMgr.OvrObject.Controller controller = GameMain.Instance.OvrMgr.ovr_obj.left_controller;
		if (controller != null)
		{
			flag = controller.controller_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_L_CLICK);
		}
		controller = GameMain.Instance.OvrMgr.ovr_obj.right_controller;
		if (controller != null)
		{
			flag |= controller.controller_buttons.GetPressDown(AVRControllerButtons.BTN.VIRTUAL_L_CLICK);
		}
		return NInput.GetMouseButtonDown(0);
	}

	public override bool GetButtonUp()
	{
		bool flag = false;
		OvrMgr.OvrObject.Controller controller = GameMain.Instance.OvrMgr.ovr_obj.left_controller;
		if (controller != null)
		{
			flag = controller.controller_buttons.GetPressUp(AVRControllerButtons.BTN.VIRTUAL_L_CLICK);
		}
		controller = GameMain.Instance.OvrMgr.ovr_obj.right_controller;
		if (controller != null)
		{
			flag |= controller.controller_buttons.GetPressUp(AVRControllerButtons.BTN.VIRTUAL_L_CLICK);
		}
		return NInput.GetMouseButtonUp(0);
	}

	public override Vector2 GetScrollDelta()
	{
		return new Vector2(0f, NInput.GetAxis("Mouse ScrollWheel"));
	}

	public override bool EnableUIRay()
	{
		return true;
	}

	public override void SetRaycastHitPoint(Vector3 WorldPos, Vector3 WorldNormal, float rayLength, GameObject HitObject)
	{
	}

	private GameObject m_FollowGameObject;
}
