Пример #1
0
        //配置
        internal override void Alignment(Utage.Alignment alignment, AdvGraphicInfo graphic)
        {
            RectTransform t = this.transform as RectTransform;

            t.pivot = graphic.Pivot;
            if (alignment == Utage.Alignment.None)
            {
                //アラインメイント指定なし
                t.anchoredPosition = graphic.Position;
                Vector3 local = t.localPosition;
                local.z         = graphic.Position.z;
                t.localPosition = local;
                return;
            }
            //アラインメイントから、アンカーの値を取得
            Vector2 alignmentValue = AlignmentUtil.GetAlignmentValue(alignment);

            t.anchorMin = t.anchorMax = alignmentValue;

            //アラインメントする際の座標値オフセット
            Vector3 offset1 = t.pivot - alignmentValue;

            offset1.Scale(t.GetSizeScaled());
            //アンカーとピボットを考慮したポジション設定
            {
                Vector3 tmp = graphic.Position + offset1;
                t.anchoredPosition = tmp;
                Vector3 local = t.localPosition;
                local.z         = tmp.z;
                t.localPosition = local;
            }
        }
Пример #2
0
        internal override void Alignment(Utage.Alignment alignment, AdvGraphicInfo graphic)
        {
            RectTransform t = base.get_transform() as RectTransform;

            t.set_pivot(graphic.Pivot);
            if (alignment == Utage.Alignment.None)
            {
                t.set_anchoredPosition(graphic.Position);
            }
            else
            {
                Vector2 alignmentValue = AlignmentUtil.GetAlignmentValue(alignment);
                Vector2 vector2        = alignmentValue;
                t.set_anchorMax(vector2);
                t.set_anchorMin(vector2);
                Vector3 vector3 = t.get_pivot() - alignmentValue;
                vector3.Scale(t.GetSizeScaled());
                t.set_anchoredPosition(graphic.Position + vector3);
            }
        }