Преглед на файлове

windows才会接受转发数据调度

lvjincheng преди 4 години
родител
ревизия
ad7dda2909
променени са 1 файла, в които са добавени 15 реда и са изтрити 0 реда
  1. 15 0
      Assets/DebugShoot/BluetoothDispatcher.cs

+ 15 - 0
Assets/DebugShoot/BluetoothDispatcher.cs

@@ -15,6 +15,7 @@ public class BluetoothDispatcher : MonoBehaviour
 
 
     void Dispatch(byte sign, byte[] data)
     void Dispatch(byte sign, byte[] data)
     {
     {
+        if (!IsWindows()) return;
         string logStr = sign + ", LEN " + data.Length;
         string logStr = sign + ", LEN " + data.Length;
         logStr +=  ", Bytes " + String.Join(",", data);
         logStr +=  ", Bytes " + String.Join(",", data);
         Debug.Log(logStr);
         Debug.Log(logStr);
@@ -27,4 +28,18 @@ public class BluetoothDispatcher : MonoBehaviour
             shoot(data);
             shoot(data);
         }
         }
     }
     }
+
+    int platformID = -1;
+
+    void SetPlatformID() 
+    {
+        if (Application.platform == RuntimePlatform.WindowsEditor) platformID = 1;
+        else platformID = 2;
+    }
+
+    bool IsWindows() 
+    {
+        if (platformID == -1) SetPlatformID();
+        return platformID == 1;
+    }
 }
 }