public void DrawRect(Rect vertRect, int lineSize, Color lineColor, Color fillColor, Color[] allColors)
{
if (lineSize == 0)
{
SetOneQuadMesh(new Rect(0, 0, vertRect.width, vertRect.height), new Rect(0, 0, 1, 1), fillColor, allColors);
}
else
{
Alloc(20);
Rect rect;
//left,right
rect = Rect.MinMaxRect(0, 0, lineSize, vertRect.height);
FillVerts(0, rect);
rect = Rect.MinMaxRect(vertRect.width - lineSize, 0, vertRect.width, vertRect.height);
FillVerts(4, rect);
//top, bottom
rect = Rect.MinMaxRect(lineSize, 0, vertRect.width - lineSize, lineSize);
FillVerts(8, rect);
rect = Rect.MinMaxRect(lineSize, vertRect.height - lineSize, vertRect.width - lineSize, vertRect.height);
FillVerts(12, rect);
//middle
rect = Rect.MinMaxRect(lineSize, lineSize, vertRect.width - lineSize, vertRect.height - lineSize);
FillVerts(16, rect);
rect = new Rect(0, 0, 1, 1);
int i;
for (i = 0; i < 5; i++)
FillUV(i * 4, rect);
Color32[] arr = this.colors;
if (allColors != null)
{
int colorCnt = allColors.Length;
for (i = 0; i < 20; i++)
arr[i] = allColors[i % colorCnt];
}
else
{
Color32 col32 = lineColor;
for (i = 0; i < 16; i++)
arr[i] = col32;
col32 = fillColor;
for (i = 16; i < 20; i++)
arr[i] = col32;
}
FillTriangles();
UpdateMesh();
}
}