Răsfoiți Sursa

修改infrareddemo ui适配。

slambb 11 luni în urmă
părinte
comite
b3b9d47f6a

+ 12 - 1
Assets/BowArrow/InfraredCamera/InfraredDemo.cs

@@ -29,7 +29,18 @@ public class InfraredDemo  : JCUnityLib.ViewBase
         _ins = o.GetComponent<InfraredDemo>();
         //添加一个父物体
         o.transform.SetParent(ViewMgr.Instance.transform.Find("1").transform);
-        
+        CanvasScaler canvasScaler = o.GetComponent<CanvasScaler>();
+        if (canvasScaler != null)
+        {
+            Destroy(canvasScaler);
+        }
+        RectTransform rectTransform = o.GetComponent<RectTransform>();
+        rectTransform.anchorMin = Vector2.zero;      // 左下角对齐父级
+        rectTransform.anchorMax = Vector2.one;       // 右上角对齐父级
+        rectTransform.offsetMin = Vector2.zero;      // 移除左下角偏移
+        rectTransform.offsetMax = Vector2.zero;      // 移除右上角偏移
+        rectTransform.localScale = Vector3.one;      // 确保缩放为 1
+
         //直接初始化一次
         _ins.InitInfraredCamera();
     }

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

@@ -331,7 +331,7 @@ RectTransform:
   m_GameObject: {fileID: 228730771029954222}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
+  m_LocalScale: {x: 1.6000001, y: 1.6000001, z: 1.6000001}
   m_ConstrainProportionsScale: 1
   m_Children:
   - {fileID: 2794388562991103856}
@@ -342,7 +342,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 1}
   m_AnchorMax: {x: 0, y: 1}
-  m_AnchoredPosition: {x: 379.8, y: -240}
+  m_AnchoredPosition: {x: 613, y: -376}
   m_SizeDelta: {x: 759.6, y: 351}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!1 &384918576708627733
@@ -851,8 +851,8 @@ RectTransform:
   m_GameObject: {fileID: 656877043998522957}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
-  m_ConstrainProportionsScale: 0
+  m_LocalScale: {x: 2.22, y: 2.22, z: 2.22}
+  m_ConstrainProportionsScale: 1
   m_Children:
   - {fileID: 8378659089701326743}
   - {fileID: 2081588674167073364}
@@ -1654,15 +1654,15 @@ RectTransform:
   m_GameObject: {fileID: 1075113485597985407}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
-  m_ConstrainProportionsScale: 0
+  m_LocalScale: {x: 1.2, y: 1.2, z: 1.2}
+  m_ConstrainProportionsScale: 1
   m_Children: []
   m_Father: {fileID: 1011583018579085310}
   m_RootOrder: 2
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 0}
   m_AnchorMax: {x: 0, y: 0}
-  m_AnchoredPosition: {x: 370, y: 39}
+  m_AnchoredPosition: {x: 488, y: 40}
   m_SizeDelta: {x: 160, y: 30}
   m_Pivot: {x: 0, y: 0}
 --- !u!222 &7874301958488855308
@@ -8011,8 +8011,8 @@ MonoBehaviour:
   m_UiScaleMode: 1
   m_ReferencePixelsPerUnit: 100
   m_ScaleFactor: 1
-  m_ReferenceResolution: {x: 1280, y: 720}
-  m_ScreenMatchMode: 1
+  m_ReferenceResolution: {x: 2352, y: 1170}
+  m_ScreenMatchMode: 0
   m_MatchWidthOrHeight: 0
   m_PhysicalUnit: 3
   m_FallbackScreenDPI: 96
@@ -9879,8 +9879,8 @@ RectTransform:
   m_GameObject: {fileID: 6998082651894990693}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
-  m_ConstrainProportionsScale: 0
+  m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
+  m_ConstrainProportionsScale: 1
   m_Children:
   - {fileID: 6640709913130604220}
   m_Father: {fileID: 1011583018579085310}
@@ -10562,8 +10562,8 @@ RectTransform:
   m_GameObject: {fileID: 7688802554608819425}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1, y: 1, z: 1}
-  m_ConstrainProportionsScale: 0
+  m_LocalScale: {x: 1.3, y: 1.3, z: 1.3}
+  m_ConstrainProportionsScale: 1
   m_Children:
   - {fileID: 5590548844264795597}
   - {fileID: 4786761868314834373}
@@ -10573,7 +10573,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 0, y: 1}
   m_AnchorMax: {x: 0, y: 1}
