Переглянути джерело

修改意见 第九点和第十点

slambb 2 роки тому
батько
коміт
12a990173c

+ 18 - 0
Assets/BowArrow/Scripts/Bluetooth/AimHandler.cs

@@ -191,6 +191,24 @@ public class AimDeviceInfos
         }
     }
 
+    #region 根据设备1p或者2p 获取HOUYIPRO的状态
+    public bool isHOUYIPRO(BluetoothPlayer bluetoothPlayer)
+    {
+        bool _isHOUYIPRO = false;
+
+        foreach (AimDeviceInfo p in AimHandler.ins.aimDeviceInfos.arry)
+        {
+            if ((int)bluetoothPlayer == p.id && p.type == (int)AimDeviceType.HOUYIPRO)
+            {
+                _isHOUYIPRO = true;
+            }
+        }
+        return _isHOUYIPRO;
+    }
+    #endregion
+
+
+
     public void ReinitAxisHandler()
     {
         Debug.Log("ReinitAxisHandler");

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

@@ -1052,4 +1052,29 @@ public class BluetoothAim : MonoBehaviour
         }
     }
 
+
+    #region 判断是否是1p设备连接的是HOUYIPRO信息
+    public bool isMainConnectToHOUYIPRO() {
+        bool _isHOUYIPRO = false;
+
+        foreach (AimDeviceInfo p in AimHandler.ins.aimDeviceInfos.arry)
+        {
+            if ((int)BluetoothPlayer.FIRST_PLAYER == p.id && p.type == (int)AimDeviceType.HOUYIPRO)
+            {
+                _isHOUYIPRO = true;
+            }
+        }
+        if (_isHOUYIPRO)
+        {
+            //如果是。判断是否连接
+            return status == BluetoothStatusEnum.ConnectSuccess;
+        }
+        else {
+            return false;
+        }
+      
+    
+    }
+    #endregion
+
 }

+ 18 - 10
Assets/BowArrow/Scripts/Game/GameAssistUI.cs

@@ -67,16 +67,24 @@ public class GameAssistUI : MonoBehaviour
             }
         });
         Button btnIdentity = this.transform.Find("Button4").GetComponent<Button>();
-        btnIdentity.onClick.AddListener(delegate(){
-            if (btnIdentity.GetComponent<LongPressMonitor>().isLongPress) return;
-            AudioMgr.ins.PlayBtn();
-            AutoResetView.DoIdentity();
-            action_OnClickBtnIdentity?.Invoke();
-        });
-        btnIdentity.gameObject.AddComponent<LongPressMonitor>().onLongPress += () => {
-            AudioMgr.ins.PlayBtn();
-            if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse(); 
-        };
+        //如果是连接红外
+        if (BluetoothAim.ins && BluetoothAim.ins.isMainConnectToHOUYIPRO())
+        {
+            btnIdentity.gameObject.SetActive(false);
+        }
+        else {
+
+            btnIdentity.onClick.AddListener(delegate () {
+                if (btnIdentity.GetComponent<LongPressMonitor>().isLongPress) return;
+                AudioMgr.ins.PlayBtn();
+                AutoResetView.DoIdentity();
+                action_OnClickBtnIdentity?.Invoke();
+            });
+            btnIdentity.gameObject.AddComponent<LongPressMonitor>().onLongPress += () => {
+                AudioMgr.ins.PlayBtn();
+                if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
+            };
+        }
 
         // ------ 查看靶子 ------
         Transform targetView = this.transform.Find("TargetView");

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

@@ -79,8 +79,17 @@ public class DeviceView_ItemShow : MonoBehaviour
             //选择此device index 跳转页面
             AimHandler.ins.SetAimDeviceSelectIndex(deviceIndex);
             AimHandler.ins.onCreateTempAimDeviceInfo();
-            ViewMgr.Instance.ShowView<SmartArcheryView>();
+      
             //判断当前的信息是否是 HOUYI PRO,是的话直接跳转到pro初始化?
+            if (AimHandler.ins.isHOUYIPRO(bluetoothPlayer))
+            {
+                //直接进入红外引导界面
+                AimHandler.ins.SetTempAimDeviceType(AimDeviceType.HOUYIPRO);
+                ViewManager2.ShowView(ViewManager2.Path_InfraredView);
+            }
+            else {
+                ViewMgr.Instance.ShowView<SmartArcheryView>();
+            }
         });
 
         ConnectButton.onClick.AddListener(delegate ()

+ 18 - 10
Assets/DuckHunter/Scripts/GameUI.cs

@@ -30,17 +30,25 @@ namespace DuckHunter
                 AudioManager.Instance.PlayBtn();
                 UnityEngine.SceneManagement.SceneManager.LoadScene("DuckHunter");
             });
