override public void ModifyMesh(VertexHelper helper)
        {
            if (!Graphic || !(Graphic is EllipseGraphic) || Type == OutlineType.None)
            {
                return;
            }

            Rect rect;

            rect = Graphic.rectTransform.rect;

            if (GraphicUtil.IsEmpty(rect))
            {
                return;
            }

            List <UIVertex> verts;

            verts = ListPool <UIVertex> .Get();

            helper.GetUIVertexStream(verts);

            GraphicUtil.AddEllipseOutline(verts, rect, Color, Size, Type, 0, 360);

            helper.Clear();
            helper.AddUIVertexTriangleStream(verts);
            ListPool <UIVertex> .Put(verts);
        }
        override protected void OnPopulateMesh(VertexHelper helper)
        {
            Rect rect;

            rect = rectTransform.rect;

            if (Type == FillType.None || GraphicUtil.IsEmpty(rect))
            {
                helper.Clear();
                return;
            }

            List <UIVertex> verts;

            verts = ListPool <UIVertex> .Get();

            if (rect.height > rect.width)
            {
                GraphicUtil.AddEllipseFill(verts, new Rect(rect.x, rect.yMax - rect.width, rect.width, rect.width), color, Type, 0, 180);
                GraphicUtil.AddRectFill(verts, new Rect(rect.x, rect.y + rect.width * 0.5f, rect.width, rect.height - rect.width), color, Type);
                GraphicUtil.AddEllipseFill(verts, new Rect(rect.x, rect.yMin, rect.width, rect.width), color, Type, 180, 180);
            }
            else
            {
                GraphicUtil.AddEllipseFill(verts, new Rect(rect.xMin, rect.y, rect.height, rect.height), color, Type, 90, 180);
                GraphicUtil.AddRectFill(verts, new Rect(rect.x + rect.height * 0.5f, rect.y, rect.width - rect.height, rect.height), color, Type);
                GraphicUtil.AddEllipseFill(verts, new Rect(rect.xMax - rect.height, rect.y, rect.height, rect.height), color, Type, 270, 180);
            }

            helper.Clear();
            helper.AddUIVertexTriangleStream(verts);
            ListPool <UIVertex> .Put(verts);
        }
Beispiel #3
0
        override public void ModifyMesh(VertexHelper helper)
        {
            if (!Graphic || !(Graphic is RectangleGraphic) || Type == OutlineType.None)
            {
                return;
            }

            Rect rect;

            rect = Graphic.rectTransform.rect;

            if (GraphicUtil.IsEmpty(rect))
            {
                return;
            }

            float radius = (Graphic as RectangleGraphic).Radius;

            radius = Mathf.Min(radius, rect.width * 0.5f);
            radius = Mathf.Min(radius, rect.height * 0.5f);

            float size;

            size = radius * 2;

            List <UIVertex> verts;

            verts = ListPool <UIVertex> .Get();

            helper.GetUIVertexStream(verts);

            GraphicUtil.AddEllipseOutline(verts, new Rect(rect.xMin, rect.yMin, size, size), Color, Size, Type, 180, 90);
            GraphicUtil.AddEllipseOutline(verts, new Rect(rect.xMin, rect.yMax - size, size, size), Color, Size, Type, 90, 90);
            GraphicUtil.AddEllipseOutline(verts, new Rect(rect.xMax - size, rect.yMax - size, size, size), Color, Size, Type, 0, 90);
            GraphicUtil.AddEllipseOutline(verts, new Rect(rect.xMax - size, rect.yMin, size, size), Color, Size, Type, 270, 90);

            Rect horizontal = new Rect(rect.xMin, rect.yMin + radius, rect.width, rect.height - size);

            GraphicUtil.AddRectOutline(verts, horizontal, Color, Size, Type, EdgeType.Left);
            GraphicUtil.AddRectOutline(verts, horizontal, Color, Size, Type, EdgeType.Right);

            Rect vertical = new Rect(rect.xMin + radius, rect.yMin, rect.width - size, rect.height);

            GraphicUtil.AddRectOutline(verts, vertical, Color, Size, Type, EdgeType.Top);
            GraphicUtil.AddRectOutline(verts, vertical, Color, Size, Type, EdgeType.Bottom);

            helper.Clear();
            helper.AddUIVertexTriangleStream(verts);
            ListPool <UIVertex> .Put(verts);
        }
