소스 검색

1.修复部分游戏兼容bug
2.调整红外流程,看是否改善app体验
3.修复部分问题

slambb 1 년 전
부모
커밋
4a6dbc1fb8

+ 1 - 1
Assets/BowArrow/InfraredCamera/Resources/InfraredDemo.prefab

@@ -12018,7 +12018,7 @@ MonoBehaviour:
     m_HorizontalOverflow: 1
     m_VerticalOverflow: 1
     m_LineSpacing: 1
-  m_Text: 111111111111111111111
+  m_Text: 
 --- !u!1 &8641488715208830917
 GameObject:
   m_ObjectHideFlags: 0

+ 2 - 2
Assets/BowArrow/Resources/Prefabs/Views/Home/DeviceView.prefab

@@ -5899,7 +5899,7 @@ MonoBehaviour:
       m_Calls: []
   m_Sprite: {fileID: 21300000, guid: 949e587f5d66ef34991584ba568ec12e, type: 3}
   m_Type: 0
-  m_PreserveAspect: 0
+  m_PreserveAspect: 1
   m_FillCenter: 1
   m_FillMethod: 4
   m_FillAmount: 1
@@ -6741,7 +6741,7 @@ MonoBehaviour:
       m_Calls: []
   m_Sprite: {fileID: 21300000, guid: 949e587f5d66ef34991584ba568ec12e, type: 3}
   m_Type: 0
-  m_PreserveAspect: 0
+  m_PreserveAspect: 1
   m_FillCenter: 1
   m_FillMethod: 4
   m_FillAmount: 1

+ 0 - 1
Assets/BowArrow/Resources/Prefabs/Views/Home/DeviceViewCopy.prefab

@@ -3038,7 +3038,6 @@ MonoBehaviour:
   smartArcheryButtons: []
   smartArcheryBg: []
   deviceViewItems: []
-  selectIndex: 0
 --- !u!1 &8677266362722324691
 GameObject:
   m_ObjectHideFlags: 0

+ 5 - 29
Assets/BowArrow/Resources/Textures/GameIcon/Prefabs/Views/Home/HomeView.prefab

@@ -1031,19 +1031,7 @@ MonoBehaviour:
   m_TargetGraphic: {fileID: 0}
   m_OnClick:
     m_PersistentCalls:
-      m_Calls:
-      - m_Target: {fileID: 6026167828061949870}
-        m_TargetAssemblyTypeName: HomeView_TopBarView, Assembly-CSharp
-        m_MethodName: onChangeType
-        m_Mode: 3
-        m_Arguments:
-          m_ObjectArgument: {fileID: 0}
-          m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
-          m_IntArgument: 1
-          m_FloatArgument: 0
-          m_StringArgument: 
-          m_BoolArgument: 0
-        m_CallState: 2
+      m_Calls: []
 --- !u!114 &6262855779688388639
 MonoBehaviour:
   m_ObjectHideFlags: 0
@@ -4844,9 +4832,9 @@ RectTransform:
   m_Father: {fileID: 3890223726825215840}
   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: 16, y: -20}
+  m_AnchorMin: {x: 0, y: 0}
+  m_AnchorMax: {x: 0, y: 0}
+  m_AnchoredPosition: {x: 16, y: 0}
   m_SizeDelta: {x: 0, y: 38}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!222 &5099759915330397004
@@ -11233,19 +11221,7 @@ MonoBehaviour:
   m_TargetGraphic: {fileID: 0}
   m_OnClick:
     m_PersistentCalls:
-      m_Calls:
-      - m_Target: {fileID: 6026167828061949870}
-        m_TargetAssemblyTypeName: HomeView_TopBarView, Assembly-CSharp
-        m_MethodName: onChangeType
-        m_Mode: 3
-        m_Arguments:
-          m_ObjectArgument: {fileID: 0}
-          m_ObjectArgumentAssemblyTypeName: UnityEngine.Object, UnityEngine
-          m_IntArgument: 0
-          m_FloatArgument: 0
-          m_StringArgument: 
-          m_BoolArgument: 0
-        m_CallState: 2
+      m_Calls: []
 --- !u!114 &3633861494589275952
 MonoBehaviour:
   m_ObjectHideFlags: 0

+ 2 - 2
Assets/BowArrow/Scripts/Bluetooth/AimHandler.cs

