Beispiel #1
0
    /// <summary>
    /// change transformation of vti_textOptions in dependence of the current alignment to avoid shifts
    /// </summary>
    /// <param name="layout">Layout.</param>
    void TransformTxt(int layout)
    {
        float step      = 0.25f * Mathf.Abs(old_headingValue - layout);
        int   direction = 0;

        if (old_headingValue < layout)
        {
            direction = -1;
        }
        else
        {
            direction = 1;
        }
        float boundX = (vti_textOptions.GetBounds().size.x) * step * direction;

        vti_textOptions.transform.localPosition = new Vector3(vti_textOptions.transform.localPosition.x - (boundX),
                                                              vti_textOptions.transform.localPosition.y,
                                                              vti_textOptions.transform.localPosition.z);
        old_headingValue = layout;
    }
        /// <summary>
        /// change transformation of vti_textOptions in dependence of the current alignment to avoid shifts
        /// </summary>
        /// <param name="layout">Layout.</param>
        void TransformTxt(VTextLayout.align alignment)
        {
            float width = vti_textOptions.GetBounds().size.x;

            switch (alignment)
            {
            case VTextLayout.align.Base:
            case VTextLayout.align.Start:
            case VTextLayout.align.Block:
                vti_textOptions.transform.localPosition = new Vector3(-width * 0.25f, vti_textOptions.transform.localPosition.y, vti_textOptions.transform.localPosition.z);
                break;

            case VTextLayout.align.Center:
                vti_textOptions.transform.localPosition = Vector3.zero;
                break;

            case VTextLayout.align.End:
                vti_textOptions.transform.localPosition = new Vector3(width * 0.25f, vti_textOptions.transform.localPosition.y, vti_textOptions.transform.localPosition.z);
                break;
            }
        }