Prechádzať zdrojové kódy

1.调整定位流程。修改握手校验

slambb 1 rok pred
rodič
commit
0480c24aa1

+ 9 - 0
Assets/BowArrow/InfraredCamera/InfraredDemo.cs

@@ -573,6 +573,15 @@ public class InfraredDemo : MonoBehaviour
                 StartCoroutine(delayInitOhterInfo(camera));
                
             };
+
+            //屏幕变化时候
+            infraredCameraHelper.OnUVCPosUpdate += (list) =>
+            {
+                Debug.Log("OnUVCPosUpdate");
+                SetLocatePointsToCameraRender(list, 1, 1);
+                //InfraredScreenPositioningView 页面
+                FindObjectOfType<InfraredScreenPositioningView>()?.SyncScreenPosition();
+            };
         }
     }
     /// <summary>

+ 1 - 17
Assets/BowArrow/Scripts/Bluetooth/AimHandler.cs

@@ -332,23 +332,7 @@ public class AimDeviceInfos
             } else if (bytes[0] == 0x5b) {
                 //红外射击检测
                 ShootCheck.ins.ShootByInfrared(bytes); 
-            } else if (bytes[0] == 0x5a)
-            {
-                //握手成功响应
-                if (bytes[1] == 0x00 && bytes[2] == 0x00 && bytes[3] == 0x00 && bytes[4] == 0x00)
-                {
-                    Debug.Log("设备握手连接成功!");
-                }
-                else {
-                    //手枪应答
-                    //Debug.Log("瞄准模块数据长度" + bytes.Length);
-                    byte[] response = BluetoothDecryptor.GetResponse(bytes);
-                    BluetoothAim.ins.WriteByteData(response);
-                }
-
-            
-            }
-            else if (bytes[0] == 0x5C)
+            } else if (bytes[0] == 0x5C)
             {
                 //00 弹夹分离,01 上弹夹
                 ShootCheck.ins.UpdateTheMagazine(bytes);

+ 110 - 28
Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs

@@ -5,6 +5,7 @@ using System.Collections.Generic;
 using UnityEngine.UI;
 using DG.Tweening;
 using SmartBowSDK;
+using System.Collections;
 
 /* 蓝牙瞄准模块 */
 /* 管理1p和2p蓝牙连接,脚本外调用逻辑如果同时连接1p和2p设备,以前的逻辑还是以1p为主,如果只连2p,则使用2p数据*/
@@ -315,20 +316,30 @@ public class BluetoothAim : MonoBehaviour
                 // CallDelay(1, OpenInfrared);
                 // CallDelay(2, OpenReceiveData);
                 // CallDelay(3, RequestBattery);
-                CallDelay(2, () =>
+
+                if (CommonConfig.EnableDecryption)
                 {
-                    if (status != BluetoothStatusEnum.ConnectSuccess) return;
-                    InitWhenConenct();
-                    if (CommonConfig.StandaloneMode)
+                    // 这里验证指令,开始请求授权
+                    // 启动轮询协程
+                    StartCoroutine(PollingCoroutine());
+                }
+                else {
+                    //除了pc,Android 直接连接
+                    CallDelay(2, () =>
                     {
-                        if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "Home" 
-                            && PersistenHandler.ins.menuBackCtr.views.Count == 0 
-                            && !FindObjectOfType<NewUserGuider>())
+                        if (status != BluetoothStatusEnum.ConnectSuccess) return;
+                        InitWhenConenct();
+                        if (CommonConfig.StandaloneMode)
                         {
-                            ViewMgr.Instance.ShowView<GameStartView>();
+                            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "Home"
+                                && PersistenHandler.ins.menuBackCtr.views.Count == 0
+                                && !FindObjectOfType<NewUserGuider>())
+                            {
+                                ViewMgr.Instance.ShowView<GameStartView>();
+                            }
                         }
-                    }
-                });
+                    });
+                }
             };
             bluetoothHelper.OnConnectionFailed += (BluetoothHelper helper) =>
             {
@@ -337,23 +348,7 @@ public class BluetoothAim : MonoBehaviour
             };
             bluetoothHelper.OnCharacteristicChanged += (helper, value, characteristic) =>
             {
-                if (status != BluetoothStatusEnum.ConnectSuccess) return;
-                // logger.Log(String.Join(",", value));
-                if (!hasData) {
-                    hasData = true;
-                    hasDataTime = JCUnityLib.TimeUtils.GetTimestamp();
-                }
-                dataCount++;
-                if (curMac == null && dataCount < 500) {
-                    UploadMacAddress(value);
-                }
-                byte[] bytes = value;
-                // Log(String.Join(",", bytes));
-                BluetoothClient.UploadData(0, bytes);
-                if (AimHandler.ins)
-                {
-                    AimHandler.ins.OnDataReceived(bytes);
-                }
+                OnCharacteristicChanged(helper, value, characteristic);
             };
             bluetoothHelper.OnScanEnded += (BluetoothHelper helper, LinkedList<BluetoothDevice> nearbyDevices) =>
             {
@@ -430,6 +425,45 @@ public class BluetoothAim : MonoBehaviour
         PopupMgr.ins.ShowTip(errorText);
     }
 