@@ -372,9 +372,9 @@ public class AimDeviceInfos
 
     #region 获取一个连接的设备下,对应的 Archery 是运行9轴的代码处理位置信息判断
     public bool bRuning9Axis() {
-        bool bRuning = false;
         //连接的设备下,对应的 Archery 是运行9轴的代码处理位置信息判断
-        bRuning = GlobalData.MyDeviceMode == DeviceMode.Archery;
+        //弓箭类型,但是不是HOUYI Pro 情况下。运行9轴代码
+        bool bRuning = GlobalData.MyDeviceMode == DeviceMode.Archery && !BluetoothAim.ins.isMainConnectToHOUYIPRO();
         return bRuning;
     }
     #endregion

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

@@ -11,7 +11,7 @@ using SmartBowSDK;
 public class BluetoothAim : MonoBehaviour
 {
     #region 弓箭蓝牙模块基本信息
-    readonly string targetDeviceName = "Bbow_20210501 | HOUYI Pro";
+    readonly string targetDeviceName = "Bbow_20210501 | HOUYI Pro | Pistol";
     readonly string targetDeviceNameHOUYIPro = "HOUYI Pro";
     string targetDeviceService
     {
@@ -258,6 +258,8 @@ public class BluetoothAim : MonoBehaviour
                 Log("连接成功\n" + helper.getDeviceName());
                 SetStatus(BluetoothStatusEnum.ConnectSuccess);
 
+                SetMainConnectDeviceType();
+
                 if (connectCanceled) {
                     Debug.Log("ble connectCanceled");
                     DoConnect();
@@ -1108,5 +1110,27 @@ public class BluetoothAim : MonoBehaviour
 
     }
     #endregion
-
+    
+    /// <summary>
+    /// 设置设备类型
+    /// </summary>
+    public void SetMainConnectDeviceType() {
+        //1号玩家连接蓝牙成功时候,设置一次 GlobalData.MyDeviceMode 
+        foreach (AimDeviceInfo p in AimHandler.ins.aimDeviceInfos.arry)
+        {
+            if ((int)BluetoothPlayer.FIRST_PLAYER == p.id)
+            {
+                if (p.type == (int)AimDeviceType.Gun)
+                {
+                    //设置枪
+                    HomeView.ins.MyTopBarView.onChangeType(1);
+                }
+                else
+                {
+                    //其余默认是弓箭
+                    HomeView.ins.MyTopBarView.onChangeType(0);
+                }
+            }
+        }
+    }
 }

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

@@ -297,7 +297,10 @@ public class Arrow : MonoBehaviour
             outputSyncData.SetData(this);
         }
     }
