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); }
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); }