コード例 #1
0
 public void ResizeWidgetSize()
 {
     if (null != this.coverSafeArea)
     {
         UIWidget component = base.GetComponent <UIWidget>();
         if (null != component)
         {
             UICoverSafeArea.AnchorPoint anchorPoint = this.coverSafeArea.GetAnchorPoint();
             component.leftAnchor.Set(0f, anchorPoint.left);
             component.rightAnchor.Set(1f, anchorPoint.right);
             component.topAnchor.Set(1f, anchorPoint.top);
             component.bottomAnchor.Set(0f, anchorPoint.bottom);
         }
     }
 }
コード例 #2
0
        private void Awake()
        {
            UIWidget component = base.GetComponent <UIWidget>();

            if (null != component)
            {
                this.coverSafeArea = UnityEngine.Object.FindObjectOfType <UICoverSafeArea>();
                if (null != this.coverSafeArea)
                {
                    Transform transform  = base.transform;
                    Vector3   localScale = transform.localScale;
                    transform.parent     = this.coverSafeArea.transform;
                    transform.localScale = localScale;
                    UICoverSafeArea.AnchorPoint anchorPoint = this.coverSafeArea.GetAnchorPoint();
                    component.SetAnchor(this.coverSafeArea.gameObject, Mathf.CeilToInt(anchorPoint.left), Mathf.CeilToInt(anchorPoint.bottom), Mathf.CeilToInt(anchorPoint.right), Mathf.CeilToInt(anchorPoint.top));
                    component.updateAnchors = UIRect.AnchorUpdate.OnUpdate;
                }
            }
        }
コード例 #3
0
 private void Awake()
 {
     this.margin         = default(UICoverSafeArea.SafeAreaMargin);
     this.gameScreenSize = default(Vector2);
     this.anchorPoint    = default(UICoverSafeArea.AnchorPoint);
 }