コード例 #1
0
    private void Refresh()
    {
        #region Button UI
        if (scanStateText != null)
        {
            scanStateText.text = BhapticsAndroidManager.IsScanning() ? "Scanning" : "Scan Stopped";
        }

        var head = BhapticsUtils.ToPositionType(HapticDeviceType.Tactal);
        talButtons.pair.interactable   = BhapticsAndroidManager.CanPairDevice(head);
        talButtons.ping.interactable   = BhapticsAndroidManager.GetConnectedDevices(head).Count > 0;
        talButtons.unpair.interactable = BhapticsAndroidManager.GetPairedDevices(head).Count > 0;

        var suit = BhapticsUtils.ToPositionType(HapticDeviceType.TactSuit);
        suitButtons.pair.interactable   = BhapticsAndroidManager.CanPairDevice(suit);
        suitButtons.ping.interactable   = BhapticsAndroidManager.GetConnectedDevices(suit).Count > 0;
        suitButtons.unpair.interactable = BhapticsAndroidManager.GetPairedDevices(suit).Count > 0;

        var leftArm = BhapticsUtils.ToPositionType(HapticDeviceType.Tactosy_arms, true);
        armsLeftButtons.pair.interactable   = BhapticsAndroidManager.CanPairDevice(leftArm);
        armsLeftButtons.ping.interactable   = BhapticsAndroidManager.GetConnectedDevices(leftArm).Count > 0;
        armsLeftButtons.unpair.interactable = BhapticsAndroidManager.GetPairedDevices(leftArm).Count > 0;
        armsLeftButtons.toggle.interactable = BhapticsAndroidManager.GetPairedDevices(leftArm).Count > 0;

        var rightArm = BhapticsUtils.ToPositionType(HapticDeviceType.Tactosy_arms, false);
        armsRightButtons.pair.interactable   = BhapticsAndroidManager.CanPairDevice(rightArm);
        armsRightButtons.ping.interactable   = BhapticsAndroidManager.GetConnectedDevices(rightArm).Count > 0;
        armsRightButtons.unpair.interactable = BhapticsAndroidManager.GetPairedDevices(rightArm).Count > 0;
        armsRightButtons.toggle.interactable = BhapticsAndroidManager.GetPairedDevices(rightArm).Count > 0;
        #endregion
    }
コード例 #2
0
    public void ToggleTactosyArms(bool isLeft)
    {
        var connectedDevices = BhapticsAndroidManager.GetConnectedDevices(BhapticsUtils.ToPositionType(HapticDeviceType.Tactosy_arms, isLeft));

        for (int i = 0; i < connectedDevices.Count; ++i)
        {
            BhapticsAndroidManager.TogglePosition(connectedDevices[i].Address);
        }
    }
コード例 #3
0
    private void Refresh()
    {
        #region UI
        var head = BhapticsUtils.ToPositionType(HapticDeviceType.Tactal);
        talButtons.ping.interactable = BhapticsAndroidManager.GetConnectedDevices(head).Count > 0;

        var suit = BhapticsUtils.ToPositionType(HapticDeviceType.TactSuit);
        suitButtons.ping.interactable = BhapticsAndroidManager.GetConnectedDevices(suit).Count > 0;

        var leftArm = BhapticsUtils.ToPositionType(HapticDeviceType.Tactosy_arms, true);
        armsLeftButtons.ping.interactable   = BhapticsAndroidManager.GetConnectedDevices(leftArm).Count > 0;
        armsLeftButtons.toggle.interactable = BhapticsAndroidManager.GetPairedDevices(leftArm).Count > 0;

        var rightArm = BhapticsUtils.ToPositionType(HapticDeviceType.Tactosy_arms, false);
        armsRightButtons.ping.interactable   = BhapticsAndroidManager.GetConnectedDevices(rightArm).Count > 0;
        armsRightButtons.toggle.interactable = BhapticsAndroidManager.GetPairedDevices(rightArm).Count > 0;

        if (pairedDevicesCount != null)
        {
            pairedDevicesCount.text = BhapticsAndroidManager.GetDevices().Count.ToString();
        }
        #endregion
    }