+
+    // 协程来处理轮询
+    // 目前仅手枪支持该指令。
+    // 调用 AUTHOR_SendReq 方法,传递系统Tick值(在这里用一个示例值)
+    private bool isPolling = false;
+    private int PollingCoroutineCount = 4;
+    private IEnumerator PollingCoroutine()
+    {
+        // 发送请求
+        // SendEncrypt();
+        // 设置轮询标志
+        isPolling = true;
+        PollingCoroutineCount = 4;
+        uint systemTick = (uint)DateTime.Now.Ticks;
+        while (isPolling)
+        {
+            // 等待一秒
+            yield return new WaitForSeconds(1f);
+            SendEncrypt(systemTick);
+            PollingCoroutineCount--;
+        }
+    }
+    /// <summary>
+    /// 1、加密字节由系统生成的随机码加密而成;
+    /// 2、蓝牙每次断开并重新连接后,会重新生成随机加密值;
+    /// 3、当设备未发送正确的解密信息时,APP会每秒发送1次请求,直到解密成功。
+    /// </summary>
+    /// <param name="systemTick"></param>
+    private void SendEncrypt(uint systemTick) {
+        byte[] sendByte = BluetoothDecryptor.AUTHOR_SendReq(systemTick);
+        Debug.Log("请求sendByte:" + BitConverter.ToString(sendByte));
+        WriteByteData(sendByte);
+    }
+    // 模拟从硬件读取数据
+    public void  StopEncrypt()
+    {
+        isPolling = false;
+    }
+
     void ConnectBleByUDP()
     {
         try
@@ -675,6 +709,9 @@ public class BluetoothAim : MonoBehaviour
         if (isSendCmdLocked) return;
         WriteData("I");
     }
