yichael 4 anni fa
parent
commit
b0dd4fe305

File diff suppressed because it is too large
+ 594 - 1
Assets/BowArrow/Scenes/Game.unity


+ 22 - 8
Assets/BowArrow/Scripts/Bluetooth/ShootCheck.cs

@@ -13,17 +13,32 @@ public class ShootCheck : MonoBehaviour
     public float shootSpeed;
     public float shootSpeed;
     public static ShootCheck ins; 
     public static ShootCheck ins; 
 
 
+    [SerializeField] InputField ipInputField = default;
+
     WebSocket webSocket;
     WebSocket webSocket;
     void Start()
     void Start()
     {
     {
         ins = this;
         ins = this;
-        BluetoothDispatcher.shoot = OnDataReceived;
-
-        //socket
-        string serverIP = "192.168.1.103";
+        BluetoothDispatcher.shoot = OnDataReceived;   
+    } 
+    //用户输入时的变化
+    public void ChangedValue(string value)
+    {
+        ipInputField.ActivateInputField();
+        Debug.Log("输入了"+value);
+    }
+    public void EndValue(string value)
+    {
+        Debug.Log("最终内容"+value);
+    }
+//socket
+    public void StartSocket() 
+    {
+//socket
+        string ipStr = ipInputField.text;//ipInputField.GetComponentInChildren<Text>();
+        string serverIP = ipStr;//"192.168.0.107";
         string address = "ws://" + serverIP + ":8088/Ble/";
         string address = "ws://" + serverIP + ":8088/Ble/";
         webSocket = new WebSocket(new Uri(address));
         webSocket = new WebSocket(new Uri(address));
-
 #if !UNITY_WEBGL
 #if !UNITY_WEBGL
             webSocket.StartPingThread = true;
             webSocket.StartPingThread = true;
 #endif
 #endif
@@ -37,9 +52,8 @@ public class ShootCheck : MonoBehaviour
             // Debug.Log("OnOpen: ");
             // Debug.Log("OnOpen: ");
             // Start connecting to the server
             // Start connecting to the server
             webSocket.Open();
             webSocket.Open();
-    } 
+    }
 
 
-//socket
     public void Destroy() 
     public void Destroy() 
     {
     {
         if (webSocket != null) 
         if (webSocket != null) 
@@ -181,7 +195,7 @@ public class ShootCheck : MonoBehaviour
 [Serializable]
 [Serializable]
 class CMD {
 class CMD {
     public string ax = "y";
     public string ax = "y";
-    public int a = 6000;
+    public int a = 1000;
     public int r = 2;
     public int r = 2;
 
 
     public float getAcc() {
     public float getAcc() {

Some files were not shown because too many files changed in this diff