Просмотр исходного кода

1.修改步骤流程。调整枪协议测试

slambb 1 год назад
Родитель
Сommit
c6b39b5fec

+ 71 - 95
Assets/BowArrow/Scenes/Game.unity

@@ -673,7 +673,7 @@ Transform:
   m_Children:
   - {fileID: 1051059154}
   - {fileID: 827458966}
-  - {fileID: 1064462658}
+  - {fileID: 445667819}
   - {fileID: 944950860}
   m_Father: {fileID: 2036668599}
   m_RootOrder: 2
@@ -5168,6 +5168,68 @@ Transform:
   m_Father: {fileID: 1944023592}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 43.296913, y: 74.55899, z: 101.21528}
+--- !u!1001 &445667818
+PrefabInstance:
+  m_ObjectHideFlags: 0
+  serializedVersion: 2
+  m_Modification:
+    m_TransformParent: {fileID: 64265628}
+    m_Modifications:
+    - target: {fileID: 3202296430119542851, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_Name
+      value: EF_tuowei_bullet
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_RootOrder
+      value: 2
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalPosition.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalPosition.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalPosition.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalRotation.w
+      value: 1
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalRotation.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalRotation.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalRotation.z
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.x
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.y
+      value: 0
+      objectReference: {fileID: 0}
+    - target: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+      propertyPath: m_LocalEulerAnglesHint.z
+      value: 0
+      objectReference: {fileID: 0}
+    m_RemovedComponents: []
+  m_SourcePrefab: {fileID: 100100000, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+--- !u!4 &445667819 stripped
+Transform:
+  m_CorrespondingSourceObject: {fileID: 3202296430119542852, guid: 07ce99f323b22fd4ba140ec031ab6a35, type: 3}
+  m_PrefabInstance: {fileID: 445667818}
+  m_PrefabAsset: {fileID: 0}
 --- !u!1 &447308304
 GameObject:
   m_ObjectHideFlags: 0
@@ -6165,8 +6227,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: 29.692308, y: -16.5}
-  m_SizeDelta: {x: 39.384617, y: 33}
+  m_AnchoredPosition: {x: 29.478958, y: -16.5}
+  m_SizeDelta: {x: 38.957916, y: 33}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &589339043
 MonoBehaviour:
@@ -7715,8 +7777,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: 29.692308, y: -16.5}
-  m_SizeDelta: {x: 39.384617, y: 33}
+  m_AnchoredPosition: {x: 29.478958, y: -16.5}
+  m_SizeDelta: {x: 38.957916, y: 33}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &694545845
 MonoBehaviour:
@@ -11795,92 +11857,6 @@ Camera:
   m_OcclusionCulling: 1
   m_StereoConvergence: 10
   m_StereoSeparation: 0.022
