Browse Source

蓝牙权限

lvjincheng 3 years ago
parent
commit
1bfb51ec8b

+ 4 - 4
Assets/BowArrow/DebugShoot/BluetoothClient.cs

@@ -13,12 +13,12 @@ class JCData {
 
 public class BluetoothClient : MonoBehaviour
 {
-    WebSocket ws;
+    [NonSerialized] public WebSocket ws;
     bool loaded = false;
     [SerializeField] string serverIP = "110.43.54.43";
     [SerializeField] Text text;
     public static System.Action<byte, byte[]> onDataReceived;
-    static BluetoothClient ins;
+    public static BluetoothClient ins;
 
     void Start()
     {
@@ -59,7 +59,7 @@ public class BluetoothClient : MonoBehaviour
         }
     }
 
-    string PackData(string func, string[] args, int type) 
+    public static string PackData(string func, string[] args, int type) 
     {
         JCData data = new JCData();
         data.uuid = "";
@@ -74,7 +74,7 @@ public class BluetoothClient : MonoBehaviour
         if (ins && ins.loaded)
         {
             string data = String.Join(",", bytes);
-            ins.ws.Send(ins.PackData("uploadData", new string[]{sign.ToString(), data}, 1));
+            ins.ws.Send(PackData("uploadData", new string[]{sign.ToString(), data}, 1));
             ins.Log("正在上传数据\n" + data);
         }
     }

+ 8 - 8
Assets/BowArrow/Resources/Prefabs/Popups/PopupRoot.prefab

@@ -111,8 +111,8 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 1}
   m_AnchorMax: {x: 0, y: 1}
-  m_AnchoredPosition: {x: 87.70868, y: -30}
-  m_SizeDelta: {x: 75.41735, y: 60}
+  m_AnchoredPosition: {x: 111.24698, y: -25.183662}
+  m_SizeDelta: {x: 122.49396, y: 40.367325}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &7444905601117712718
 CanvasRenderer:
@@ -153,7 +153,7 @@ MonoBehaviour:
     m_AlignByGeometry: 0
     m_RichText: 1
     m_HorizontalOverflow: 0
-    m_VerticalOverflow: 0
+    m_VerticalOverflow: 1
     m_LineSpacing: 1
   m_Text: "\u63D0\u793A\u5185\u5BB9"
 --- !u!114 &7444905601117712704
@@ -169,7 +169,7 @@ MonoBehaviour:
   m_Name: 
   m_EditorClassIdentifier: 
   m_HorizontalFit: 2
-  m_VerticalFit: 0
+  m_VerticalFit: 2
 --- !u!1 &7444905601432461354
 GameObject:
   m_ObjectHideFlags: 0
@@ -309,8 +309,8 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 1}
   m_AnchorMax: {x: 0, y: 1}
-  m_AnchoredPosition: {x: 0, y: -30}
-  m_SizeDelta: {x: 175.41736, y: 60}
+  m_AnchoredPosition: {x: 0, y: -25.183662}
+  m_SizeDelta: {x: 222.49396, y: 50.367325}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &7444905602164988856
 CanvasRenderer:
@@ -409,8 +409,8 @@ MonoBehaviour:
   m_Padding:
     m_Left: 50
     m_Right: 50
-    m_Top: 0
-    m_Bottom: 0
+    m_Top: 15
+    m_Bottom: 15
   m_ChildAlignment: 4
   m_Spacing: 0
   m_ChildForceExpandWidth: 1

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

@@ -248,6 +248,11 @@ public class BluetoothAim : MonoBehaviour
             status = BluetoothStatusEnum.Connect;
             userDoConnect = false;
             PopupMgr.ins.ShowTip(TextAutoLanguage2.GetTextByKey("ble-please-open-ble"));
+            // try {
+            //     BluetoothClient.ins.ws.Send(
+            //         BluetoothClient.PackData("showError", new string[]{e.Message, e.StackTrace}, 1)
+            //     );
+            // } catch (System.Exception) {}
         }
     }
 

+ 1 - 1
Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/cn.json

@@ -87,5 +87,5 @@
     "tip_pk_invite-try-again": "对方邀请你再来一次",
     "tip_mag-calibrate-variance-equal": "地磁校准方差 = ",
     "about-us_content": "<color=#FFFFFF00>缩进</color>青凤鸾是一个技能运动智能硬件品牌。产品包含智能弓箭、智能射击、智能滑雪、智能高尔夫等。青凤鸾希望通过创新的智能硬件,让技能运动变得触手可及。并在疫情的大环境下,让人们的室内运动生活更加丰富有趣。",
-    "ble-please-open-ble": "请先打开手机蓝牙"
+    "ble-please-open-ble": "请求蓝牙失败,可能原因:\n1.未打开手机蓝牙\n2.未授予蓝牙定位权限"
 }

+ 1 - 1
Assets/BowArrow/Scripts/Components/TextAutoLanguage2/Resources/TextAutoLanguage2/en.json

@@ -87,7 +87,7 @@
     "tip_pk_invite-try-again": "Invite Again ",
     "tip_mag-calibrate-variance-equal": "Mag Calibrate Variance = ",
     "about-us_content": "Qingfengluan is a skill sports intelligent hardware brand. Products include intelligent bow and arrow, intelligent shooting, intelligent skiing, intelligent golf, etc. Qingfengluan hopes to make skill sports accessible through innovative intelligent hardware. And in the context of the epidemic, make people's indoor sports life more rich and interesting.",
-    "ble-please-open-ble": "Please Open Bluetooth",
+    "ble-please-open-ble": "Failed to request Bluetooth. Possible causes:\n1.Bluetooth is not turned on\n2.Bluetooth location permission not granted",
     "当前正处于匹配状态,无法接受好友PK邀请!": "In matching, can't accept PK!",
     "目前状态下,无法接受该邀请!": "In current state, can't accept invite!",
     "某方退出或掉线,联机游戏终止!": "One quit or outline, game stop!",

+ 1 - 1
Assets/BowArrow/Scripts/Entry.cs

@@ -21,7 +21,7 @@ public class Entry : MonoBehaviour
         // Application.targetFrameRate = 60;
         QualitySettings.vSyncCount = 1;
         SetTip("Loading", Color.white, 56);
-        versionText.text = "Version_" + appVersion + "_R3";
+        versionText.text = "Version_" + appVersion + "_R4";
         //SetTip("正在检测对比软件版本", Color.white);
         StartCoroutine(CheckAppVersion());
         StartCoroutine(AsyncLoadScene());