private static bool RadialCut(Vector2[] xy, Vector2[] uv, float fill, bool invert, int corner) { if (fill < 0.001f) { return(false); } if ((corner & 1) == 1) { invert = !invert; } if (!invert && fill > 0.999f) { return(true); } float num = Mathf.Clamp01(fill); if (invert) { num = 1f - num; } num *= 1.57079637f; float cos = Mathf.Cos(num); float sin = Mathf.Sin(num); UIBasicSprite.RadialCut(xy, cos, sin, invert, corner); UIBasicSprite.RadialCut(uv, cos, sin, invert, corner); return(true); }
private static Boolean RadialCut(Vector2[] xy, Vector2[] uv, Single fill, Boolean invert, Int32 corner) { if (fill < 0.001f) { return(false); } if ((corner & 1) == 1) { invert = !invert; } if (!invert && fill > 0.999f) { return(true); } Single num = Mathf.Clamp01(fill); if (invert) { num = 1f - num; } num *= 1.57079637f; Single cos = Mathf.Cos(num); Single sin = Mathf.Sin(num); UIBasicSprite.RadialCut(xy, cos, sin, invert, corner); UIBasicSprite.RadialCut(uv, cos, sin, invert, corner); return(true); }
private void FilledFill(BetterList <Vector3> verts, BetterList <Vector2> uvs, BetterList <Color32> cols) { if (this.mFillAmount < 0.001f) { return; } Vector4 drawingDimensions = this.drawingDimensions; Vector4 drawingUVs = this.drawingUVs; Color32 drawingColor = this.drawingColor; if (this.mFillDirection == UIBasicSprite.FillDirection.Horizontal || this.mFillDirection == UIBasicSprite.FillDirection.Vertical) { if (this.mFillDirection == UIBasicSprite.FillDirection.Horizontal) { float num = (drawingUVs.z - drawingUVs.x) * this.mFillAmount; if (this.mInvert) { drawingDimensions.x = drawingDimensions.z - (drawingDimensions.z - drawingDimensions.x) * this.mFillAmount; drawingUVs.x = drawingUVs.z - num; } else { drawingDimensions.z = drawingDimensions.x + (drawingDimensions.z - drawingDimensions.x) * this.mFillAmount; drawingUVs.z = drawingUVs.x + num; } } else if (this.mFillDirection == UIBasicSprite.FillDirection.Vertical) { float num2 = (drawingUVs.w - drawingUVs.y) * this.mFillAmount; if (this.mInvert) { drawingDimensions.y = drawingDimensions.w - (drawingDimensions.w - drawingDimensions.y) * this.mFillAmount; drawingUVs.y = drawingUVs.w - num2; } else { drawingDimensions.w = drawingDimensions.y + (drawingDimensions.w - drawingDimensions.y) * this.mFillAmount; drawingUVs.w = drawingUVs.y + num2; } } } UIBasicSprite.mTempPos[0] = new Vector2(drawingDimensions.x, drawingDimensions.y); UIBasicSprite.mTempPos[1] = new Vector2(drawingDimensions.x, drawingDimensions.w); UIBasicSprite.mTempPos[2] = new Vector2(drawingDimensions.z, drawingDimensions.w); UIBasicSprite.mTempPos[3] = new Vector2(drawingDimensions.z, drawingDimensions.y); UIBasicSprite.mTempUVs[0] = new Vector2(drawingUVs.x, drawingUVs.y); UIBasicSprite.mTempUVs[1] = new Vector2(drawingUVs.x, drawingUVs.w); UIBasicSprite.mTempUVs[2] = new Vector2(drawingUVs.z, drawingUVs.w); UIBasicSprite.mTempUVs[3] = new Vector2(drawingUVs.z, drawingUVs.y); if (this.mFillAmount < 1f) { if (this.mFillDirection == UIBasicSprite.FillDirection.Radial90) { if (UIBasicSprite.RadialCut(UIBasicSprite.mTempPos, UIBasicSprite.mTempUVs, this.mFillAmount, this.mInvert, 0)) { for (int i = 0; i < 4; i++) { verts.Add(UIBasicSprite.mTempPos[i]); uvs.Add(UIBasicSprite.mTempUVs[i]); cols.Add(drawingColor); } } return; } if (this.mFillDirection == UIBasicSprite.FillDirection.Radial180) { for (int j = 0; j < 2; j++) { float t = 0f; float t2 = 1f; float t3; float t4; if (j == 0) { t3 = 0f; t4 = 0.5f; } else { t3 = 0.5f; t4 = 1f; } UIBasicSprite.mTempPos[0].x = Mathf.Lerp(drawingDimensions.x, drawingDimensions.z, t3); UIBasicSprite.mTempPos[1].x = UIBasicSprite.mTempPos[0].x; UIBasicSprite.mTempPos[2].x = Mathf.Lerp(drawingDimensions.x, drawingDimensions.z, t4); UIBasicSprite.mTempPos[3].x = UIBasicSprite.mTempPos[2].x; UIBasicSprite.mTempPos[0].y = Mathf.Lerp(drawingDimensions.y, drawingDimensions.w, t); UIBasicSprite.mTempPos[1].y = Mathf.Lerp(drawingDimensions.y, drawingDimensions.w, t2); UIBasicSprite.mTempPos[2].y = UIBasicSprite.mTempPos[1].y; UIBasicSprite.mTempPos[3].y = UIBasicSprite.mTempPos[0].y; UIBasicSprite.mTempUVs[0].x = Mathf.Lerp(drawingUVs.x, drawingUVs.z, t3); UIBasicSprite.mTempUVs[1].x = UIBasicSprite.mTempUVs[0].x; UIBasicSprite.mTempUVs[2].x = Mathf.Lerp(drawingUVs.x, drawingUVs.z, t4); UIBasicSprite.mTempUVs[3].x = UIBasicSprite.mTempUVs[2].x; UIBasicSprite.mTempUVs[0].y = Mathf.Lerp(drawingUVs.y, drawingUVs.w, t); UIBasicSprite.mTempUVs[1].y = Mathf.Lerp(drawingUVs.y, drawingUVs.w, t2); UIBasicSprite.mTempUVs[2].y = UIBasicSprite.mTempUVs[1].y; UIBasicSprite.mTempUVs[3].y = UIBasicSprite.mTempUVs[0].y; float value = this.mInvert ? (this.mFillAmount * 2f - (float)(1 - j)) : (this.fillAmount * 2f - (float)j); if (UIBasicSprite.RadialCut(UIBasicSprite.mTempPos, UIBasicSprite.mTempUVs, Mathf.Clamp01(value), !this.mInvert, NGUIMath.RepeatIndex(j + 3, 4))) { for (int k = 0; k < 4; k++) { verts.Add(UIBasicSprite.mTempPos[k]); uvs.Add(UIBasicSprite.mTempUVs[k]); cols.Add(drawingColor); } } } return; } if (this.mFillDirection == UIBasicSprite.FillDirection.Radial360) { for (int l = 0; l < 4; l++) { float t5; float t6; if (l < 2) { t5 = 0f; t6 = 0.5f; } else { t5 = 0.5f; t6 = 1f; } float t7; float t8; if (l == 0 || l == 3) { t7 = 0f; t8 = 0.5f; } else { t7 = 0.5f; t8 = 1f; } UIBasicSprite.mTempPos[0].x = Mathf.Lerp(drawingDimensions.x, drawingDimensions.z, t5); UIBasicSprite.mTempPos[1].x = UIBasicSprite.mTempPos[0].x; UIBasicSprite.mTempPos[2].x = Mathf.Lerp(drawingDimensions.x, drawingDimensions.z, t6); UIBasicSprite.mTempPos[3].x = UIBasicSprite.mTempPos[2].x; UIBasicSprite.mTempPos[0].y = Mathf.Lerp(drawingDimensions.y, drawingDimensions.w, t7); UIBasicSprite.mTempPos[1].y = Mathf.Lerp(drawingDimensions.y, drawingDimensions.w, t8); UIBasicSprite.mTempPos[2].y = UIBasicSprite.mTempPos[1].y; UIBasicSprite.mTempPos[3].y = UIBasicSprite.mTempPos[0].y; UIBasicSprite.mTempUVs[0].x = Mathf.Lerp(drawingUVs.x, drawingUVs.z, t5); UIBasicSprite.mTempUVs[1].x = UIBasicSprite.mTempUVs[0].x; UIBasicSprite.mTempUVs[2].x = Mathf.Lerp(drawingUVs.x, drawingUVs.z, t6); UIBasicSprite.mTempUVs[3].x = UIBasicSprite.mTempUVs[2].x; UIBasicSprite.mTempUVs[0].y = Mathf.Lerp(drawingUVs.y, drawingUVs.w, t7); UIBasicSprite.mTempUVs[1].y = Mathf.Lerp(drawingUVs.y, drawingUVs.w, t8); UIBasicSprite.mTempUVs[2].y = UIBasicSprite.mTempUVs[1].y; UIBasicSprite.mTempUVs[3].y = UIBasicSprite.mTempUVs[0].y; float value2 = (!this.mInvert) ? (this.mFillAmount * 4f - (float)(3 - NGUIMath.RepeatIndex(l + 2, 4))) : (this.mFillAmount * 4f - (float)NGUIMath.RepeatIndex(l + 2, 4)); if (UIBasicSprite.RadialCut(UIBasicSprite.mTempPos, UIBasicSprite.mTempUVs, Mathf.Clamp01(value2), this.mInvert, NGUIMath.RepeatIndex(l + 2, 4))) { for (int m = 0; m < 4; m++) { verts.Add(UIBasicSprite.mTempPos[m]); uvs.Add(UIBasicSprite.mTempUVs[m]); cols.Add(drawingColor); } } } return; } } for (int n = 0; n < 4; n++) { verts.Add(UIBasicSprite.mTempPos[n]); uvs.Add(UIBasicSprite.mTempUVs[n]); cols.Add(drawingColor); } }
// Token: 0x060004D6 RID: 1238 RVA: 0x0002DFA4 File Offset: 0x0002C1A4 protected void FilledFill(List <Vector3> verts, List <Vector2> uvs, List <Color> cols, ref Vector4 v, ref Vector4 u, ref Color c) { if (this.mFillAmount < 0.001f) { return; } if (this.mFillDirection == UIBasicSprite.FillDirection.Horizontal || this.mFillDirection == UIBasicSprite.FillDirection.Vertical) { if (this.mFillDirection == UIBasicSprite.FillDirection.Horizontal) { float num = (u.z - u.x) * this.mFillAmount; if (this.mInvert) { v.x = v.z - (v.z - v.x) * this.mFillAmount; u.x = u.z - num; } else { v.z = v.x + (v.z - v.x) * this.mFillAmount; u.z = u.x + num; } } else if (this.mFillDirection == UIBasicSprite.FillDirection.Vertical) { float num2 = (u.w - u.y) * this.mFillAmount; if (this.mInvert) { v.y = v.w - (v.w - v.y) * this.mFillAmount; u.y = u.w - num2; } else { v.w = v.y + (v.w - v.y) * this.mFillAmount; u.w = u.y + num2; } } } UIBasicSprite.mTempPos[0] = new Vector2(v.x, v.y); UIBasicSprite.mTempPos[1] = new Vector2(v.x, v.w); UIBasicSprite.mTempPos[2] = new Vector2(v.z, v.w); UIBasicSprite.mTempPos[3] = new Vector2(v.z, v.y); UIBasicSprite.mTempUVs[0] = new Vector2(u.x, u.y); UIBasicSprite.mTempUVs[1] = new Vector2(u.x, u.w); UIBasicSprite.mTempUVs[2] = new Vector2(u.z, u.w); UIBasicSprite.mTempUVs[3] = new Vector2(u.z, u.y); if (this.mFillAmount < 1f) { if (this.mFillDirection == UIBasicSprite.FillDirection.Radial90) { if (UIBasicSprite.RadialCut(UIBasicSprite.mTempPos, UIBasicSprite.mTempUVs, this.mFillAmount, this.mInvert, 0)) { for (int i = 0; i < 4; i++) { verts.Add(UIBasicSprite.mTempPos[i]); uvs.Add(UIBasicSprite.mTempUVs[i]); cols.Add(c); } } return; } if (this.mFillDirection == UIBasicSprite.FillDirection.Radial180) { for (int j = 0; j < 2; j++) { float t = 0f; float t2 = 1f; float t3; float t4; if (j == 0) { t3 = 0f; t4 = 0.5f; } else { t3 = 0.5f; t4 = 1f; } UIBasicSprite.mTempPos[0].x = Mathf.Lerp(v.x, v.z, t3); UIBasicSprite.mTempPos[1].x = UIBasicSprite.mTempPos[0].x; UIBasicSprite.mTempPos[2].x = Mathf.Lerp(v.x, v.z, t4); UIBasicSprite.mTempPos[3].x = UIBasicSprite.mTempPos[2].x; UIBasicSprite.mTempPos[0].y = Mathf.Lerp(v.y, v.w, t); UIBasicSprite.mTempPos[1].y = Mathf.Lerp(v.y, v.w, t2); UIBasicSprite.mTempPos[2].y = UIBasicSprite.mTempPos[1].y; UIBasicSprite.mTempPos[3].y = UIBasicSprite.mTempPos[0].y; UIBasicSprite.mTempUVs[0].x = Mathf.Lerp(u.x, u.z, t3); UIBasicSprite.mTempUVs[1].x = UIBasicSprite.mTempUVs[0].x; UIBasicSprite.mTempUVs[2].x = Mathf.Lerp(u.x, u.z, t4); UIBasicSprite.mTempUVs[3].x = UIBasicSprite.mTempUVs[2].x; UIBasicSprite.mTempUVs[0].y = Mathf.Lerp(u.y, u.w, t); UIBasicSprite.mTempUVs[1].y = Mathf.Lerp(u.y, u.w, t2); UIBasicSprite.mTempUVs[2].y = UIBasicSprite.mTempUVs[1].y; UIBasicSprite.mTempUVs[3].y = UIBasicSprite.mTempUVs[0].y; float value = (!this.mInvert) ? (this.fillAmount * 2f - (float)j) : (this.mFillAmount * 2f - (float)(1 - j)); if (UIBasicSprite.RadialCut(UIBasicSprite.mTempPos, UIBasicSprite.mTempUVs, Mathf.Clamp01(value), !this.mInvert, NGUIMath.RepeatIndex(j + 3, 4))) { for (int k = 0; k < 4; k++) { verts.Add(UIBasicSprite.mTempPos[k]); uvs.Add(UIBasicSprite.mTempUVs[k]); cols.Add(c); } } } return; } if (this.mFillDirection == UIBasicSprite.FillDirection.Radial360) { for (int l = 0; l < 4; l++) { float t5; float t6; if (l < 2) { t5 = 0f; t6 = 0.5f; } else { t5 = 0.5f; t6 = 1f; } float t7; float t8; if (l == 0 || l == 3) { t7 = 0f; t8 = 0.5f; } else { t7 = 0.5f; t8 = 1f; } UIBasicSprite.mTempPos[0].x = Mathf.Lerp(v.x, v.z, t5); UIBasicSprite.mTempPos[1].x = UIBasicSprite.mTempPos[0].x; UIBasicSprite.mTempPos[2].x = Mathf.Lerp(v.x, v.z, t6); UIBasicSprite.mTempPos[3].x = UIBasicSprite.mTempPos[2].x; UIBasicSprite.mTempPos[0].y = Mathf.Lerp(v.y, v.w, t7); UIBasicSprite.mTempPos[1].y = Mathf.Lerp(v.y, v.w, t8); UIBasicSprite.mTempPos[2].y = UIBasicSprite.mTempPos[1].y; UIBasicSprite.mTempPos[3].y = UIBasicSprite.mTempPos[0].y; UIBasicSprite.mTempUVs[0].x = Mathf.Lerp(u.x, u.z, t5); UIBasicSprite.mTempUVs[1].x = UIBasicSprite.mTempUVs[0].x; UIBasicSprite.mTempUVs[2].x = Mathf.Lerp(u.x, u.z, t6); UIBasicSprite.mTempUVs[3].x = UIBasicSprite.mTempUVs[2].x; UIBasicSprite.mTempUVs[0].y = Mathf.Lerp(u.y, u.w, t7); UIBasicSprite.mTempUVs[1].y = Mathf.Lerp(u.y, u.w, t8); UIBasicSprite.mTempUVs[2].y = UIBasicSprite.mTempUVs[1].y; UIBasicSprite.mTempUVs[3].y = UIBasicSprite.mTempUVs[0].y; float value2 = this.mInvert ? (this.mFillAmount * 4f - (float)NGUIMath.RepeatIndex(l + 2, 4)) : (this.mFillAmount * 4f - (float)(3 - NGUIMath.RepeatIndex(l + 2, 4))); if (UIBasicSprite.RadialCut(UIBasicSprite.mTempPos, UIBasicSprite.mTempUVs, Mathf.Clamp01(value2), this.mInvert, NGUIMath.RepeatIndex(l + 2, 4))) { for (int m = 0; m < 4; m++) { verts.Add(UIBasicSprite.mTempPos[m]); uvs.Add(UIBasicSprite.mTempUVs[m]); cols.Add(c); } } } return; } } for (int n = 0; n < 4; n++) { verts.Add(UIBasicSprite.mTempPos[n]); uvs.Add(UIBasicSprite.mTempUVs[n]); cols.Add(c); } }