+    /// <summary>
+    /// 旧的红外射箭指令
+    /// </summary>
     public void ReplyInfraredShoot()
     {
         if (isSendCmdLocked) return;
@@ -1211,7 +1248,16 @@ public class BluetoothAim : MonoBehaviour
         Log("[WinBle_1P]连接成功\n" + deviceName);
         SetStatus(BluetoothStatusEnum.ConnectSuccess);
         BowCamera.isTouchMode = false;
+
+#if UNITY_STANDALONE_WIN || UNITY_EDITOR
+        // 这里验证指令,开始请求授权
+        // 启动轮询协程
+        StartCoroutine(PollingCoroutine());
+#else
+        //除了pc,Android 直接连接
         InitWhenConenct();
+#endif
+
     }
     void OnConnectionFailed_windows1()
     {
@@ -1223,13 +1269,49 @@ public class BluetoothAim : MonoBehaviour
         OnCharacteristicChanged(null, value, null);
     }
     void OnCharacteristicChanged(BluetoothHelper helper, byte[] value, BluetoothHelperCharacteristic characteristic) {
+
         if (status != BluetoothStatusEnum.ConnectSuccess) return;
-        // logger.Log(String.Join(",", value));
         if (!hasData)
         {
             hasData = true;
             hasDataTime = JCUnityLib.TimeUtils.GetTimestamp();
         }
+        if (CommonConfig.EnableDecryption)
+        {
+            //Pc 版本先走校验流程
+            if (!BluetoothDecryptor.AUTHOR_IsDecrypt())
+            {
+                if (value[0] == 0x5a)
+                {
+                    // 从硬件读取数据
+                    if (value != null && value.Length > 0)
+                    {
+                        Debug.Log("接收到数据:" + BitConverter.ToString(value));
+                        BluetoothDecryptor.AUTHOR_Decrypt(value);
+                        if (BluetoothDecryptor.AUTHOR_IsDecrypt())
+                        {
+                            Debug.Log("解密成功!");
+                            //解密成功后
+                            StopEncrypt();
+                            //开始连接其他信息
+                            InitWhenConenct();
+                        }
+                        else
+                        {
+                            Debug.Log("解密失败!");
+                            //SideTipView.ShowTip("设备通信失败,断开连接", Color.yellow);
+                            //断开连接等操作
+                            if (PollingCoroutineCount <= 0)
+                            {
+                                StopEncrypt();
+                                DoConnect();
+                            }
+                        }
+                    }
+                }
+                return;
+            }
+        }
         dataCount++;
         if (curMac == null && dataCount < 500)
         {

+ 10 - 0
Assets/BowArrow/Scripts/CommonConfig.cs

@@ -93,4 +93,14 @@ public class CommonConfig
     /// 单机模式是否开启
     /// </summary>
     public static bool StandaloneMode = false;
+
+    /// <summary>
+    /// 是否开启设备验证。
+    /// 暂时Pc开启验证
+    /// </summary>
+#if UNITY_STANDALONE_WIN || UNITY_EDITOR
+    public static bool EnableDecryption = true;
+#else
+    public static bool EnableDecryption = fasle;
+#endif
 }

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

@@ -511,13 +511,13 @@
   "Infrared-ScreenPositioning": "进入屏幕定位",
   "Infrared-Step1": "先进行投屏,并使摄像头支架位于电视的前方,调整摄像头支架使摄像头朝向屏幕。",
   "Infrared-Step2_title": "屏幕定位说明",
-  "Infrared-Step2": "调整摄像头位置和角度,并使电视尽量占满画面,确保可以拍摄到电视的四角。\n\n先点击自动功能进行屏幕识别,电视上会出现黑屏和白屏的图像,并通过软件进行识别。\n\n如自动识别不准确,可以通过调整摄像头位置或对图像对比度进行调节后,再次自动识别。如多次自动识别不合格,可点击手动功能,并通过手指点击拖动定位区域四个角进行调整。\n\n屏幕位置只需定位一次,只要不移动摄像头的位置,就无需再定位。",
+  "Infrared-Step2": "调整摄像头位置和角度,并使电视尽量占满画面,确保可以拍摄到电视的四角。\n\n先点击自动功能进行屏幕识别,电视上会出现黑屏和白屏的图像,并通过软件识别电视的显示区域。\n\n如自动识别不准确,可以通过调整摄像头位置或对图像对比度进行调节后,再次自动识别。如多次自动识别不合格,可点击手动功能,并通过手指点击拖动定位区域四个角进行调整。\n\n屏幕位置只需定位一次,只要不移动摄像头的位置,就无需再定位。",
 
 
   /**
   手动识别部分
   **/
-  "TitleTip1": "调整摄像头位置和角度,确保可以拍摄到电视的四角。\n先点击自动按键进行屏幕识别,电视上会出现黑屏和\n白屏的图像,并通过软件进行识别",
+  "TitleTip1": "调整摄像头位置和角度,确保可以拍摄到电视的四角。\n先点击自动按键进行屏幕识别,电视上会出现黑屏和\n白屏的图像,并通过软件识别电视的显示区域。",
   "TitleTip2": "如自动识别不准确,可以通过调整摄像头位置或对图像对比度进行\n调节,使屏幕的边缘较清晰后,再次自动识别。如多次自动识别不\n成功,可点击手动功能,并通过手指点击拖动定位区域四个角进行\n调整。点击确认按键进入下一步。",
   "Withdrawal": "撤回",
   "Automatic": "自动",

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

@@ -562,13 +562,13 @@
   "Infrared-ScreenPositioning": "Enter Screen Positioning",
   "Infrared-Step1": "First, perform screen casting, and position the camera mount in front of the TV. Adjust the camera mount so that the camera is facing the screen.",
   "Infrared-Step2_title": "Screen Positioning Instructions",
-  "Infrared-Step2": "Adjust the position and angle of the camera, and make sure the TV fills the screen as much as possible, ensuring that all four corners of the TV are captured.\n\nFirst, click the automatic function to perform screen recognition. The TV will display black and white images, which will be recognized by the software.\n\nIf automatic recognition is not accurate, you can adjust the camera position or the image contrast, and then perform automatic recognition again. If multiple attempts at automatic recognition are unsuccessful, you can click the manual function and adjust the positioning area by clicking and dragging the four corners with your finger.\n\nScreen positioning only needs to be done once. As long as the camera position is not moved, repositioning is not necessary.",
+  "Infrared-Step2": "Adjust the position and angle of the camera, and make sure the TV fills the screen as much as possible, ensuring that all four corners of the TV are captured.\n\nFirst, click on the automatic function for screen recognition. Images of black and white screens will appear on the TV, and the software will recognize the display area of the TV.\n\nIf automatic recognition is not accurate, you can adjust the camera position or the image contrast, and then perform automatic recognition again. If multiple attempts at automatic recognition are unsuccessful, you can click the manual function and adjust the positioning area by clicking and dragging the four corners with your finger.\n\nScreen positioning only needs to be done once. As long as the camera position is not moved, repositioning is not necessary.",
 
 
   /**
   手动识别部分
   **/
-  "TitleTip1": "Adjust the camera position and angle to ensure all four corners\n of the TV are captured. First, click the auto button for screen\n recognition. The TV will display black and white images, and \n the software will recognize them.",
+  "TitleTip1": "Adjust the camera position and angle to ensure all four corners\n of the TV are captured. First, click the auto button for screen\n recognition. The TV will display black and white images, and \n the software will recognize the display area of the TV",
   "TitleTip2": "If the automatic recognition is inaccurate, adjust the camera\n position or the image contrast to make the screen edges clearer,\n then try the automatic recognition again. If multiple attempts of \nautomatic recognition fail, click the manual function and use your\n fingers to drag and position the four corners of the recognition\n area. Click the confirm button to proceed to the next step.",
   "Withdrawal": "Withdrawal",
   "Automatic": "Automatic",

+ 4 - 1
Assets/BowArrow/Scripts/View/Home/SmartArcheryView.cs

@@ -82,8 +82,11 @@ public class SmartArcheryView  : JCUnityLib.ViewBase
             //进入选中的页面
             AudioMgr.ins.PlayBtn();
             if (index == 3) {
+                //进入蓝牙连接页面
+                GameObject connectGuidanceView = ViewManager2.getGameObjectAndShowView(ViewManager2.Path_ConnectGuidanceView);
+                connectGuidanceView.GetComponent<ConnectGuidanceView>().showTextipInfrared();
                 //进入红外引导界面
-                ViewManager2.ShowView(ViewManager2.Path_InfraredView);
+                //ViewManager2.ShowView(ViewManager2.Path_InfraredView);
             } else {
                 ViewManager2.ShowView(ViewManager2.Path_ConnectGuidanceView);
             }

+ 4 - 1
Assets/BowArrow/Scripts/View/Home/SmartGunView.cs

@@ -66,8 +66,11 @@ public class SmartGunView  : JCUnityLib.ViewBase
             AudioMgr.ins.PlayBtn();
             if (index == 0)
             {
+                //½øÈëÀ¶ÑÀÁ¬½ÓÒ³Ãæ
+                GameObject connectGuidanceView = ViewManager2.getGameObjectAndShowView(ViewManager2.Path_ConnectGuidanceView);
+                connectGuidanceView.GetComponent<ConnectGuidanceView>().showTextipInfrared();
                 //½øÈëºìÍâÒýµ¼½çÃæ
-                ViewManager2.ShowView(ViewManager2.Path_InfraredView);
+                //ViewManager2.ShowView(ViewManager2.Path_InfraredView);
             }
         }
 

