Explorar o código

兼容调试模式

lvjincheng %!s(int64=4) %!d(string=hai) anos
pai
achega
8d46532a93

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

@@ -122,9 +122,12 @@ public class BluetoothAim : MonoBehaviour
                         }
                     }
                 }
-                CallDelay(1, OpenReceiveData);
-                // CallDelay(1, OpenInfrared);
-                // CallDelay(2, OpenReceiveData);
+                if (DebugForDevice.ins) {
+                    CallDelay(1, OpenInfrared);
+                    CallDelay(2, OpenReceiveData);
+                } else {
+                    CallDelay(1, OpenReceiveData);
+                }
             };
             bluetoothHelper.OnConnectionFailed += (BluetoothHelper helper) =>
             {
@@ -136,7 +139,7 @@ public class BluetoothAim : MonoBehaviour
                 hasData = true;
                 byte[] bytes = value;
                 // Log(String.Join(",", bytes));
-                // DebugForDevice.OnDataReceived(bytes);
+                if (DebugForDevice.ins) DebugForDevice.ins.OnDataReceived(bytes);
                 BluetoothClient.UploadData(0, bytes);
                 if (AimHandler.ins)
                 {

+ 1 - 5
Assets/BowArrow/Scripts/Debug/DebugForDevice.cs

@@ -13,11 +13,7 @@ public class DebugForDevice : MonoBehaviour
         ins = this;
     }
 
-    public static void OnDataReceived(byte[] bytes) {
-        if (ins) ins.onDataReceived(bytes); 
-    }
-
-    void onDataReceived(byte[] bytes) {
+    public void OnDataReceived(byte[] bytes) {
         if (bytes.Length != 27)
         {
             if (bytes.Length == 2)