示例#1
0
    private void UpdateHorizontal(List <Transform> list, eMyPivot pivot, float width, bool anismooth)
    {
        float   x     = width * (list.Count - 1) / 2;
        Vector3 pos   = -Vector3.right * x;
        float   delta = width;

        switch (pivot)
        {
        case eMyPivot.TopLeft: pos = Vector3.zero; break;

        case eMyPivot.Top: break;

        case eMyPivot.TopRight: pos = Vector3.zero; delta = -width; break;

        case eMyPivot.Left: pos = Vector3.zero; break;

        case eMyPivot.Center: break;

        case eMyPivot.Right: pos = Vector3.zero; delta = -width; break;

        case eMyPivot.BottomLeft: break;

        case eMyPivot.Bottom: pos = Vector3.zero; break;

        case eMyPivot.BottomRight: pos = Vector3.zero; delta = -width; break;
        }


        for (int i = 0, count = list.Count; i < count; i++)
        {
            UpdatePostion(list[i], pos, anismooth);
            pos += Vector3.right * delta;
        }
    }
示例#2
0
    private void UpdateVertical(List <Transform> list, eMyPivot pivot, float height, bool anismooth)
    {
        float   y     = -height * (list.Count - 1) / 2;
        Vector3 pos   = Vector3.up * y;
        float   delta = height;

        switch (pivot)
        {
        case eMyPivot.TopLeft: pos = Vector3.zero; delta = -height; break;

        case eMyPivot.Top: pos = Vector3.zero; delta = -height; break;

        case eMyPivot.TopRight:; pos = Vector3.zero; delta = -height; break;

        case eMyPivot.Left: break;

        case eMyPivot.Center: break;

        case eMyPivot.Right: break;

        case eMyPivot.BottomLeft: pos = Vector3.zero; break;

        case eMyPivot.Bottom: pos = Vector3.zero; break;

        case eMyPivot.BottomRight: pos = Vector3.zero; break;
        }

        for (int i = 0, count = list.Count; i < count; i++)
        {
            UpdatePostion(list[i], pos, anismooth);
            pos += Vector3.up * delta;
        }
    }
示例#3
0
    public void OnReposition(List <Transform> list, eMyArrangement arr, eMyPivot pivot, float width, bool anismooth = false)
    {
        switch (arr)
        {
        case eMyArrangement.Horizontal: UpdateHorizontal(list, pivot, width, anismooth); break;

        case eMyArrangement.Vertical: UpdateVertical(list, pivot, width, anismooth); break;
        }
    }