Ejemplo n.º 1
0
        /// <summary>
        /// 绘制Sliced版
        /// </summary>
        /// <param name="output"></param>
        /// <param name="count"></param>
        protected void DrawSliced(List <UIVertex> output)
        {
            if (!hasBorder)
            {
                DrawSimple(output);
                return;
            }

            Rect    rect   = GetPixelAdjustedRect();
            Vector4 border = overrideSprite.border / pixelsPerUnit;

            switch (m_MirrorType)
            {
            case MirrorType.Horizontal:
                VertexUtility.MirrorSliced(output, rect, border, true);
                break;

            case MirrorType.Vertical:
                VertexUtility.MirrorSliced(output, rect, border, false);
                break;

            case MirrorType.Quarter:
                VertexUtility.MirrorSliced(output, rect, border, true);
                VertexUtility.MirrorSliced(output, rect, border, false);
                break;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 绘制简单版
        /// </summary>
        /// <param name="output"></param>
        /// <param name="count"></param>
        protected void DrawSimple(List <UIVertex> output)
        {
            Rect rect = GetPixelAdjustedRect();

            //先缩放原顶点
            switch (m_MirrorType)
            {
            case MirrorType.Horizontal:
                VertexUtility.MirrorSample(output, rect, true);
                break;

            case MirrorType.Vertical:
                VertexUtility.MirrorSample(output, rect, false);
                break;

            case MirrorType.Quarter:
                VertexUtility.MirrorSample(output, rect, true);
                VertexUtility.MirrorSample(output, rect, false);
                break;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// 绘制Sliced版
        /// </summary>
        /// <param name="output"></param>
        /// <param name="count"></param>
        protected void DrawTiled(List <UIVertex> output)
        {
            Rect rect = GetPixelAdjustedRect();
            //此处使用inner是因为Image绘制Tiled时,会把透明区域也绘制了。
            Vector4 inner = DataUtility.GetInnerUV(overrideSprite);
            Vector2 size  = new Vector2(overrideSprite.rect.width / pixelsPerUnit, overrideSprite.rect.height / pixelsPerUnit);

            switch (m_MirrorType)
            {
            case MirrorType.Horizontal:
                VertexUtility.DrawTiled(output, rect, inner, size, true);
                break;

            case MirrorType.Vertical:
                VertexUtility.DrawTiled(output, rect, inner, size, false);
                break;

            case MirrorType.Quarter:
                VertexUtility.DrawTiled(output, rect, inner, size, true);
                VertexUtility.DrawTiled(output, rect, inner, size, false);
                break;
            }
        }