private void GenerateSlicedSprite(VertexHelper toFill)
{
if (!this.hasBorder)
{
this.GenerateSimpleSprite(toFill, false);
}
else
{
Vector4 outerUV;
Vector4 innerUV;
Vector4 padding;
Vector4 border;
if (this.activeSprite != null)
{
outerUV = DataUtility.GetOuterUV(this.activeSprite);
innerUV = DataUtility.GetInnerUV(this.activeSprite);
padding = DataUtility.GetPadding(this.activeSprite);
border = this.activeSprite.border;
}
else
{
outerUV = Vector4.zero;
innerUV = Vector4.zero;
padding = Vector4.zero;
border = Vector4.zero;
}
Rect pixelAdjustedRect = base.GetPixelAdjustedRect();
Vector4 adjustedBorders = this.GetAdjustedBorders((Vector4) (border / this.pixelsPerUnit), pixelAdjustedRect);
padding = (Vector4) (padding / this.pixelsPerUnit);
s_VertScratch[0] = new Vector2(padding.x, padding.y);
s_VertScratch[3] = new Vector2(pixelAdjustedRect.width - padding.z, pixelAdjustedRect.height - padding.w);
s_VertScratch[1].x = adjustedBorders.x;
s_VertScratch[1].y = adjustedBorders.y;
s_VertScratch[2].x = pixelAdjustedRect.width - adjustedBorders.z;
s_VertScratch[2].y = pixelAdjustedRect.height - adjustedBorders.w;
for (int i = 0; i < 4; i++)
{
s_VertScratch[i].x += pixelAdjustedRect.x;
s_VertScratch[i].y += pixelAdjustedRect.y;
}
s_UVScratch[0] = new Vector2(outerUV.x, outerUV.y);
s_UVScratch[1] = new Vector2(innerUV.x, innerUV.y);
s_UVScratch[2] = new Vector2(innerUV.z, innerUV.w);
s_UVScratch[3] = new Vector2(outerUV.z, outerUV.w);
toFill.Clear();
for (int j = 0; j < 3; j++)
{
int index = j + 1;
for (int k = 0; k < 3; k++)
{
if ((this.m_FillCenter || (j != 1)) || (k != 1))
{
int num5 = k + 1;
AddQuad(toFill, new Vector2(s_VertScratch[j].x, s_VertScratch[k].y), new Vector2(s_VertScratch[index].x, s_VertScratch[num5].y), this.color, new Vector2(s_UVScratch[j].x, s_UVScratch[k].y), new Vector2(s_UVScratch[index].x, s_UVScratch[num5].y));
}
}
}
}
}