---- !u!1001 &1064462657
-PrefabInstance:
-  m_ObjectHideFlags: 0
-  serializedVersion: 2
-  m_Modification:
-    m_TransformParent: {fileID: 64265628}
-    m_Modifications:
-    - target: {fileID: 3202296430119542851, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_Name
-      value: EF_tuowei
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542851, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_IsActive
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_RootOrder
-      value: 2
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalScale.x
-      value: 0.91593564
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalScale.y
-      value: 0.9159351
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalScale.z
-      value: 0.91593623
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalPosition.x
-      value: -0.009168118
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalPosition.y
-      value: -0.0082437545
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalPosition.z
-      value: 0.0017882871
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalRotation.w
-      value: 0.70877934
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalRotation.x
-      value: -0.0000023501925
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalRotation.y
-      value: 0.70543027
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalRotation.z
-      value: -0.0000022396716
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.x
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.y
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_LocalEulerAnglesHint.z
-      value: 0
-      objectReference: {fileID: 0}
-    - target: {fileID: 4997297452455936188, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_Time
-      value: 0.1
-      objectReference: {fileID: 0}
-    - target: {fileID: 4997297452455936190, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-      propertyPath: m_IsActive
-      value: 1
-      objectReference: {fileID: 0}
-    m_RemovedComponents: []
-  m_SourcePrefab: {fileID: 100100000, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
---- !u!4 &1064462658 stripped
-Transform:
-  m_CorrespondingSourceObject: {fileID: 3202296430119542852, guid: f4eac784f6b9a464dbbbd2bb0ed3d3fe, type: 3}
-  m_PrefabInstance: {fileID: 1064462657}
-  m_PrefabAsset: {fileID: 0}
 --- !u!1 &1074254334
 GameObject:
   m_ObjectHideFlags: 0
@@ -13373,8 +13349,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: 29.692308, y: -16.5}
-  m_SizeDelta: {x: 39.384617, y: 33}
+  m_AnchoredPosition: {x: 29.478958, y: -16.5}
+  m_SizeDelta: {x: 38.957916, y: 33}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1218454288
 MonoBehaviour:
@@ -21179,8 +21155,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: 79.38461, y: -20}
-  m_SizeDelta: {x: 78.76923, y: 40}
+  m_AnchoredPosition: {x: 78.95792, y: -20}
+  m_SizeDelta: {x: 77.91583, y: 40}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &1845023679
 MonoBehaviour:

+ 64 - 33
Assets/BowArrow/Scripts/Bluetooth/AimHandler.cs

@@ -274,26 +274,30 @@ public class AimDeviceInfos
     {
         if (bytes.Length != 27 && bytes.Length != 39)
         {
-            if (bytes.Length == 2) {
-                if (bytes[0] == 0x66 && bytes[1] == 0x31) {
+            if (bytes.Length == 2)
+            {
+                if (bytes[0] == 0x66 && bytes[1] == 0x31)
+                {
                     if (bInitOne)
                     {
                         bInitOne = false;
 
-                        if (aimDeviceInfo.type == (int)AimDeviceType.NONE   ||
-                            aimDeviceInfo.type == (int)AimDeviceType.HOUYI  || 
+                        if (aimDeviceInfo.type == (int)AimDeviceType.NONE ||
+                            aimDeviceInfo.type == (int)AimDeviceType.HOUYI ||
                             aimDeviceInfo.type == (int)AimDeviceType.HOUYI2 ||
                             aimDeviceInfo.type == (int)AimDeviceType.ARTEMIS)
                         {
                             AutoResetView.DoIdentity();
                         }
-                        else {
+                        else
+                        {
                             //准心开关
                             CrossBtnEvent();
                         }
 
                     }
-                    else {
+                    else
+                    {
 
                         if (SB_EventSystem.ins && SB_EventSystem.ins.simulateMouseIsAwaked)
                         {
@@ -303,8 +307,8 @@ public class AimDeviceInfos
                         }
                         else
                         {
-                            if (aimDeviceInfo.type == (int)AimDeviceType.NONE   || 
-                                aimDeviceInfo.type == (int)AimDeviceType.HOUYI  || 
+                            if (aimDeviceInfo.type == (int)AimDeviceType.NONE ||
+                                aimDeviceInfo.type == (int)AimDeviceType.HOUYI ||
                                 aimDeviceInfo.type == (int)AimDeviceType.HOUYI2 ||
                                 aimDeviceInfo.type == (int)AimDeviceType.ARTEMIS)
                             {
@@ -318,25 +322,64 @@ public class AimDeviceInfos
                         }
 
                     }
-                } else if (bytes[0] == 0x66 && bytes[1] == 0x32) {
-                    if (SB_EventSystem.ins) {
-                    // if (SB_EventSystem.ins && !CommonConfig.SpecialVersion1) {
+                }
+                else if (bytes[0] == 0x66 && bytes[1] == 0x32)
+                {
+                    if (SB_EventSystem.ins)
+                    {
+                        // if (SB_EventSystem.ins && !CommonConfig.SpecialVersion1) {
                         //唤起/隐藏虚拟鼠标
-                        SB_EventSystem.ins.AwakenSimulateMouse(); 
+                        SB_EventSystem.ins.AwakenSimulateMouse();
                     }
-                } else if (bytes[1] == 10) {
+                }
+                else if (bytes[1] == 10)
+                {
                     //显示电量
                     DeviceBatteryView.ins.RenderBattery(1, bytes[0]);
                     //DeviceView.ins.RenderBattery(1, bytes[0]);
                 }
-            } else if (bytes[0] == 0x5b) {
+            }
+            else if (bytes[0] == 0x5b)
+            {
                 //红外射击检测
-                ShootCheck.ins.ShootByInfrared(bytes); 
-            } else if (bytes[0] == 0x5C)
+                ShootCheck.ins.ShootByInfrared(bytes);
+            }
+            else if (bytes[0] == 0x5C)
             {
                 //00 弹夹分离,01 上弹夹
                 ShootCheck.ins.UpdateTheMagazine(bytes);
-            
+
+            }
+            else if (bytes[0] == 0x5E)
+            {
+                Debug.Log("接收到系统数据:" + BitConverter.ToString(bytes));
+                //设备类型
+                switch (bytes[1])
+                {
+                    case 0x01:
+                        Debug.Log("设备类型:HOUYI Pro");
+                        break;
+                    case 0x02:
+                        Debug.Log("设备类型:ARTEMIS Pro");
+                        break;
+                    case 0x03:
+                        Debug.Log("设备类型:Pistol 1");
+                        break;
+                }
+
+                // 系统类型
+                switch (bytes[2])
+                {
+                    case 0x01:
+                        Debug.Log("系统类型:移动手机");
+                        break;
+                    case 0x02:
+                        Debug.Log("系统类型:PC电脑");
+                        break;
+                    case 0x03:
+                        Debug.Log("系统类型:VR设备");
+                        break;
+                }
             }
             return;
         }
@@ -424,37 +467,25 @@ public class AimDeviceInfos
     /// </summary>
     private void CrossBtnEvent()
     {
+        Debug.Log("CrossBtnEvent");
         //准心开关
         if (GameAssistUI.ins)
         {
-
             //显示控制准心按钮
             Button crossHairBtn = GameAssistUI.ins.transform.Find("Button5").GetComponent<Button>();
-            // 检查是否有注册的监听器
-            if (crossHairBtn.onClick.GetPersistentEventCount() > 0)
-            {
-                crossHairBtn.onClick.Invoke();
-            }
+            crossHairBtn.onClick.Invoke();
         }
         else if (DuckHunter.GameUI.Instance)
         {
             //显示控制准心按钮
             Button crossHairBtn = DuckHunter.GameUI.Instance.transform.Find("BtnCrosshair").GetComponent<Button>();
-            // 检查是否有注册的监听器
-            if (crossHairBtn.onClick.GetPersistentEventCount() > 0)
-            {
-                crossHairBtn.onClick.Invoke();
-            }
+            crossHairBtn.onClick.Invoke();
         }
         else
         {
             //水果
             Button crossHairBtn = GameObject.Find("PermanentCanvas/CrossHair_Btn").GetComponent<Button>();
-            // 检查是否有注册的监听器
-            if (crossHairBtn.onClick.GetPersistentEventCount() > 0)
-            {
-                crossHairBtn.onClick.Invoke();
-            }
+            crossHairBtn.onClick.Invoke();
         }
     }
 }

+ 43 - 26
Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs

@@ -12,8 +12,9 @@ using System.Collections;
 public class BluetoothAim : MonoBehaviour
 {
     #region 弓箭蓝牙模块基本信息
-    readonly string targetDeviceName = "Bbow_20210501 | Pistol | Pistol M9"; //HOUYI Pro
+    readonly string targetDeviceName = "Bbow_20210501";//HOUYI Pro
     readonly string targetDeviceNameHOUYIPro = "HOUYI Pro";
+    readonly string targetDeviceNameGun = "Pistol | Pistol M9";
     string targetDeviceService
     {
         get
@@ -81,6 +82,8 @@ public class BluetoothAim : MonoBehaviour
     public long hasDataTime;
     public static bool scanLock = false; //防止同时扫描冲突
     public static BluetoothAim ins;
+    //根据设备情况来看是否需要解密,目前就是枪需要进行解密操作
+    public bool NeedDecryption = false;
 
     public BluetoothWindows firstBluetoothWindows { get; set; }
     void Start()
@@ -317,7 +320,7 @@ public class BluetoothAim : MonoBehaviour
                 // CallDelay(2, OpenReceiveData);
                 // CallDelay(3, RequestBattery);
 
-                if (CommonConfig.EnableDecryption)
+                if (CommonConfig.EnableDecryption && NeedDecryption)
                 {
                     // 这里验证指令,开始请求授权
                     // 启动轮询协程
@@ -364,34 +367,39 @@ public class BluetoothAim : MonoBehaviour
                 {
                     Log("发现设备 " + device.DeviceName);
                     //if (device.DeviceName == targetDeviceName)
-                    //需要判断是否是红外弓箭
-                    if (AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.HOUYIPRO) {
-
-
+                    if (AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.HOUYIPRO)
+                    {   //需要判断是否是红外弓箭
                         //targetDeviceNameHOUYIPro targetDeviceNameHOUYIPro{ HOUYI Pro }
                         if (targetDeviceNameHOUYIPro.Contains(device.DeviceName))
                         {
-                            deviceName = device.DeviceName;
-                            bluetoothHelper.setDeviceName(deviceName);
-                            bluetoothHelper.Connect();
+                            BLEConnectByName(device.DeviceName);
                             Log("匹配HOUYIPRO设备 " + device.DeviceName);
                             return;
                         }
 
                     }
-                    else
+                    else if (AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.Gun)
                     {
-                        //不允许匹配HOUYIPRO,因为这个没有九轴 targetDeviceName { Bbow_20210501 | Pistol }
+                        //需要判断是否是枪
+                        if (targetDeviceNameGun.Contains(device.DeviceName))
+                        {
+                            BLEConnectByName(device.DeviceName);
+                            Log("匹配枪设备 " + device.DeviceName);
+                            return;
+                        }
+
+                    }
+                    else
+                    {   //其余的九轴连接
+                        //不允许匹配HOUYIPRO,因为这个没有九轴 targetDeviceName { Bbow_20210501 }
                         if (targetDeviceName.Contains(device.DeviceName))
                         {
-                            deviceName = device.DeviceName;
-                            bluetoothHelper.setDeviceName(deviceName);
-                            bluetoothHelper.Connect();
+                            BLEConnectByName(device.DeviceName);
                             Log("匹配普通设备设备 " + device.DeviceName);
                             return;
                         }
                     }
-                
+
                 }
                 if (_scanCanRetryCount > 0) {
                     _scanCanRetryCount--;
@@ -415,6 +423,12 @@ public class BluetoothAim : MonoBehaviour
             HandleConnectException(TextAutoLanguage2.GetTextByKey("ble-please-open-ble"));
         }
     }
+    void BLEConnectByName(string name) {
+        deviceName = name;
+        bluetoothHelper.setDeviceName(deviceName);
+        bluetoothHelper.Connect();
+    }
+
     void HandleConnectException(string errorText)
     {
         scanLock = false;
@@ -584,6 +598,7 @@ public class BluetoothAim : MonoBehaviour
         canAutoDormancy = true;
         List<string> cmds = new List<string>();
         cmds.Add("M"); //获取Mac地址
+        cmds.Add("I"); //获取设备信息
         cmds.Add("b"); //确保开启stm32
         cmds.Add("b"); //获取初始电量
         cmds.Add("1"); //开启发送逻辑
@@ -1242,22 +1257,24 @@ public class BluetoothAim : MonoBehaviour
     }
 
 
-    #region 用户1 window ble 连接
+    #region 用户1 window ble 连接和部分共用代码
     void OnConnected_windows1()
     {
         Log("[WinBle_1P]连接成功\n" + deviceName);
         SetStatus(BluetoothStatusEnum.ConnectSuccess);
         BowCamera.isTouchMode = false;
 
-#if UNITY_STANDALONE_WIN || UNITY_EDITOR
-        // 这里验证指令,开始请求授权
-        // 启动轮询协程
-        StartCoroutine(PollingCoroutine());
-#else
-        //除了pc,Android 直接连接
-        InitWhenConenct();
-#endif
-
+        if (CommonConfig.EnableDecryption && NeedDecryption)
+        {
+            // 这里验证指令,开始请求授权
+            // 启动轮询协程
+            StartCoroutine(PollingCoroutine());
+        }
+        else
+        {
+            //除了pc,Android 直接连接
+            InitWhenConenct();
+        }
     }
     void OnConnectionFailed_windows1()
     {
@@ -1276,7 +1293,7 @@ public class BluetoothAim : MonoBehaviour
             hasData = true;
             hasDataTime = JCUnityLib.TimeUtils.GetTimestamp();
         }
-        if (CommonConfig.EnableDecryption)
+        if (CommonConfig.EnableDecryption && NeedDecryption)
         {
             //Pc 版本先走校验流程
             if (!BluetoothDecryptor.AUTHOR_IsDecrypt())

+ 20 - 2
Assets/BowArrow/Scripts/Game/Arrow.cs

@@ -529,7 +529,25 @@ public class Arrow : MonoBehaviour
 
     void activeEffectTrail(bool value)
     {
-        this.transform.Find("EF_tuowei").gameObject.SetActive(value);
-        this.transform.Find("EF_tuowei/Trail").GetComponent<TrailRenderer>().time = 1.6f / mySpeed;
+        if (GlobalData.MyDeviceMode == DeviceMode.Archery)
+        {
+            this.transform.Find("EF_tuowei").gameObject.SetActive(value);
+            this.transform.Find("EF_tuowei/Trail").GetComponent<TrailRenderer>().time = 1.6f / mySpeed;
+        }
+        else {
+            StartCoroutine(showTrail(value));
+            
+        }
+
+     
+    }
+
+    IEnumerator showTrail(bool value) {
+
+        this.transform.Find("EF_tuowei_bullet").gameObject.SetActive(value);
+        this.transform.Find("EF_tuowei_bullet/Trail").GetComponent<TrailRenderer>().time = 0;
+        yield return new WaitForSeconds(0.05f);
+        this.transform.Find("EF_tuowei_bullet/Trail").GetComponent<TrailRenderer>().time = 0.02f;
+        //this.transform.Find("EF_tuowei_bullet/Trail").GetComponent<TrailRenderer>().time = 1.6f / mySpeed;
     }
 }

+ 1 - 1
Assets/BowArrow/Scripts/View/Home/DeviceView_ItemShow.cs

@@ -419,7 +419,7 @@ public class DeviceView_ItemShow : MonoBehaviour
                 break;
             default:
                 bShow = false;
-                //Debug.LogWarning("AimDeviceType:" + ((AimDeviceType)aimDeviceInfo.type).ToString());
+                // Debug.LogWarning("onShowDeviceInfo 没有对应设备 AimDeviceType:" + ((AimDeviceType)aimDeviceInfo.type).ToString());
                 break;
         }
         //如果不是process状态下,可刷新对应按钮显示。process 说明在搜索

+ 3 - 0
Assets/BowArrow/Scripts/View/Home/SmartArcheryView.cs

@@ -81,6 +81,9 @@ public class SmartArcheryView  : JCUnityLib.ViewBase
         {
             //进入选中的页面
             AudioMgr.ins.PlayBtn();
+
+            //弓箭的目前都不需要解密
+            BluetoothAim.ins.NeedDecryption = false;
             if (index == 3) {
                 //进入蓝牙连接页面
                 GameObject connectGuidanceView = ViewManager2.getGameObjectAndShowView(ViewManager2.Path_ConnectGuidanceView);

+ 3 - 0
Assets/BowArrow/Scripts/View/Home/SmartGunView.cs

@@ -69,6 +69,9 @@ public class SmartGunView  : JCUnityLib.ViewBase
                 //进入蓝牙连接页面
                 GameObject connectGuidanceView = ViewManager2.getGameObjectAndShowView(ViewManager2.Path_ConnectGuidanceView);
                 connectGuidanceView.GetComponent<ConnectGuidanceView>().showTextipInfrared();
+
+                //这个需要解密
+                BluetoothAim.ins.NeedDecryption = true;
                 //进入红外引导界面
                 //ViewManager2.ShowView(ViewManager2.Path_InfraredView);
             }

+ 174 - 0
Assets/FineArts/ArrowEffect/EF_tuowei_bullet.prefab

@@ -0,0 +1,174 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!1 &3202296430119542851
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 3202296430119542852}
+  m_Layer: 0
+  m_Name: EF_tuowei_bullet
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &3202296430119542852
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 3202296430119542851}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: 0, y: 0, z: -0.326}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children:
+  - {fileID: 4997297452455936191}
+  m_Father: {fileID: 0}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!1 &4997297452455936190
+GameObject:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  serializedVersion: 6
+  m_Component:
+  - component: {fileID: 4997297452455936191}
+  - component: {fileID: 4997297452455936188}
+  m_Layer: 0
+  m_Name: Trail
+  m_TagString: Untagged
+  m_Icon: {fileID: 0}
+  m_NavMeshLayer: 0
+  m_StaticEditorFlags: 0
+  m_IsActive: 1
+--- !u!4 &4997297452455936191
+Transform:
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 4997297452455936190}
+  m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
+  m_LocalPosition: {x: -0, y: -0, z: -0.439}
+  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_ConstrainProportionsScale: 0
+  m_Children: []
+  m_Father: {fileID: 3202296430119542852}
+  m_RootOrder: 0
+  m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
+--- !u!96 &4997297452455936188
+TrailRenderer:
+  serializedVersion: 2
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_GameObject: {fileID: 4997297452455936190}
+  m_Enabled: 1
+  m_CastShadows: 1
+  m_ReceiveShadows: 1
+  m_DynamicOccludee: 1
+  m_StaticShadowCaster: 0
+  m_MotionVectors: 0
+  m_LightProbeUsage: 0
+  m_ReflectionProbeUsage: 0
+  m_RayTracingMode: 0
+  m_RayTraceProcedural: 0
+  m_RenderingLayerMask: 1
+  m_RendererPriority: 0
+  m_Materials:
+  - {fileID: 2100000, guid: d9dd1e988f9ff6044b0cb2009f0e015a, type: 2}
+  m_StaticBatchInfo:
+    firstSubMesh: 0
+    subMeshCount: 0
+  m_StaticBatchRoot: {fileID: 0}
+  m_ProbeAnchor: {fileID: 0}
+  m_LightProbeVolumeOverride: {fileID: 0}
+  m_ScaleInLightmap: 1
+  m_ReceiveGI: 1
+  m_PreserveUVs: 0
+  m_IgnoreNormalsForChartDetection: 0
+  m_ImportantGI: 0
+  m_StitchLightmapSeams: 1
+  m_SelectedEditorRenderState: 3
+  m_MinimumChartSize: 4
+  m_AutoUVMaxDistance: 0.5
+  m_AutoUVMaxAngle: 89
+  m_LightmapParameters: {fileID: 0}
+  m_SortingLayerID: 0
+  m_SortingLayer: 0
+  m_SortingOrder: 0
+  m_Time: 0.01
+  m_Parameters:
+    serializedVersion: 3
+    widthMultiplier: 1
+    widthCurve:
+      serializedVersion: 2
+      m_Curve:
+      - serializedVersion: 3
+        time: 0
+        value: 0.10000101
+        inSlope: 0
+        outSlope: 0
+        tangentMode: 0
+        weightedMode: 0
+        inWeight: 0.33333334
+        outWeight: 0.33333334
+      - serializedVersion: 3
+        time: 1
+        value: 0.10000229
+        inSlope: 0
+        outSlope: 0
+        tangentMode: 0
+        weightedMode: 0
+        inWeight: 0
+        outWeight: 0
+      m_PreInfinity: 2
+      m_PostInfinity: 2
+      m_RotationOrder: 4
+    colorGradient:
+      serializedVersion: 2
+      key0: {r: 0.990566, g: 0.8506555, b: 0, a: 0.9137255}
+      key1: {r: 1, g: 0.79690015, b: 0.27843142, a: 1}
+      key2: {r: 1, g: 1, b: 1, a: 0}
+      key3: {r: 0, g: 0, b: 0, a: 0}
+      key4: {r: 0, g: 0, b: 0, a: 0}
+      key5: {r: 0, g: 0, b: 0, a: 0}
+      key6: {r: 0, g: 0, b: 0, a: 0}
+      key7: {r: 0, g: 0, b: 0, a: 0}
+      ctime0: 0
+      ctime1: 29684
+      ctime2: 65535
+      ctime3: 0
+      ctime4: 0
+      ctime5: 0
+      ctime6: 0
+      ctime7: 0
+      atime0: 0
+      atime1: 29876
+      atime2: 65535
+      atime3: 0
+      atime4: 0
+      atime5: 0
+      atime6: 0
+      atime7: 0
+      m_Mode: 0
+      m_NumColorKeys: 3
+      m_NumAlphaKeys: 3
+    numCornerVertices: 0
+    numCapVertices: 0
+    alignment: 0
+    textureMode: 1
+    shadowBias: 0.1
+    generateLightingData: 0
+  m_MinVertexDistance: 0
+  m_Autodestruct: 0
+  m_Emitting: 1

+ 7 - 0
Assets/FineArts/ArrowEffect/EF_tuowei_bullet.prefab.meta

@@ -0,0 +1,7 @@
+fileFormatVersion: 2
+guid: 07ce99f323b22fd4ba140ec031ab6a35
+PrefabImporter:
+  externalObjects: {}
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 68 - 0
Assets/FineArts/ArrowEffect/Materials/path_00267_bullet.mat

@@ -0,0 +1,68 @@
+%YAML 1.1
+%TAG !u! tag:unity3d.com,2011:
+--- !u!21 &2100000
+Material:
+  serializedVersion: 8
+  m_ObjectHideFlags: 0
+  m_CorrespondingSourceObject: {fileID: 0}
+  m_PrefabInstance: {fileID: 0}
+  m_PrefabAsset: {fileID: 0}
+  m_Name: path_00267_bullet
+  m_Shader: {fileID: 211, guid: 0000000000000000f000000000000000, type: 0}
+  m_ValidKeywords:
+  - _ALPHABLEND_ON
+  m_InvalidKeywords: []
+  m_LightmapFlags: 0
+  m_EnableInstancingVariants: 0
+  m_DoubleSidedGI: 0
+  m_CustomRenderQueue: 3000
+  stringTagMap:
+    RenderType: Transparent
+  disabledShaderPasses:
+  - GRABPASS
+  m_SavedProperties:
+    serializedVersion: 3
+    m_TexEnvs:
+    - _BumpMap:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _EmissionMap:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    - _MainTex:
+        m_Texture: {fileID: 0}
+        m_Scale: {x: 1, y: 1}
+        m_Offset: {x: 0, y: 0}
+    m_Ints: []
+    m_Floats:
+    - _BlendOp: 0
+    - _BumpScale: 1
+    - _CameraFadingEnabled: 0
+    - _CameraFarFadeDistance: 2
+    - _CameraNearFadeDistance: 1
+    - _ColorMode: 0
+    - _Cull: 2
+    - _Cutoff: 0.5
+    - _DistortionBlend: 0.5
+    - _DistortionEnabled: 0
+    - _DistortionStrength: 1
+    - _DistortionStrengthScaled: 0
+    - _DstBlend: 1
+    - _EmissionEnabled: 0
+    - _FlipbookMode: 0
+    - _LightingEnabled: 0
+    - _Mode: 4
+    - _SoftParticlesEnabled: 0
+    - _SoftParticlesFarFadeDistance: 1
+    - _SoftParticlesNearFadeDistance: 0
+    - _SrcBlend: 5
+    - _ZWrite: 0
+    m_Colors:
+    - _CameraFadeParams: {r: 0, g: Infinity, b: 0, a: 0}
+    - _Color: {r: 1, g: 1, b: 1, a: 1}
+    - _ColorAddSubDiff: {r: 0, g: 0, b: 0, a: 0}
+    - _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
+    - _SoftParticleFadeParams: {r: 0, g: 0, b: 0, a: 0}
+  m_BuildTextureStacks: []

+ 8 - 0
Assets/FineArts/ArrowEffect/Materials/path_00267_bullet.mat.meta

@@ -0,0 +1,8 @@
+fileFormatVersion: 2
+guid: d9dd1e988f9ff6044b0cb2009f0e015a
+NativeFormatImporter:
+  externalObjects: {}
+  mainObjectFileID: 2100000
+  userData: 
+  assetBundleName: 
+  assetBundleVariant: 

+ 19 - 19
Assets/SmartBow/Resources/SmartBow/Prefabs/Views/Home/InfraredView.prefab

@@ -211,9 +211,9 @@ RectTransform:
   m_Father: {fileID: 6541729197459587817}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 834.03, y: -320}
   m_SizeDelta: {x: 1668.06, y: 640}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &462368352428713268
@@ -365,10 +365,10 @@ RectTransform:
   m_Father: {fileID: 1730599641784995024}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 0}
-  m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 0, y: 0}
-  m_SizeDelta: {x: 0, y: 50}
+  m_AnchorMin: {x: 0, y: 1}
+  m_AnchorMax: {x: 0, y: 1}
+  m_AnchoredPosition: {x: 221, y: -48}
+  m_SizeDelta: {x: 274.3, y: 50}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &2166458721827678163
 CanvasRenderer:
@@ -1384,7 +1384,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 0
+  m_IsActive: 1
 --- !u!224 &5651314243503148123
 RectTransform:
   m_ObjectHideFlags: 0
@@ -1405,7 +1405,7 @@ RectTransform:
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 1, y: 1}
   m_AnchoredPosition: {x: 0, y: 0}
-  m_SizeDelta: {x: -1195, y: -424}
+  m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5651314243503148127
 CanvasRenderer:
@@ -1519,9 +1519,9 @@ RectTransform:
   m_Father: {fileID: 5651314243503148123}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 1}
-  m_AnchorMax: {x: 0, y: 1}
-  m_AnchoredPosition: {x: 668.5, y: -320}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
   m_SizeDelta: {x: 1337, y: 640}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5651314243550147655
@@ -1692,10 +1692,10 @@ RectTransform:
   m_Father: {fileID: 5651314244108234268}
   m_RootOrder: 0
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
-  m_AnchorMin: {x: 0, y: 1}
-  m_AnchorMax: {x: 0, y: 1}
-  m_AnchoredPosition: {x: 221, y: -48}
-  m_SizeDelta: {x: 140, y: 50}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
+  m_SizeDelta: {x: 0, y: 50}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5651314243985302727
 CanvasRenderer:
@@ -1794,7 +1794,7 @@ RectTransform:
   m_AnchorMin: {x: 0, y: 1}
   m_AnchorMax: {x: 0, y: 1}
   m_AnchoredPosition: {x: 668.5, y: -698}
-  m_SizeDelta: {x: 444, y: 96}
+  m_SizeDelta: {x: 0, y: 96}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5651314244108234247
 CanvasRenderer:
@@ -1947,7 +1947,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!224 &6541729197459587817
 RectTransform:
   m_ObjectHideFlags: 0
@@ -1968,7 +1968,7 @@ RectTransform:
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 1, y: 1}
   m_AnchoredPosition: {x: 0, y: -15}
-  m_SizeDelta: {x: 0, y: 0}
+  m_SizeDelta: {x: -863.93994, y: -570.1124}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &2474763126871341944
 MonoBehaviour:

+ 9 - 3
Assets/SmartBow/Scripts/Views/ConnectGuidanceView.cs

@@ -83,6 +83,7 @@ public class ConnectGuidanceView : MonoBehaviour
                 }
                 else
                 {
+
                     //修改步骤
                     ViewManager2.ShowView(ViewManager2.Path_InfraredView);
 
@@ -158,9 +159,11 @@ public class ConnectGuidanceView : MonoBehaviour
                 btnConnectBow.GetComponentInChildren<Text>().color = color;
                 btnConnectBow.transform.Find("Check").gameObject.SetActive(bowStatus == BluetoothStatusEnum.ConnectSuccess);
             }
-
+            if (bowStatus != BluetoothStatusEnum.ConnectSuccess) {
+                isNext = false;
+            }
             //自动跳转
-            if (!isNext && bowStatus == BluetoothStatusEnum.ConnectSuccess)
+            else if (!isNext && bowStatus == BluetoothStatusEnum.ConnectSuccess)
             {
                 isNext = true;
                 OnClick_Next();
@@ -179,7 +182,10 @@ public class ConnectGuidanceView : MonoBehaviour
                 btnConnectBow.GetComponentInChildren<Text>().color = color;
                 btnConnectBow.transform.Find("Check").gameObject.SetActive(bowStatus2P == SmartBowSDK.BluetoothStatusEnum.Connected);
             }
-
+            if (bowStatus2P != SmartBowSDK.BluetoothStatusEnum.Connected)
+            {
+                isNext = false;
+            }
             //自动跳转
             if (!isNext && bowStatus2P == SmartBowSDK.BluetoothStatusEnum.Connected)
             {

+ 1 - 0
Assets/SmartBow/Scripts/Views/InfraredViewParts/InfraredScreenPositioningView.cs

@@ -485,6 +485,7 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
             Texture2D texture2D = InfraredDemo.infraredCameraHelper.EnterScreenLocateManual();
             if (texture2D == null)
             {
+                Debug.Log("EnterScreenLocateManual = null");
                 InfraredDemo.infraredCameraHelper.QuitScreenLocateManual(null);
                 return false;
             }

+ 33 - 4
Assets/SmartBow/SmartBowSDK/BleWinHelper.cs

@@ -27,7 +27,9 @@ namespace SmartBowSDK
             Debug.Log(LogTag + text);
         }
 
-        private string targetDeviceName = "Bbow_20210501 | HOUYI Pro | Pistol | Pistol M9";
+        private string targetDeviceName = "Bbow_20210501";
+        private string targetDeviceNameHOUYIPro = "HOUYI Pro";
+        private string targetDeviceNameGun = "Pistol | Pistol M9";
         private string targetService = "{0000fff0-0000-1000-8000-00805f9b34fb}";
         private string targetCharacteristicsNotify = "{0000fff1-0000-1000-8000-00805f9b34fb}";
         private string targetCharacteristicsWrite = "{0000fff2-0000-1000-8000-00805f9b34fb}";
@@ -143,10 +145,37 @@ namespace SmartBowSDK
                             deviceList[res.id]["isConnectable"] = res.isConnectable.ToString();
 
                         //deviceList[res.id]["name"] == targetDeviceName
-                        if (targetDeviceName.Contains(deviceList[res.id]["name"]) && deviceList[res.id]["isConnectable"] == "True")
+                        //if (targetDeviceName.Contains(deviceList[res.id]["name"]) && deviceList[res.id]["isConnectable"] == "True")
+                        //{
+                        //    selectedDeviceId = res.id;
+                        //    StopDeviceScan();
+                        //}
+
+                        if (AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.HOUYIPRO)
+                        {   //需要判断是否是红外弓箭
+                            if (targetDeviceNameHOUYIPro.Contains(deviceList[res.id]["name"]) && deviceList[res.id]["isConnectable"] == "True")
+                            {
+                                selectedDeviceId = res.id;
+                                StopDeviceScan();
+                            }
+
+                        }
+                        else if (AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.Gun) 
                         {
-                            selectedDeviceId = res.id;
-                            StopDeviceScan();
+                            //需要判断是否是枪
+                            if (targetDeviceNameGun.Contains(deviceList[res.id]["name"]) && deviceList[res.id]["isConnectable"] == "True")
+                            {
+                                selectedDeviceId = res.id;
+                                StopDeviceScan();
+                            }
+                        }
+                        else
+                        {   //其余的九轴连接
+                            if (targetDeviceName.Contains(deviceList[res.id]["name"]) && deviceList[res.id]["isConnectable"] == "True")
+                            {
+                                selectedDeviceId = res.id;
+                                StopDeviceScan();
+                            }
                         }
                     }
                     else if (status == BleApi.ScanStatus.FINISHED)