Forráskód Böngészése

引导连接设备-拦截器

lvjincheng 3 éve
szülő
commit
9dd7b09290

+ 9 - 0
Assets/BowArrow/Modules/NewUserGuider/NewUserGuiderManager.cs

@@ -124,6 +124,15 @@ public class NewUserGuiderManager : MonoBehaviour
                     g.OnClick_ToNext();
                 }
             });
+            Func<bool> action_DoConnectInterceptor = () => {
+                bool isConnected = BluetoothAim.ins.status == BluetoothStatusEnum.ConnectSuccess;
+                if (isConnected) {
+                    g.OnClick_ToNext();
+                }
+                return isConnected;
+            };
+            BluetoothAim.ins.action_DoConnectInterceptor += action_DoConnectInterceptor;
+            g.action_OnDestroy += () => BluetoothAim.ins.action_DoConnectInterceptor -= action_DoConnectInterceptor;
         };
         configs.Add(config.key, config);
 

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

@@ -57,8 +57,12 @@ public class BluetoothAim : MonoBehaviour
 
     private bool userDoConnect = false;
     private bool doConnect = false;
+    public Func<bool> action_DoConnectInterceptor;
     public void DoConnect()
     {
+        if (action_DoConnectInterceptor != null) {
+            if (action_DoConnectInterceptor.Invoke()) return;
+        }
         if (status == BluetoothStatusEnum.Connect)
         {
             userDoConnect = true;