فهرست منبع

修改这些问题
2、校准对应关系是反的
3、按键功能感觉没有使用(单击,双击)

slambb 8 ماه پیش
والد
کامیت
3df90c63d9

+ 6 - 2
Assets/BowArrow/DoubleScene/Scripts/GameAssistUIDoublePlayer.cs

@@ -133,7 +133,9 @@ public class GameAssistUIDoublePlayer : MonoBehaviour
             {
                 if (SceneManager.GetActiveScene().name == "InfraredGameDouble")
                 {
-                    InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.FirstPlayer);
+                    //InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.FirstPlayer);
+                    //左边校准小点
+                    InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.SecondPlayer);
                 }
                 //else
                 //{
@@ -164,7 +166,9 @@ public class GameAssistUIDoublePlayer : MonoBehaviour
             {
                 if (SceneManager.GetActiveScene().name == "InfraredGameDouble")
                 {
-                    InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.SecondPlayer);
+                    //InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.SecondPlayer);
+                    //右边校准大点
+                    InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.FirstPlayer);
                 }
                 else {
                     //使用新模式重置2p

+ 2 - 2
Assets/BowArrow/InfraredCamera/InfraredDemo.cs

@@ -680,7 +680,7 @@ public class InfraredDemo : JCUnityLib.ViewBase
                     Ray ray = Camera.main.ScreenPointToRay(point);
                     Vector3 rayEndPoint = ray.GetPoint(200);
                     Quaternion quat = Quaternion.LookRotation(rayEndPoint - Camera.main.transform.position);
-                    if (i == 0)
+                    if (i == 1)
                     {
                         if (CameraToLook.ins != null) CameraToLook.ins.localRotation = quat;
 
@@ -689,7 +689,7 @@ public class InfraredDemo : JCUnityLib.ViewBase
                         _posText += "红0:" + points[0].ToString("F2");
 
                     }
-                    if (i == 1)
+                    if (i == 0) //大点算2p
                     {
                         if (CameraToLookNew.ins != null)
                         {

+ 33 - 10
Assets/BowArrow/Scripts/Bluetooth/BluetoothAim.cs

@@ -6,6 +6,7 @@ using UnityEngine.UI;
 using DG.Tweening;
 using SmartBowSDK;
 using System.Collections;
+using UnityEngine.SceneManagement;
 
 /* 蓝牙瞄准模块 */
 /* 管理1p和2p蓝牙连接,脚本外调用逻辑如果同时连接1p和2p设备,以前的逻辑还是以1p为主,如果只连2p,则使用2p数据*/
@@ -780,7 +781,8 @@ public class BluetoothAim : MonoBehaviour
     public void onCreateSmartBowHelper2P() {
 
         smartBowHelper2P = SmartBowHelper.NewInstance();
-    
+        smartBowHelper2P.SetFilters("Bbow_20210501 | HOUYI Pro | Pistol | Pistol M9 | ARTEMIS Pro");
+
         smartBowHelper2P.OnBluetoothModuleInited += () =>
         {
             Debug.Log("OnBluetoothModuleInited");
@@ -856,7 +858,7 @@ public class BluetoothAim : MonoBehaviour
         smartBowHelper2P.OnFunctionKeyPress += () =>
         {
             //如果是双人场景,触发提示
-            if (UnityEngine.SceneManagement.SceneManager.GetActiveScene().name == "GameDouble")
+            if (SceneManager.GetActiveScene().name == "GameDouble")
             {
                 if (GameObject.Find("AutoResetViewNewRight")) return;
                 GameObject resetView = Instantiate(Resources.Load<GameObject>("AutoResetViewNew"));
@@ -868,7 +870,25 @@ public class BluetoothAim : MonoBehaviour
                     smartBowHelper2P.ResetAim();
                 };
             }
-            else {
+            else if (SceneManager.GetActiveScene().name == "InfraredGameDouble") {
+                if (GameObject.Find("AutoResetViewNewRight")) return;
+                GameObject resetView = Instantiate(Resources.Load<GameObject>("AutoResetViewNew"));
+                resetView.name = "AutoResetViewNewRight";
+                AutoResetViewNew autoResetViewNewScript = resetView.GetComponent<AutoResetViewNew>();
+                autoResetViewNewScript.setTextKey("new-user-guider_tip_视角归位-瞄准-infraredD");
+                autoResetViewNewScript.setPosRight();
+                autoResetViewNewScript.action_OnDestroy += () =>
+                {
+                    if (SceneManager.GetActiveScene().name == "InfraredGameDouble")
+                    {
+                        //InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.SecondPlayer);
+                        //右边校准大点
+                        InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.FirstPlayer);
+                    }
+                };
+            }
+            else
+            {
                 smartBowHelper2P.ResetAim();
             }
          
@@ -1027,14 +1047,17 @@ public class BluetoothAim : MonoBehaviour
     }
     //更新跟随点位置
     public void UpdateCameraToLookNewPoint2P() {
-        if (CameraToLookNew.ins != null)
-        {
-            Transform m_controlObj = CameraToLookNew.ins.transform;
-            if (lerpForRotation2P)
-                m_controlObj.localRotation = Quaternion.Lerp(m_controlObj.localRotation, newRotation2P, Time.deltaTime * lerpTimeRate2P);
-            else
-                m_controlObj.localRotation = newRotation2P;
+        if (SceneManager.GetActiveScene().name != "InfraredGameDouble") {
+            if (CameraToLookNew.ins != null)
+            {
+                Transform m_controlObj = CameraToLookNew.ins.transform;
+                if (lerpForRotation2P)
+                    m_controlObj.localRotation = Quaternion.Lerp(m_controlObj.localRotation, newRotation2P, Time.deltaTime * lerpTimeRate2P);
+                else
+                    m_controlObj.localRotation = newRotation2P;
+            }
         }
+     
     }
 
     public int get2PBattery() {

+ 20 - 1
Assets/BowArrow/Scripts/Expand/AutoResetView.cs

@@ -32,6 +32,24 @@ public class AutoResetView : MonoBehaviour
                 //AimHandler.ins?.DoIdentity();
             };
         }
+        else if (SceneManager.GetActiveScene().name == "InfraredGameDouble")
+        {
+            if (GameObject.Find("AutoResetViewNewLeft")) return;
+            GameObject resetView = Instantiate(Resources.Load<GameObject>("AutoResetViewNew"));
+            resetView.name = "AutoResetViewNewLeft";
+            AutoResetViewNew autoResetViewNewScript = resetView.GetComponent<AutoResetViewNew>();
+            autoResetViewNewScript.setTextKey("new-user-guider_tip_视角归位-瞄准-infraredD");
+            autoResetViewNewScript.setPosLeft();
+            autoResetViewNewScript.action_OnDestroy += () =>
+            {
+                if (SceneManager.GetActiveScene().name == "InfraredGameDouble")
+                {
+                    //InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.FirstPlayer);
+                    //左边校准小点
+                    InfraredDemo._ins?.SetAdjustPointsOffset(PlayerType.SecondPlayer);
+                }
+            };
+        }
         else if (SceneManager.GetActiveScene().name.StartsWith("Game"))
         {
             Instantiate(Resources.Load<GameObject>("Prefabs/Views/AutoResetView"));
@@ -48,7 +66,8 @@ public class AutoResetView : MonoBehaviour
         {
             Instantiate(Resources.Load<GameObject>("Prefabs/Views/AutoResetView"));
         }
-        else if (SceneManager.GetActiveScene().name.StartsWith("Hyperspace")) {
+        else if (SceneManager.GetActiveScene().name.StartsWith("Hyperspace"))
+        {
             //Hyperspace01 Hyperspace02 Hyperspace03
             Instantiate(Resources.Load<GameObject>("Prefabs/Views/AutoResetView"));
         }