UnityEngine.RectTransform.SetInsetAndSizeFromParentEdge C# (CSharp) Method

SetInsetAndSizeFromParentEdge() public method

public SetInsetAndSizeFromParentEdge ( System.Edge edge, float inset, float size ) : void
edge System.Edge
inset float
size float
return void
        public void SetInsetAndSizeFromParentEdge(Edge edge, float inset, float size)
        {
            int num = ((edge != Edge.Top) && (edge != Edge.Bottom)) ? 0 : 1;
            bool flag = (edge == Edge.Top) || (edge == Edge.Right);
            float num2 = !flag ? ((float) 0) : ((float) 1);
            Vector2 anchorMin = this.anchorMin;
            anchorMin[num] = num2;
            this.anchorMin = anchorMin;
            anchorMin = this.anchorMax;
            anchorMin[num] = num2;
            this.anchorMax = anchorMin;
            Vector2 sizeDelta = this.sizeDelta;
            sizeDelta[num] = size;
            this.sizeDelta = sizeDelta;
            Vector2 anchoredPosition = this.anchoredPosition;
            anchoredPosition[num] = !flag ? (inset + (size * this.pivot[num])) : (-inset - (size * (1f - this.pivot[num])));
            this.anchoredPosition = anchoredPosition;
        }

Usage Example

コード例 #1
0
ファイル: MerchantScaler.cs プロジェクト: Pycorax/SP4Unity
    // Use this for initialization
    void Start()
    {
        // Initialize the Component
        rectTransform = GetComponent<RectTransform>();

        if (Math.Abs(Camera.main.aspect - 16.0f / 9.0f) < 0.1f)
        {
            rectTransform.SetInsetAndSizeFromParentEdge(RectTransform.Edge.Bottom, Offset169.y, rectTransform.rect.height);
        }
    }
All Usage Examples Of UnityEngine.RectTransform::SetInsetAndSizeFromParentEdge