+ 25 - 7
Assets/InfraredProject/InfraredCamera/Scripts/InfraredCameraHelper.cs

@@ -25,7 +25,7 @@ namespace InfraredManager
         private UVCManager _uvcManager;
 
         public static List<RawImage> InfraredCameraHelperRawImageList = new();
-        public void Create(int defWidth = 320,int defHeight = 240)
+        public void Create(int defWidth = 320, int defHeight = 240)
         {
             if (_managerObject) return;
             string prefabName = "WebCameraView";
@@ -40,8 +40,7 @@ namespace InfraredManager
             _uvcManager.updateUVCManager.AddListener(_screenLocate.UVCUpdate);
             _uvcManager.DefaultWidth = defWidth;
             _uvcManager.DefaultHeight = defHeight;
-            Debug.Log("InitUVCManagerCamera 初始化相机,size:[" + _uvcManager.DefaultWidth +","+ _uvcManager.DefaultHeight +"]");
-            _uvcManager.initUVCManagerCamera();
+            Debug.Log("InitUVCManagerCamera 初始化相机,size:[" + _uvcManager.DefaultWidth + "," + _uvcManager.DefaultHeight + "]");
             _managerObject = o;
             if (Application.platform == RuntimePlatform.Android) Application.targetFrameRate = 60;
         }
@@ -49,7 +48,8 @@ namespace InfraredManager
         /// <summary>
         /// 在pc里面创建此预制
         /// </summary>
-        public void CreateToPc() {
+        public void CreateToPc()
+        {
             if (_managerObject) return;
             string prefabName = "WebCameraView_Pc";
             var o = UnityEngine.Object.Instantiate(Resources.Load<GameObject>(prefabName));
@@ -138,7 +138,7 @@ namespace InfraredManager
                 _uvcManager.DefaultWidth = width;
                 _uvcManager.DefaultHeight = height;
             }
-           
+
             Debug.Log("[InfraredCameraHelper]设置分辨率 SetCameraResolution,width:" + width + " ,height:" + height);
         }
         /// <summary>
@@ -238,15 +238,17 @@ namespace InfraredManager
         /// <summary>
         /// 初始化一次本地的记录点
         /// </summary>
-        public void InitScreenLocateManual() {
+        public void InitScreenLocateManual()
+        {
 
             //获取本地记录的点
             if (ScreenLocate.GetScreenLocateVectorList())
             {
-                Debug.Log("[初始化本地坐标]:"+ _screenLocate.PrintVector2List(ScreenLocate.quadUnityVectorList));
+                Debug.Log("[初始化本地坐标]:" + _screenLocate.PrintVector2List(ScreenLocate.quadUnityVectorList));
                 //使用算法顺序点来设置屏幕四边形,定位点(左下,右下,左上,右上)
                 _screenLocate.QuadUnityVectorListToScreenQuad(ScreenLocate.quadUnityVectorList);
                 _screenLocate.SyncInfraredDemo();
+                InvokeOnUVCPosUpdate(ScreenLocate.quadUnityVectorList);
             }
         }
 
@@ -307,6 +309,22 @@ namespace InfraredManager
             }
         }
         /// <summary>