-            btnAim.onClick.AddListener(() =>
-            {
-                if (btnAim.GetComponent<LongPressMonitor>().isLongPress) return;
-                AudioManager.Instance.PlayBtn();
-                SmartBowController.Instance.ResetAim();
-            });
-            btnAim.gameObject.AddComponent<LongPressMonitor>().onLongPress += () => 
+
+            if (BluetoothAim.ins && BluetoothAim.ins.isMainConnectToHOUYIPRO())
             {
-                AudioManager.Instance.PlayBtn();
-                if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse(); 
-            };
+                btnAim.gameObject.SetActive(false);
+            }
+            else {
+                btnAim.onClick.AddListener(() =>
+                {
+                    if (btnAim.GetComponent<LongPressMonitor>().isLongPress) return;
+                    AudioManager.Instance.PlayBtn();
+                    SmartBowController.Instance.ResetAim();
+                });
+                btnAim.gameObject.AddComponent<LongPressMonitor>().onLongPress += () =>
+                {
+                    AudioManager.Instance.PlayBtn();
+                    if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
+                };
+            }
+                
             btnBack.onClick.AddListener(() => {
                 AudioManager.Instance.PlayBtn();
                 // UnityEngine.SceneManagement.SceneManager.LoadScene("Home", UnityEngine.SceneManagement.LoadSceneMode.Single);

+ 10 - 3
Assets/FruitMaster/Scripts/OverallLogics.cs

@@ -35,9 +35,16 @@ public class OverallLogics : MonoBehaviour
     // Start is called before the first frame update
     void Start()
     {
-       // ShutdownBtn.onClick.AddListener(Shutdown);
-        ResetAimBtn.onClick.AddListener(ResetAim);
-        ResetAimBtn.gameObject.AddComponent<LongPressMonitor>().onLongPress += ResetAimLongPress;
+        // ShutdownBtn.onClick.AddListener(Shutdown);
+        if (BluetoothAim.ins && BluetoothAim.ins.isMainConnectToHOUYIPRO())
+        {
+            ResetAimBtn.gameObject.SetActive(false);
+        }
+        else
+        {
+            ResetAimBtn.onClick.AddListener(ResetAim);
+            ResetAimBtn.gameObject.AddComponent<LongPressMonitor>().onLongPress += ResetAimLongPress;
+        }
 
         //GetComponent<SmartBowManager>().OnConnectionLost += OnSmartBowConnectionLost;
         _startGameBtn.onClick.AddListener(StartGame);

+ 2 - 2
Assets/SmartBow/Scripts/Views/ConnectGuidanceView.cs

@@ -58,8 +58,8 @@ public class ConnectGuidanceView : MonoBehaviour
     void OnClick_Next()
     {
 
-        onEnterInfrared();
-        return;
+        //onEnterInfrared();
+        //return;
         if (BluetoothAim.ins.getBLEPlayer() == BluetoothPlayer.FIRST_PLAYER)
         {
             if (bowStatus == BluetoothStatusEnum.ConnectSuccess)

+ 16 - 8
Assets/WildAttack/Scripts/UI/MainPanel.cs

@@ -107,15 +107,23 @@ namespace WildAttack
             //_btnConnect.onClick.AddListener(OnClick_Connect);
             //_btnCalibrateGyr.onClick.AddListener(OnClick_CalibrateGyr);
             //_btnCalibrateMag.onClick.AddListener(OnClick_CalibrateMag);
-            _btnResetAim.onClick.AddListener(() => {
-                if (_btnResetAim.GetComponent<LongPressMonitor>().isLongPress) return;
-                OnClick_ResetAim();
-            });
-            _btnResetAim.gameObject.AddComponent<LongPressMonitor>().onLongPress += () =>
+
+            if (BluetoothAim.ins && BluetoothAim.ins.isMainConnectToHOUYIPRO())
             {
-                AudioMgr.ins?.PlayBtn();
-                if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
-            };
+                _btnResetAim.gameObject.SetActive(false);
+            }
+            else {
+                _btnResetAim.onClick.AddListener(() => {
+                    if (_btnResetAim.GetComponent<LongPressMonitor>().isLongPress) return;
+                    OnClick_ResetAim();
+                });
+                _btnResetAim.gameObject.AddComponent<LongPressMonitor>().onLongPress += () =>
+                {
+                    AudioMgr.ins?.PlayBtn();
+                    if (SB_EventSystem.ins) SB_EventSystem.ins.AwakenSimulateMouse();
+                };
+            }
+               
             //_btnStopRotationSensor.onClick.AddListener(OnClick_StopRotationSensor);
             //_btnStopShootingSensor.onClick.AddListener(OnClick_StopShootingSensor);