-  m_AnchoredPosition: {x: 337, y: -571.8}
+  m_AnchoredPosition: {x: 424, y: -800}
   m_SizeDelta: {x: 640, y: 131.8}
   m_Pivot: {x: 0.5, y: 0.5}
 --- !u!114 &6109234558477219354
@@ -10967,8 +10967,8 @@ RectTransform:
   m_GameObject: {fileID: 7872086919795260368}
   m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
   m_LocalPosition: {x: 0, y: 0, z: 0}
-  m_LocalScale: {x: 1.5, y: 1.5, z: 1.5}
-  m_ConstrainProportionsScale: 0
+  m_LocalScale: {x: 2, y: 2, z: 2}
+  m_ConstrainProportionsScale: 1
   m_Children:
   - {fileID: 6803672146894341010}
   - {fileID: 1073504034428356603}
@@ -10978,7 +10978,7 @@ RectTransform:
   m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
   m_AnchorMin: {x: 1, y: 1}
   m_AnchorMax: {x: 1, y: 1}
-  m_AnchoredPosition: {x: -304.2, y: -30.000061}
+  m_AnchoredPosition: {x: -460, y: -30}
   m_SizeDelta: {x: 400, y: 90}
   m_Pivot: {x: 0.5, y: 1}
 --- !u!114 &5712777562971362670

+ 13 - 4
Assets/BowArrow/Scripts/Expand/AutoResetView.cs

@@ -59,12 +59,21 @@ public class AutoResetView : MonoBehaviour
     /// 引导页面弹出校准
     /// </summary>
     public static void onInfraredGuiderAutoResetView() {
-
-      AutoResetView autoResetView =  Instantiate(Resources.Load<GameObject>("Prefabs/Views/AutoResetView")).GetComponent<AutoResetView>();
-      autoResetView.bInfraredGuider = true;
-      autoResetView.infraredGuiderTime = GlobalData.MyDeviceMode == DeviceMode.Gun ? CommonConfig.calibrationTimeGun : CommonConfig.calibrationTimeArchery;
+        CreateResetViewPath("Prefabs/Views/AutoResetView");
+    }
+    /// <summary>
+    /// 带背景的校准
+    /// </summary>
+    public static void onInfraredGuiderAutoResetViewOrBg()
+    {
+        CreateResetViewPath("Prefabs/Views/AutoResetViewOrBg");
     }
 
+    static void CreateResetViewPath(string path) {
+        AutoResetView autoResetView = Instantiate(Resources.Load<GameObject>(path)).GetComponent<AutoResetView>();
+        autoResetView.bInfraredGuider = true;
+        autoResetView.infraredGuiderTime = GlobalData.MyDeviceMode == DeviceMode.Gun ? CommonConfig.calibrationTimeGun : CommonConfig.calibrationTimeArchery;
+    }
     /// <summary>
     /// 是否是引导
     /// </summary>

+ 4 - 0
Assets/BowArrow/Scripts/Manager/HomeMgr.cs

@@ -60,6 +60,10 @@ public class HomeMgr : MonoBehaviour
         }
         //红外界面
         InfraredDemo.Create();
+        //b端单机版创建一个DevicesHolder
+        if (CommonConfig.StandaloneModeOrPlatformB) {
+            DevicesHolder.Init();
+        }
     }
 
     void Start()

+ 16 - 1
Assets/SmartBow/Scripts/Views/SettingsViewParts/BoxUserSettings.cs

@@ -79,6 +79,19 @@ namespace CustomUIView
                 RenderSelectDevicesIndex(selectDevicesIndex);
 
                 //todo 调用串口后续流程?
+                switch (UserSettings.ins.selectDevicesName)
+                {
+                    case "ARTEMIS Pro":
+                        DevicesHolder.ins.SwitchDeviceByType(AimDeviceType.ARTEMISPRO);
+                        break;
+                    case "Pistol M9":
+                        DevicesHolder.ins.SwitchDeviceByType(AimDeviceType.Gun);
+                        break;
+                    case "HOUYI Pro":
+                        DevicesHolder.ins.SwitchDeviceByType(AimDeviceType.HOUYIPRO);
+                        break;
+                }
+             
             }
         }
 
@@ -98,8 +111,10 @@ namespace CustomUIView
 
         public void OnClick_EnterInfraredCenterCalibration()
         {
+            //弹出校准提示
+            AutoResetView.onInfraredGuiderAutoResetViewOrBg();
             //红外设备校准偏离点
-            InfraredDemo._ins?.OnClick_SetAdjustPointsOffset();
+            //InfraredDemo._ins?.OnClick_SetAdjustPointsOffset();
 
         }
         public void OnClick_ScreenCalibration()