Пример #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
    }