Ver Fonte

宏定义调整

lvjincheng há 3 anos atrás
pai
commit
020b73144b
1 ficheiros alterados com 12 adições e 13 exclusões
  1. 12 13
      Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs

+ 12 - 13
Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs

@@ -74,11 +74,11 @@ public class BluetoothAim : MonoBehaviour
             userDoConnect = false;
             doConnect = false;
             OnDisconnect();
-#if UNITY_ANDROID && !UNITY_EDITOR
-            DisconnectBleHelper();
-#elif UNITY_STANDALONE_WIN || UNITY_EDITOR
+            #if UNITY_STANDALONE_WIN || UNITY_EDITOR
             BleUDP.ins.Disconnect();
-#endif
+            #else
+            DisconnectBleHelper();
+            #endif
         }
     }
 
@@ -142,11 +142,11 @@ public class BluetoothAim : MonoBehaviour
         scanLock = true;
         canConnect = false;
         SetStatus(BluetoothStatusEnum.Connecting);
-#if UNITY_ANDROID && !UNITY_EDITOR
-        ConnectBleHelper();
-#elif UNITY_STANDALONE_WIN || UNITY_EDITOR
+        #if UNITY_STANDALONE_WIN || UNITY_EDITOR
         ConnectBleByUDP();
-#endif
+        #else
+        ConnectBleHelper();
+        #endif
     }
 
     void ConnectBleHelper()
@@ -499,15 +499,14 @@ public class BluetoothAim : MonoBehaviour
 
     public void WriteData(string data)
     {
-#if UNITY_ANDROID && !UNITY_EDITOR
+        #if UNITY_STANDALONE_WIN || UNITY_EDITOR
+        BleUDP.ins.SendMsg(data);
+        #else
         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 || UNITY_EDITOR
-        BleUDP.ins.SendMsg(data);
-#endif
-
+        #endif
     }
 
     void Log(string text)