+        /// UVC 定位点更新事件
+        /// </summary>
+        public OnUVCPosUpdateEvent OnUVCPosUpdate;
+        public delegate void OnUVCPosUpdateEvent(List<Vector2> list);
+        public void InvokeOnUVCPosUpdate(List<Vector2> list)
+        {
+            try
+            {
+                OnUVCPosUpdate?.Invoke(list);
+            }
+            catch (Exception e)
+            {
+                Debug.LogError(e);
+            }
+        }
+        /// <summary>
         /// 单点更新事件
         /// </summary>
         public OnPositionUpdateEvent OnPositionUpdate;

+ 6 - 5
Assets/InfraredProject/InfraredCamera/Scripts/ScreenLocate.cs

@@ -36,6 +36,7 @@ public partial class ScreenLocate : MonoBehaviour
         if (points != null && points.Count == 4)
         {
             var size = getUVCCameraInfoSize;
+            Debug.Log("QuitScreenLocateManual Size:" + size);
             screenIdentification?.SetScreenQuad(
                 new QuadrilateralInCamera(
                     new o0.Geometry2D.Float.Vector(points[0].x * size.x, points[0].y * size.y),
@@ -102,10 +103,10 @@ public partial class ScreenLocate : MonoBehaviour
         // Vector2 texSize = getUVCCameraInfoSize;
         Debug.Log("[ScreenLocate] SyncInfraredDemo : " + PrintVector2List(quadUnityVectorList));
         //同步到infaredDemo
-        FindObjectOfType<InfraredDemo>()?.SetLocatePointsToCameraRender(
-            quadUnityVectorList,
-            1,
-            1);
+        //FindObjectOfType<InfraredDemo>()?.SetLocatePointsToCameraRender(
+        //    quadUnityVectorList,
+        //    1,
+        //    1);
 
     }
 
@@ -116,6 +117,6 @@ public partial class ScreenLocate : MonoBehaviour
     {
         if (quadUnityVectorList.Count == 0) return;
         //同步位置
-        FindObjectOfType<InfraredScreenPositioningView>()?.SyncScreenPosition();
+        //FindObjectOfType<InfraredScreenPositioningView>()?.SyncScreenPosition();
     }
 }

+ 1 - 1
Assets/InfraredProject/WebCamera/Script/ZIM/InfraredLocate/InfraredLocate.cs

@@ -94,7 +94,7 @@ namespace ZIM
 
         public InfraredSpot[] UpdateSingle(Color[] cameraPixels)
         {
-            Debug.Log(cameraPixels.Length + ",  " + screenIdentification.Screen.QuadRect + " -----------------");
+            // Debug.Log(cameraPixels.Length + ",  " + screenIdentification.Screen.QuadRect + " -----------------");
             var spotArea = LocateToScreen(cameraPixels, screenIdentification.Screen.QuadRect);
             return MatchInfraredRaySingle(spotArea);
         }

+ 25 - 24
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: 1}
-  m_AnchorMax: {x: 0, y: 1}
-  m_AnchoredPosition: {x: 834.03, y: -320}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 0, y: 0}
   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: 1}
