Exemple #1
0
        public static void SetAnchor(this RT src, Anchor allign, int offsetX = 0, int offsetY = 0)
        {
            src.anchoredPosition = new Vector3(offsetX, offsetY, 0);
            switch (allign)
            {
            case (Anchor.TopLeft): src.AnchorPoint(0.0f, 1.0f); break;

            case (Anchor.TopCenter): src.AnchorPoint(0.5f, 1.0f); break;

            case (Anchor.TopRight): src.AnchorPoint(1.0f, 1.0f); break;

            case (Anchor.MiddleLeft): src.AnchorPoint(0.0f, 0.5f); break;

            case (Anchor.MiddleCenter): src.AnchorPoint(0.5f, 0.5f); break;

            case (Anchor.MiddleRight): src.AnchorPoint(1.0f, 0.5f); break;

            case (Anchor.BottomLeft): src.AnchorPoint(0.0f, 0.0f); break;

            case (Anchor.BottonCenter): src.AnchorPoint(0.5f, 0.0f); break;

            case (Anchor.BottomRight): src.AnchorPoint(1.0f, 0.0f); break;

            case (Anchor.HorStretchTop): src.AnchorStretchX(1.0f); break;

            case (Anchor.HorStretchMiddle): src.AnchorStretchX(0.5f); break;

            case (Anchor.HorStretchBottom): src.AnchorStretchX(0.0f); break;

            case (Anchor.VertStretchLeft): src.AnchorStretchY(0.0f); break;

            case (Anchor.VertStretchCenter): src.AnchorStretchY(0.5f); break;

            case (Anchor.VertStretchRight): src.AnchorStretchY(1.0f); break;

            case (Anchor.StretchAll): src.AnchorStretch(); break;
            }
        }