-
+    IEnumerator delayFlyTimeOut() {
+        yield return new WaitForSeconds(0.8f);//gun_shoot 音频长度
+        FlyTimeOut();
+    }
     void FlyTimeOut()
     {
         Destroy(gameObject);
@@ -405,7 +408,12 @@ public class Arrow : MonoBehaviour
         }
         else if (raycastHit.transform.GetComponent<TargetOutBound>())
         { //撞到空气墙当作超时处理
-            FlyTimeOut();
+
+            if (GlobalData.MyDeviceMode == DeviceMode.Archery)
+                FlyTimeOut();
+            else
+                StartCoroutine(delayFlyTimeOut());
+
         }
         else
         {

+ 1 - 1
Assets/BowArrow/Scripts/GlobalData.cs

@@ -24,7 +24,7 @@ public class GlobalData
     public static int singlePlayerGameType;
 
     //模式类型,区分设备
-    public static DeviceMode MyDeviceMode { get; set; } = DeviceMode.Gun;// DeviceMode.Gun;
+    public static DeviceMode MyDeviceMode { get; set; } = DeviceMode.Archery;// DeviceMode.Gun;
 
 }
 /**接收别人的PK邀请时,会设置GlobalData的数据,如果这时候主页存在层级页面,接收PK邀请但又突然要返回,

+ 3 - 3
Assets/BowArrow/Scripts/View/Home/DeviceView.cs

@@ -124,17 +124,17 @@ public class DeviceView : JCUnityLib.ViewBase, MenuBackInterface
             //进入选中的页面
             AudioMgr.ins.PlayBtn();
             //设置一次 GlobalData.MyDeviceMode 
-            HomeView.ins.MyTopBarView.onChangeType(index);
+            //HomeView.ins.MyTopBarView.onChangeType(index);
             if (getEnabelPanelStatus())
             {
                 //取消正在连接的连接
                 BluetoothAim.ins.onCancelAllConnecting(BluetoothStatusEnum.Connect);
 
-                if (GlobalData.MyDeviceMode == DeviceMode.Archery)
+                if (index == 0)
                 {
                     ViewMgr.Instance.ShowView<SmartArcheryView>();
                 }
-                else if (GlobalData.MyDeviceMode == DeviceMode.Gun)
+                else if (index == 1)
                 {
                     Debug.Log("Gun");
                     ViewMgr.Instance.ShowView<SmartGunView>();

BIN
Assets/BowArrow/Textures/Device/gun.png


+ 4 - 0
Assets/InfraredProject/WebCamera/Script/ZIM/ScreenLocate.cs

@@ -353,6 +353,10 @@ public partial class ScreenLocate : MonoBehaviour
             //infraredLocate.SetBrightnessThreshold(redfilterValue);     // 参数是 红外灯的亮度阈值,阈值越小能够检测到的亮度就越低,默认值是0.93
         }
 
+        //如果是9轴不进行识别
+        if (AimHandler.ins && AimHandler.ins.bRuning9Axis()) return;
+
+
         if (screenIdentification.Screen.RefreshCameraSize(getUVCCameraInfoSize))       // 同步分辨率, 分辨率变化后还需同步到InfraredDemo
         {
             quadUnityVectorList = screenIdentification.Screen.QuadInCamera.GetUnityVertexList();

+ 2 - 1
Assets/Plugins/Android/AndroidManifest.xml

@@ -55,7 +55,8 @@
 				<action android:name="com.hpplay.source.service.close" />
 			</intent-filter>
 		</receiver>
-
+		
+		<activity android:name="com.serenegiant.uvcplugin.UsbPermissionActivity" tools:node="remove"/>
 		<!-- <activity android:name="com.serenegiant.uvcplugin.UsbPermissionActivity" tools:node="remove"/> -->
 	</application>
 

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

@@ -74,6 +74,7 @@ public class ConnectGuidanceView : MonoBehaviour
             if (bowStatus == BluetoothStatusEnum.ConnectSuccess)
             {
                 AimHandler.ins.OnSaveAimDeviceInfos();
+                BluetoothAim.ins.SetMainConnectDeviceType();
                 if (AimHandler.ins.aimDeviceInfo.type != (int)AimDeviceType.HOUYIPRO && AimHandler.ins.aimDeviceInfo.type != (int)AimDeviceType.Gun)
                 {
                     //如果不是红外设备,才进入校准?
@@ -96,6 +97,7 @@ public class ConnectGuidanceView : MonoBehaviour
             if (bowStatus2P == SmartBowSDK.BluetoothStatusEnum.Connected)
             {
                 AimHandler.ins.OnSaveAimDeviceInfos();
+                BluetoothAim.ins.SetMainConnectDeviceType();
                 if (AimHandler.ins.aimDeviceInfo.type != (int)AimDeviceType.HOUYIPRO && AimHandler.ins.aimDeviceInfo.type != (int)AimDeviceType.Gun)
                 {
                     //如果不是红外设备,才进入校准?

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

@@ -112,15 +112,15 @@ public class InfraredScreenPositioningView : JCUnityLib.ViewBase
         //});
         //slider.value = InfraredDemo._ins.brightness.Get();
         //修改分辨率。是否清晰一点?
-        DefaultResolutionIndex = InfraredDemo._ins?.ResolutionIndex ?? 0;
-        Debug.Log("[InfraredScreenPositioningView]开始记录进入时候的分辨率:" + DefaultResolutionIndex);
-        InfraredDemo._ins?.SetResolutionNew(ScreenLocate.Main.HighScreenLocateResolutionIndex);
+        //DefaultResolutionIndex = InfraredDemo._ins?.ResolutionIndex ?? 0;
+        //Debug.Log("[InfraredScreenPositioningView]开始记录进入时候的分辨率:" + DefaultResolutionIndex);
+        //InfraredDemo._ins?.SetResolutionNew(ScreenLocate.Main.HighScreenLocateResolutionIndex);
     }
 
     private void OnDestroy()
     {
         //修改回进入手动调节页面时候的分辨率
-        InfraredDemo._ins?.SetResolutionNew(DefaultResolutionIndex);
+        //InfraredDemo._ins?.SetResolutionNew(DefaultResolutionIndex);
     }
 
     void Update()