-  m_AnchorMax: {x: 0, y: 1}
-  m_AnchoredPosition: {x: 221, y: -48}
-  m_SizeDelta: {x: 280, 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 &2166458721827678163
 CanvasRenderer:
@@ -724,7 +724,7 @@ MonoBehaviour:
     m_HorizontalOverflow: 0
     m_VerticalOverflow: 1
     m_LineSpacing: 1
-  m_Text: "\u8C03\u6574\u6444\u50CF\u5934\u4F4D\u7F6E\u548C\u89D2\u5EA6\uFF0C\u5E76\u4F7F\u7535\u89C6\u5C3D\u91CF\u5360\u6EE1\u753B\u9762\uFF0C\u786E\u4FDD\u53EF\u4EE5\u62CD\u6444\u5230\u7535\u89C6\u7684\u56DB\u89D2\u3002\r\n\r\n\u5148\u70B9\u51FB\u81EA\u52A8\u529F\u80FD\u8FDB\u884C\u5C4F\u5E55\u8BC6\u522B\uFF0C\u7535\u89C6\u4E0A\u4F1A\u51FA\u73B0\u9ED1\u5C4F\u548C\u767D\u5C4F\u7684\u56FE\u50CF\uFF0C\u5E76\u901A\u8FC7\u8F6F\u4EF6\u8FDB\u884C\u8BC6\u522B\u3002\r\n\r\n\u5982\u81EA\u52A8\u8BC6\u522B\u4E0D\u51C6\u786E\uFF0C\u53EF\u4EE5\u901A\u8FC7\u8C03\u6574\u6444\u50CF\u5934\u4F4D\u7F6E\u6216\u5BF9\u56FE\u50CF\u5BF9\u6BD4\u5EA6\u8FDB\u884C\u8C03\u8282\u540E\uFF0C\u518D\u6B21\u81EA\u52A8\u8BC6\u522B\u3002\u5982\u591A\u6B21\u81EA\u52A8\u8BC6\u522B\u4E0D\u5408\u683C\uFF0C\u53EF\u70B9\u51FB\u624B\u52A8\u529F\u80FD\uFF0C\u5E76\u901A\u8FC7\u624B\u6307\u70B9\u51FB\u62D6\u52A8\u5B9A\u4F4D\u533A\u57DF\u56DB\u4E2A\u89D2\u8FDB\u884C\u8C03\u6574\u3002\r\n\r\n\u5C4F\u5E55\u4F4D\u7F6E\u53EA\u9700\u5B9A\u4F4D\u4E00\u6B21\uFF0C\u53EA\u8981\u4E0D\u79FB\u52A8\u6444\u50CF\u5934\u7684\u4F4D\u7F6E\uFF0C\u5C31\u65E0\u9700\u518D\u5B9A\u4F4D\u3002"
+  m_Text: "\u8C03\u6574\u6444\u50CF\u5934\u4F4D\u7F6E\u548C\u89D2\u5EA6\uFF0C\u5E76\u4F7F\u7535\u89C6\u5C3D\u91CF\u5360\u6EE1\u753B\u9762\uFF0C\u786E\u4FDD\u53EF\u4EE5\u62CD\u6444\u5230\u7535\u89C6\u7684\u56DB\u89D2\u3002\r\n\r\n\u5148\u70B9\u51FB\u81EA\u52A8\u529F\u80FD\u8FDB\u884C\u5C4F\u5E55\u8BC6\u522B\uFF0C\u7535\u89C6\u4E0A\u4F1A\u51FA\u73B0\u9ED1\u5C4F\u548C\u767D\u5C4F\u7684\u56FE\u50CF\uFF0C\u5E76\u901A\u8FC7\u8F6F\u4EF6\u8BC6\u522B\u7535\u89C6\u7684\u663E\u793A\u533A\u57DF\u3002\r\n\r\n\u5982\u81EA\u52A8\u8BC6\u522B\u4E0D\u51C6\u786E\uFF0C\u53EF\u4EE5\u901A\u8FC7\u8C03\u6574\u6444\u50CF\u5934\u4F4D\u7F6E\u6216\u5BF9\u56FE\u50CF\u5BF9\u6BD4\u5EA6\u8FDB\u884C\u8C03\u8282\u540E\uFF0C\u518D\u6B21\u81EA\u52A8\u8BC6\u522B\u3002\u5982\u591A\u6B21\u81EA\u52A8\u8BC6\u522B\u4E0D\u5408\u683C\uFF0C\u53EF\u70B9\u51FB\u624B\u52A8\u529F\u80FD\uFF0C\u5E76\u901A\u8FC7\u624B\u6307\u70B9\u51FB\u62D6\u52A8\u5B9A\u4F4D\u533A\u57DF\u56DB\u4E2A\u89D2\u8FDB\u884C\u8C03\u6574\u3002\r\n\r\n\u5C4F\u5E55\u4F4D\u7F6E\u53EA\u9700\u5B9A\u4F4D\u4E00\u6B21\uFF0C\u53EA\u8981\u4E0D\u79FB\u52A8\u6444\u50CF\u5934\u7684\u4F4D\u7F6E\uFF0C\u5C31\u65E0\u9700\u518D\u5B9A\u4F4D\u3002"
 --- !u!114 &5493287035359193497
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -803,6 +803,7 @@ Canvas:
   m_OverrideSorting: 0
   m_OverridePixelPerfect: 0
   m_SortingBucketNormalizedSize: 0
+  m_VertexColorAlwaysGammaSpace: 0
   m_AdditionalShaderChannelsFlag: 0
   m_SortingLayerID: 0
   m_SortingOrder: 1
@@ -1383,7 +1384,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 1
+  m_IsActive: 0
 --- !u!224 &5651314243503148123
 RectTransform:
   m_ObjectHideFlags: 0
@@ -1404,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: 0, y: 0}
+  m_SizeDelta: {x: -1195, y: -424}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5651314243503148127
 CanvasRenderer:
@@ -1518,9 +1519,9 @@ RectTransform:
   m_Father: {fileID: 5651314243503148123}
   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: 668.5, y: -320}
   m_SizeDelta: {x: 1337, y: 640}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5651314243550147655
@@ -1691,10 +1692,10 @@ RectTransform:
   m_Father: {fileID: 5651314244108234268}
   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: 140, y: 50}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5651314243985302727
 CanvasRenderer:
