Esempio n. 1
0
 /// <summary> Refresh information texts. </summary>
 private void RefreshInfoTexts()
 {
     mainInfoText.text =
         "controller count: " + NRInput.GetAvailableControllersCount().ToString() + "\n"
         + "type: " + NRInput.GetControllerType().ToString() + "\n"
         + "current debug hand: " + m_CurrentDebugHand.ToString() + "\n"
         + "position available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_POSITION).ToString() + "\n"
         + "rotation available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_ROTATION).ToString() + "\n"
         + "gyro available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_GYRO).ToString() + "\n"
         + "accel available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_ACCEL).ToString() + "\n"
         + "mag available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_MAG).ToString() + "\n"
         + "battery available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_BATTERY).ToString() + "\n"
         + "vibration available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_HAPTIC_VIBRATE).ToString() + "\n"
         + "rotation: " + NRInput.GetRotation(m_CurrentDebugHand).ToString("F3") + "\n"
         + "position: " + NRInput.GetPosition(m_CurrentDebugHand).ToString("F3") + "\n"
         + "touch: " + NRInput.GetTouch(m_CurrentDebugHand).ToString("F3") + "\n"
         + "trigger button: " + NRInput.GetButton(m_CurrentDebugHand, ControllerButton.TRIGGER).ToString() + "\n"
         + "home button: " + NRInput.GetButton(m_CurrentDebugHand, ControllerButton.HOME).ToString() + "\n"
         + "app button: " + NRInput.GetButton(m_CurrentDebugHand, ControllerButton.APP).ToString() + "\n"
         + "grip button: " + NRInput.GetButton(m_CurrentDebugHand, ControllerButton.GRIP).ToString() + "\n"
         + "touchpad button: " + NRInput.GetButton(m_CurrentDebugHand, ControllerButton.TOUCHPAD_BUTTON).ToString() + "\n"
         + "gyro: " + NRInput.GetGyro(m_CurrentDebugHand).ToString("F3") + "\n"
         + "accel: " + NRInput.GetAccel(m_CurrentDebugHand).ToString("F3") + "\n"
         + "mag: " + NRInput.GetMag(m_CurrentDebugHand).ToString("F3") + "\n"
         + "battery: " + NRInput.GetControllerBattery(m_CurrentDebugHand);
     extraInfoText.text = m_ExtraInfoStr;
     //Debug.Log("istouching:" + NRInput.IsTouching() + " value:" + NRInput.GetTouch(m_CurrentDebugHand).ToString("F3"));
     PrintInputState();
 }
 public override void TriggerHapticVibration(int index, float durationSeconds = 0.1f, float frequency = 1000f, float amplitude = 0.5f)
 {
     if (!Inited)
     {
         return;
     }
     if (NRInput.GetAvailableControllersCount() > 0 && NRInput.GetControllerType() == ControllerType.CONTROLLER_TYPE_PHONE)
     {
         OriginPhoneVibrateTool.TriggerVibrate(durationSeconds);
     }
 }
 private void JudgeDrop()
 {
     if (!IsMoveable)
     {
         return;
     }
     if (!IsBeingSelected)
     {
         return;
     }
     if (NRInput.GetButtonDown(ControllerButton.TRIGGER))
     {
         m_TriggerDownTime = Time.time;
         m_TouchDownPos    = NRInput.GetTouch();
     }
     if (NRInput.GetButton(ControllerButton.TRIGGER) && !m_TouchMoved)
     {
         m_TouchMoved = Vector2.Distance(NRInput.GetTouch(), m_TouchDownPos) > JUDGE_TOUCH_MOVED_DISTANCE;
     }
     if (NRInput.GetButtonUp(ControllerButton.TRIGGER))
     {
         if ((Time.time - m_TriggerDownTime) < SelectingRaycaster.clickInterval)
         {
             forceDeselectOnce = true;
         }
         if (NRInput.GetControllerType() == ControllerType.CONTROLLER_TYPE_PHONE && m_TouchMoved)
         {
             forceDeselectOnce = false;
         }
         m_TouchMoved = false;
     }
     else if (NRInput.GetButtonUp(ControllerButton.HOME))
     {
         forceDeselectOnce = true;
     }
     if (forceDeselectOnce)
     {
         forceDeselectOnce = false;
         Deselected();
     }
 }
Esempio n. 4
0
 private void RefreshInfoTexts()
 {
     mainInfoText.text =
         "controller count: " + NRInput.GetAvailableControllersCount().ToString() + "\n"
         + "type: " + NRInput.GetControllerType().ToString() + "\n"
         + "domain hand: " + NRInput.DomainHand.ToString() + "\n"
         + "position available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_POSITION).ToString() + "\n"
         + "rotation available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_ROTATION).ToString() + "\n"
         + "gyro available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_GYRO).ToString() + "\n"
         + "accel available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_ACCEL).ToString() + "\n"
         + "mag available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_MAG).ToString() + "\n"
         + "battery available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_BATTERY).ToString() + "\n"
         + "vibration available: " + NRInput.GetControllerAvailableFeature(ControllerAvailableFeature.CONTROLLER_AVAILABLE_FEATURE_HAPTIC_VIBRATE).ToString() + "\n"
         + "rotation: " + NRInput.GetRotation().ToString("F3") + "\n"
         + "position: " + NRInput.GetPosition().ToString("F3") + "\n"
         + "touch: " + NRInput.GetTouch().ToString("F3") + "\n"
         + "trigger, home, app: " + NRInput.GetButton(ControllerButton.TRIGGER).ToString() + NRInput.GetButton(ControllerButton.HOME).ToString() + NRInput.GetButton(ControllerButton.APP).ToString() + "\n"
         + "gyro: " + NRInput.GetGyro().ToString("F3") + "\n"
         + "accel: " + NRInput.GetAccel().ToString("F3") + "\n"
         + "mag: " + NRInput.GetMag().ToString("F3") + "\n"
         + "battery: " + NRInput.GetControllerBattery();
     extraInfoText.text = m_ExtraInfoStr;
 }