Beispiel #4
0
        override public void ModifyMesh(VertexHelper helper)
        {
            if (!Graphic || !(Graphic is CapsuleGraphic) || Type == OutlineType.None)
            {
                return;
            }

            Rect rect;

            rect = Graphic.rectTransform.rect;

            if (GraphicUtil.IsEmpty(rect))
            {
                return;
            }

            List <UIVertex> verts;

            verts = ListPool <UIVertex> .Get();

            helper.GetUIVertexStream(verts);

            if (rect.height > rect.width)
            {
                GraphicUtil.AddEllipseOutline(verts, new Rect(rect.x, rect.yMax - rect.width, rect.width, rect.width), Color, Size, Type, 0, 180);
                GraphicUtil.AddRectOutline(verts, new Rect(rect.x, rect.y + rect.width * 0.5f, rect.width, rect.height - rect.width), Color, Size, Type, EdgeType.Left);
                GraphicUtil.AddEllipseOutline(verts, new Rect(rect.x, rect.yMin, rect.width, rect.width), Color, Size, Type, 180, 180);
                GraphicUtil.AddRectOutline(verts, new Rect(rect.x, rect.y + rect.width * 0.5f, rect.width, rect.height - rect.width), Color, Size, Type, EdgeType.Right);
            }
            else
            {
                GraphicUtil.AddRectOutline(verts, new Rect(rect.xMin + rect.height * 0.5f, rect.y, rect.width - rect.height, rect.height), Color, Size, Type, EdgeType.Top);
                GraphicUtil.AddEllipseOutline(verts, new Rect(rect.xMin, rect.y, rect.height, rect.height), Color, Size, Type, 90, 180);
                GraphicUtil.AddRectOutline(verts, new Rect(rect.xMin + rect.height * 0.5f, rect.y, rect.width - rect.height, rect.height), Color, Size, Type, EdgeType.Bottom);
                GraphicUtil.AddEllipseOutline(verts, new Rect(rect.xMax - rect.height, rect.y, rect.height, rect.height), Color, Size, Type, 270, 180);
            }

            helper.Clear();
            helper.AddUIVertexTriangleStream(verts);
            ListPool <UIVertex> .Put(verts);
        }
        override protected void OnPopulateMesh(VertexHelper helper)
        {
            Rect rect;

            rect = rectTransform.rect;

            if (GraphicUtil.IsEmpty(rect) || Type == FillType.None)
            {
                helper.Clear();
                return;
            }

            float radius = Radius;

            radius = Mathf.Min(radius, rect.width * 0.5f);
            radius = Mathf.Min(radius, rect.height * 0.5f);

            float size;

            size = radius * 2;

            List <UIVertex> verts;

            verts = ListPool <UIVertex> .Get();

            GraphicUtil.AddEllipseFill(verts, new Rect(rect.xMin, rect.yMin, size, size), color, Type, 180, 90);
            GraphicUtil.AddEllipseFill(verts, new Rect(rect.xMin, rect.yMax - size, size, size), color, Type, 90, 90);
            GraphicUtil.AddEllipseFill(verts, new Rect(rect.xMax - size, rect.yMax - size, size, size), color, Type, 0, 90);
            GraphicUtil.AddEllipseFill(verts, new Rect(rect.xMax - size, rect.yMin, size, size), color, Type, 270, 90);


            GraphicUtil.AddRectFill(verts, new Rect(rect.xMin, rect.yMin + radius, radius, rect.height - size), color, Type);
            GraphicUtil.AddRectFill(verts, new Rect(rect.xMin + radius, rect.yMin, rect.width - size, rect.height), color, Type);
            GraphicUtil.AddRectFill(verts, new Rect(rect.xMax - radius, rect.yMin + radius, radius, rect.height - size), color, Type);

            helper.Clear();
            helper.AddUIVertexTriangleStream(verts);
            ListPool <UIVertex> .Put(verts);
        }
        override protected void OnPopulateMesh(VertexHelper helper)
        {
            Rect rect;

            rect = rectTransform.rect;

            if (Type == FillType.None || GraphicUtil.IsEmpty(rect))
            {
                helper.Clear();
                return;
            }

            List <UIVertex> verts;

            verts = ListPool <UIVertex> .Get();

            GraphicUtil.AddEllipseFill(verts, rect, color, Type, 0, 360);

            helper.Clear();
            helper.AddUIVertexTriangleStream(verts);
            ListPool <UIVertex> .Put(verts);
        }