瀏覽代碼

电脑调试设备

lvjincheng 3 年之前
父節點
當前提交
d427f25e41
共有 2 個文件被更改,包括 8 次插入8 次删除
  1. 7 7
      Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs
  2. 1 1
      Assets/BowArrow/Scripts/Game/BowCamera.cs

+ 7 - 7
Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs

@@ -45,7 +45,7 @@ public class BluetoothAim : MonoBehaviour
         ins = this;
         InitAutoDormancy();
 
-#if UNITY_STANDALONE_WIN
+#if UNITY_STANDALONE_WIN || UNITY_EDITOR
         new GameObject("BleUDP").AddComponent<BleUDP>();
 #endif
     }
@@ -74,9 +74,9 @@ public class BluetoothAim : MonoBehaviour
             userDoConnect = false;
             doConnect = false;
             OnDisconnect();
-#if UNITY_ANDROID
+#if UNITY_ANDROID && !UNITY_EDITOR
             DisconnectBleHelper();
-#elif UNITY_STANDALONE_WIN
+#elif UNITY_STANDALONE_WIN || UNITY_EDITOR
             BleUDP.ins.Disconnect();
 #endif
         }
@@ -142,9 +142,9 @@ public class BluetoothAim : MonoBehaviour
         scanLock = true;
         canConnect = false;
         SetStatus(BluetoothStatusEnum.Connecting);
-#if UNITY_ANDROID
+#if UNITY_ANDROID && !UNITY_EDITOR
         ConnectBleHelper();
-#elif UNITY_STANDALONE_WIN
+#elif UNITY_STANDALONE_WIN || UNITY_EDITOR
         ConnectBleByUDP();
 #endif
     }
@@ -499,12 +499,12 @@ public class BluetoothAim : MonoBehaviour
 
     public void WriteData(string data)
     {
-#if UNITY_ANDROID
+#if UNITY_ANDROID && !UNITY_EDITOR
         if (DebugDeviceCMD.ins) DebugDeviceCMD.ins.ShowCMD(data);
         BluetoothHelperCharacteristic ch = new BluetoothHelperCharacteristic(characteristicWrite.getName());
         ch.setService(bluetoothService.getName());
         bluetoothHelper.WriteCharacteristic(ch, data);
-#elif UNITY_STANDALONE_WIN
+#elif UNITY_STANDALONE_WIN || UNITY_EDITOR
         BleUDP.ins.SendMsg(data);
 #endif
 

+ 1 - 1
Assets/BowArrow/Scripts/Game/BowCamera.cs

@@ -153,7 +153,7 @@ public class BowCamera : MonoBehaviour
     }
     void LateUpdate()
     {
-#if UNITY_STANDALONE_WIN
+#if UNITY_STANDALONE_WIN || UNITY_EDITOR
         if (BleUDP.ins && BleUDP.ins.bluetoothStatusEnum == BluetoothStatusEnum.ConnectSuccess)
         {
             needLookAtPoint = true;