Przeglądaj źródła

调试设备指令

lvjincheng 3 lat temu
rodzic
commit
1ed8f11413

Plik diff jest za duży
+ 807 - 62
Assets/BowArrow/Scenes/Home.unity


+ 1 - 0
Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs

@@ -351,6 +351,7 @@ public class BluetoothAim : MonoBehaviour
 
     public void WriteData(string data)
     {
+        if (DebugDeviceCMD.ins) DebugDeviceCMD.ins.ShowCMD(data);
         BluetoothHelperCharacteristic ch = new BluetoothHelperCharacteristic(characteristicWrite.getName());
         ch.setService(bluetoothService.getName());
         bluetoothHelper.WriteCharacteristic(ch, data);

+ 45 - 0
Assets/BowArrow/Scripts/Debug/DebugDeviceCMD.cs

@@ -0,0 +1,45 @@
+using System.Collections;
+using System.Collections.Generic;
+using UnityEngine;
+using UnityEngine.UI;
+
+public class DebugDeviceCMD : MonoBehaviour
+{
+    public static DebugDeviceCMD ins;
+    Transform textGroup;
+
+    string[] textStrList;
+    int index = 0;
+
+    void Awake() {
+        ins = this;
+        textGroup = transform.Find("TextGroup");
+        textStrList = new string[textGroup.childCount];
+        for (int i = 0; i < textStrList.Length; i++) {
+            textStrList[i] = "";
+        }
+    }
+    
+    public void ShowCMD(string cmd) {
+        string str = $"序号{index}: {cmd}";
+        index++;
+        if (index < textStrList.Length) {
+            textStrList[index] = str;
+        } else {
+            System.Array.Copy(textStrList, 1, textStrList, 0, textStrList.Length - 1);
+            textStrList[textStrList.Length - 1] = str;
+        }
+        for (int i = 0; i < textStrList.Length; i++) {
+            textGroup.GetChild(i).GetComponent<Text>().text = textStrList[i];
+        }
+    }
+
+    // float t = 0;
+    // void Update() {
+    //     t += Time.deltaTime;
+    //     if (t > 0.1f) {
+    //         t = 0;
+    //         ShowCMD("A" + index);
+    //     }
+    // }
+}

+ 11 - 0
Assets/BowArrow/Scripts/Debug/DebugDeviceCMD.cs.meta

@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 8161cdbc03418fe4082280eecc141ef6
+MonoImporter:
+  externalObjects: {}
+  serializedVersion: 2
+  defaultReferences: []
+  executionOrder: 0
+  icon: {instanceID: 0}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 0 - 1
Assets/BowArrow/Scripts/Manager/LoginMgr.cs

@@ -10,7 +10,6 @@ public class LoginMgr : MonoBehaviour
     [SerializeField] GameObject forgetPWD_View;
 
     public static UserInfo myUserInfo = new UserInfo();
-    static int userInfo_version = 1000;
 
     public void showRegisterView() {
         loginView.SetActive(false);

Niektóre pliki nie zostały wyświetlone z powodu dużej ilości zmienionych plików