using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.XR;
using UnityEngine.XR.Interaction.Toolkit;
using TMPro;

public class Textdisplay : MonoBehaviour
{
    private float xvalue;
    public GameObject Rcontroller;
    public ValueTransfer file1;
    int Test;
    private InputDevice device;

    public TextMeshProUGUI valuex;
    public TextMeshProUGUI valueangle;
    private Vector3 rhpos;
    private Vector3 rotate;
    private float angle;
    private float trigger;
    private float test2;
    private float test3;
    public XRController controller;
    
    // Start is called before the first frame update
    void Start()
    {
        List<InputDevice> devices = new List<InputDevice>();
        //InputDeviceCharacteristics RCC = InputDeviceCharacteristics.Right | InputDeviceCharacteristics.Controller;
        //InputDevices.GetDevicesWithCharacteristics(InputDeviceCharacteristics.Right | InputDeviceCharacteristics.Controller, devices);
        //UnityEngine.XR.InputDevices.GetDevicesWithCharacteristics(RCC, devices);
        //InputDevices.GetDevicesWithCharacteristics(RCC, devices);
        InputDevices.GetDevices(devices);

        foreach (var item in devices)
        {
            Debug.Log(item.name +  item.characteristics);
        }
        
        
    }

    // Update is called once per frame
    void Update()
    {
        rhpos = Rcontroller.transform.position;
        xvalue = rhpos.x;
        Test = file1.Gettest();
        controller.inputDevice.TryGetFeatureValue(CommonUsages.primaryButton, out bool button);
        if (button)
        {
            test2 = 10;
            Debug.Log("caonima");
        }
        controller.inputDevice.TryGetFeatureValue(CommonUsages.trigger, out test3);

        //rotate = Rcontroller.transform.rotation.eulerAngles;
        //angle = rotate.x;
        //valueangle.text = test3.ToString();
       // valuex.text = test3.ToString();
    }
    
    
}