@@ -1790,10 +1791,10 @@ RectTransform:
   m_Father: {fileID: 5651314243503148123}
   m_RootOrder: 1
   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: 96}
+  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_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5651314244108234247
 CanvasRenderer:
@@ -1946,7 +1947,7 @@ GameObject:
   m_Icon: {fileID: 0}
   m_NavMeshLayer: 0
   m_StaticEditorFlags: 0
-  m_IsActive: 0
+  m_IsActive: 1
 --- !u!224 &6541729197459587817
 RectTransform:
   m_ObjectHideFlags: 0
@@ -1967,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: -863.93994, y: -424}
+  m_SizeDelta: {x: 0, y: 0}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &2474763126871341944
 MonoBehaviour:
@@ -2043,6 +2044,6 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0.5, y: 0.5}
   m_AnchorMax: {x: 0.5, y: 0.5}
-  m_AnchoredPosition: {x: 115, y: 172}
+  m_AnchoredPosition: {x: 115, y: 187}
   m_SizeDelta: {x: 338.47998, y: 411}
   m_Pivot: {x: 0, y: 1}

+ 50 - 44
Assets/SmartBow/Scripts/Views/ConnectGuidanceView.cs

@@ -83,12 +83,15 @@ public class ConnectGuidanceView : MonoBehaviour
                 }
                 else
                 {
-                    if (!PlayerPrefs.HasKey("hideInfraredBowAndArrow"))
-                    {
-                        //如果是红外连接成功,记录一个tag
-                        PlayerPrefs.SetInt("hideInfraredBowAndArrow", 1);
-                    }
-                    onEnterInfrared();
+                    //修改步骤
+                    ViewManager2.ShowView(ViewManager2.Path_InfraredView);
+
+                    //if (!PlayerPrefs.HasKey("hideInfraredBowAndArrow"))
+                    //{
+                    //    //如果是红外连接成功,记录一个tag
+                    //    PlayerPrefs.SetInt("hideInfraredBowAndArrow", 1);
+                    //}
+                    //onEnterInfrared();
                 }
             }
         }
@@ -106,12 +109,15 @@ public class ConnectGuidanceView : MonoBehaviour
                 }
                 else
                 {
-                    if (!PlayerPrefs.HasKey("hideInfraredBowAndArrow"))
-                    {
-                        //如果是红外连接成功,记录一个tag
-                        PlayerPrefs.SetInt("hideInfraredBowAndArrow", 1);
-                    }
-                    onEnterInfrared();
+                    //修改步骤
+                    ViewManager2.ShowView(ViewManager2.Path_InfraredView);
+
+                    //if (!PlayerPrefs.HasKey("hideInfraredBowAndArrow"))
+                    //{
+                    //    //如果是红外连接成功,记录一个tag
+                    //    PlayerPrefs.SetInt("hideInfraredBowAndArrow", 1);
+                    //}
+                    //onEnterInfrared();
                 }
                 //ViewManager2.ShowView(ViewManager2.Path_GyrGuidanceView);
             }
@@ -256,36 +262,36 @@ public class ConnectGuidanceView : MonoBehaviour
     }
 
     //连接之后,跳转进入场景
-    void onEnterInfrared() {
-        //添加进入射箭场景 
-        if (PlayerPrefs.GetInt("entry-guider-infrared-" + LoginMgr.myUserInfo.id, 0) == 0)
-        {
-            Debug.Log("-----进入射箭场景!");
-            NewUserGuiderManager newUserGuiderManager = FindObjectOfType<NewUserGuiderManager>();
-            newUserGuiderManager.curConfigKey = "开始-红外调整";
-            newUserGuiderManager.isNewModule = AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.HOUYIPRO || AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.Gun ;
-            //进入射箭场景
-            GlobalData.pkMatchType = PKMatchType.None;
-            GameMgr.gameType = 1;
-            //射一箭回到连接页面,Device.view
-            GameMgr.bNavBack = true;
-            GameMgr.bShowDistance = false;
-            AimHandler.ins.bInitOne = true;
-            //关闭计时器
-            GameMgr.turnOffTimer = true;
-
-            UnityEngine.SceneManagement.SceneManager.LoadScene(
-                "Game", UnityEngine.SceneManagement.LoadSceneMode.Single);
-
-            PlayerPrefs.SetInt("entry-guider-infrared-" + LoginMgr.myUserInfo.id, 1);
-
-        }
-        else
-        {
-            Debug.Log("-----跳转回连接界面!");
-            //如不是第一次,则应该跳转回连接界面
-            ViewMgr.Instance.DestroyView<SmartArcheryView>();
-            ViewManager2.HideView(ViewManager2.Path_ConnectGuidanceView);
-        }
-    }
+    //void onEnterInfrared() {
+    //    //添加进入射箭场景 
+    //    if (PlayerPrefs.GetInt("entry-guider-infrared-" + LoginMgr.myUserInfo.id, 0) == 0)
+    //    {
+    //        Debug.Log("-----进入射箭场景!");
+    //        NewUserGuiderManager newUserGuiderManager = FindObjectOfType<NewUserGuiderManager>();
+    //        newUserGuiderManager.curConfigKey = "开始-红外调整";
+    //        newUserGuiderManager.isNewModule = AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.HOUYIPRO || AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.Gun ;
+    //        //进入射箭场景
+    //        GlobalData.pkMatchType = PKMatchType.None;
+    //        GameMgr.gameType = 1;
+    //        //射一箭回到连接页面,Device.view
+    //        GameMgr.bNavBack = true;
+    //        GameMgr.bShowDistance = false;
+    //        AimHandler.ins.bInitOne = true;
+    //        //关闭计时器
+    //        GameMgr.turnOffTimer = true;
+
+    //        UnityEngine.SceneManagement.SceneManager.LoadScene(
+    //            "Game", UnityEngine.SceneManagement.LoadSceneMode.Single);
+
+    //        PlayerPrefs.SetInt("entry-guider-infrared-" + LoginMgr.myUserInfo.id, 1);
+
+    //    }
+    //    else
+    //    {
+    //        Debug.Log("-----跳转回连接界面!");
+    //        //如不是第一次,则应该跳转回连接界面
+    //        ViewMgr.Instance.DestroyView<SmartArcheryView>();
+    //        ViewManager2.HideView(ViewManager2.Path_ConnectGuidanceView);
+    //    }
+    //}
 }

