Explorar o código

隐私政策页面适配safearea

lvjincheng %!s(int64=3) %!d(string=hai) anos
pai
achega
8c5741de6e

+ 1 - 1
Assets/BowArrow/Resources/Prefabs/Views/AgreementView.prefab

@@ -302,7 +302,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: 30, y: -12.5}
+  m_AnchoredPosition: {x: 40, y: -12.5}
   m_SizeDelta: {x: 39, y: 35}
   m_Pivot: {x: 0, y: 1}
 --- !u!222 &4967192984587452001

+ 12 - 0
Assets/BowArrow/Scripts/Manager/LoginMgr/AgreementView.cs

@@ -3,12 +3,24 @@ using System.Collections.Generic;
 using UnityEngine;
 using UnityEngine.UI;
 using UnityEngine.Networking;
+using JCUnityLib;
 /* 界面-用户协议和隐私政策 */
 public class AgreementView : MonoBehaviour, MenuBackInterface
 {
     void Start()
     {
         PersistenHandler.ins?.menuBackCtr.views.Add(this);
+        AdaptSafeArea(transform.Find("ScrollView").transform as RectTransform);
+    }
+    void AdaptSafeArea(RectTransform rtf)
+    {
+        float offsetX = Screen.width - Screen.safeArea.width;
+        Vector2 offset = RectTransformUtils.ScreenV3ToCanvasV3(Vector3.right * offsetX, rtf);
+        if (rtf.anchorMin.x == 0 && rtf.anchorMax.x == 1)
+        {
+            rtf.offsetMin = rtf.offsetMin + offset;
+            rtf.offsetMax = rtf.offsetMax - offset;
+        }
     }
     void OnDestroy()
     {