+ 51 - 4
Assets/SmartBow/Scripts/Views/InfraredViewParts/InfraredScreenPositioningView.cs

@@ -409,13 +409,23 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
         {
             //跳转入界面
             AudioMgr.ins.PlayBtn();
-            ViewManager2.HideView(ViewManager2.Path_InfraredScreenPositioningView);
 
-            if (!enterFromInfraredDemo) {
+            if (!enterFromInfraredDemo)
+            {
                 //每次初始化重置一下引导
                 InfraredDemo._ins.resetInfraredPlayerPrefs();
-                GameObject connectGuidanceView = ViewManager2.getGameObjectAndShowView(ViewManager2.Path_ConnectGuidanceView);
-                connectGuidanceView.GetComponent<ConnectGuidanceView>().showTextipInfrared();
+                //GameObject connectGuidanceView = ViewManager2.getGameObjectAndShowView(ViewManager2.Path_ConnectGuidanceView);
+                //connectGuidanceView.GetComponent<ConnectGuidanceView>().showTextipInfrared();
+
+                if (!PlayerPrefs.HasKey("hideInfraredBowAndArrow"))
+                {
+                    //如果是红外连接成功,记录一个tag
+                    PlayerPrefs.SetInt("hideInfraredBowAndArrow", 1);
+                }
+                onEnterInfrared();
+            }
+            else {
+                ViewManager2.HideView(ViewManager2.Path_InfraredScreenPositioningView);
             }
            
         }
@@ -626,4 +636,41 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
         buttonText.color = normalTextColor;
     }
     #endregion
+
+
+    #region 标定完成之后进入游戏界面
+    void onEnterInfrared()
+    {
+        //添加进入射箭场景 
+        if (PlayerPrefs.GetInt("entry-guider-infrared-" + LoginMgr.myUserInfo.id, 0) == 0)
+        {
+            Debug.Log("-----进入射箭场景!");
+            NewUserGuiderManager newUserGuiderManager = FindObjectOfType<NewUserGuiderManager>();
+            newUserGuiderManager.curConfigKey = "开始-红外调整";
+            newUserGuiderManager.isNewModule = AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.HOUYIPRO || AimHandler.ins.aimDeviceInfo.type == (int)AimDeviceType.Gun;
+            //进入射箭场景
+            GlobalData.pkMatchType = PKMatchType.None;
+            GameMgr.gameType = 1;
+            //射一箭回到连接页面,Device.view
+            GameMgr.bNavBack = true;
+            GameMgr.bShowDistance = false;
+            AimHandler.ins.bInitOne = true;
+            //关闭计时器
+            GameMgr.turnOffTimer = true;
+
+            UnityEngine.SceneManagement.SceneManager.LoadScene(
+                "Game", UnityEngine.SceneManagement.LoadSceneMode.Single);
+
+            PlayerPrefs.SetInt("entry-guider-infrared-" + LoginMgr.myUserInfo.id, 1);
+
+        }
+        else
+        {
+            Debug.Log("-----跳转回连接界面!");
+            //如不是第一次,则应该跳转回连接界面
+            ViewMgr.Instance.DestroyView<SmartArcheryView>();
+            ViewManager2.HideView(ViewManager2.Path_ConnectGuidanceView);
+        }
+    }
+    #endregion
 }

BIN
Assets/SmartBow/SmartBowSDK/SmartBowSDK.dll