public override void OnFill(MeshBuffer m) { float single; float single1; Vertex vertex = new Vertex(); Vertex vertex1 = new Vertex(); Vertex vertex2 = new Vertex(); Vertex vertex3 = new Vertex(); float single2 = 0f; float single3 = 0f; float single4 = 1f; float single5 = -1f; float single6 = this.mOuterUV.xMin; float single7 = this.mOuterUV.yMin; float single8 = this.mOuterUV.xMax; float single9 = this.mOuterUV.yMax; if (this.mFillDirection == UIFilledSprite.FillDirection.Horizontal || this.mFillDirection == UIFilledSprite.FillDirection.Vertical) { float single10 = (single8 - single6) * this.mFillAmount; float single11 = (single9 - single7) * this.mFillAmount; if (this.fillDirection == UIFilledSprite.FillDirection.Horizontal) { if (!this.mInvert) { single4 = single4 * this.mFillAmount; single8 = single6 + single10; } else { single2 = 1f - this.mFillAmount; single6 = single8 - single10; } } else if (this.fillDirection == UIFilledSprite.FillDirection.Vertical) { if (!this.mInvert) { single3 = -(1f - this.mFillAmount); single9 = single7 + single11; } else { single5 = single5 * this.mFillAmount; single7 = single9 - single11; } } } Vector2[] vector2 = new Vector2[4]; Vector2[] vector2Array = new Vector2[4]; vector2[0] = new Vector2(single4, single3); vector2[1] = new Vector2(single4, single5); vector2[2] = new Vector2(single2, single5); vector2[3] = new Vector2(single2, single3); vector2Array[0] = new Vector2(single8, single9); vector2Array[1] = new Vector2(single8, single7); vector2Array[2] = new Vector2(single6, single7); vector2Array[3] = new Vector2(single6, single9); Color color = base.color; if (this.fillDirection != UIFilledSprite.FillDirection.Radial90) { if (this.fillDirection == UIFilledSprite.FillDirection.Radial180) { Vector2[] vector21 = new Vector2[4]; Vector2[] vector2Array1 = new Vector2[4]; for (int i = 0; i < 2; i++) { vector21[0] = new Vector2(0f, 0f); vector21[1] = new Vector2(0f, 1f); vector21[2] = new Vector2(1f, 1f); vector21[3] = new Vector2(1f, 0f); vector2Array1[0] = new Vector2(0f, 0f); vector2Array1[1] = new Vector2(0f, 1f); vector2Array1[2] = new Vector2(1f, 1f); vector2Array1[3] = new Vector2(1f, 0f); if (this.mInvert) { if (i > 0) { this.Rotate(vector21, i); this.Rotate(vector2Array1, i); } } else if (i < 1) { this.Rotate(vector21, 1 - i); this.Rotate(vector2Array1, 1 - i); } if (i != 1) { single = (!this.mInvert ? 0.5f : 1f); single1 = (!this.mInvert ? 1f : 0.5f); } else { single = (!this.mInvert ? 1f : 0.5f); single1 = (!this.mInvert ? 0.5f : 1f); } vector21[1].y = Mathf.Lerp(single, single1, vector21[1].y); vector21[2].y = Mathf.Lerp(single, single1, vector21[2].y); vector2Array1[1].y = Mathf.Lerp(single, single1, vector2Array1[1].y); vector2Array1[2].y = Mathf.Lerp(single, single1, vector2Array1[2].y); float single12 = this.mFillAmount * 2f - (float)i; bool flag = i % 2 == 1; if (this.AdjustRadial(vector21, vector2Array1, single12, !flag)) { if (this.mInvert) { flag = !flag; } if (!flag) { int num = m.Alloc(PrimitiveKind.Quad); for (int j = 3; j > -1; j--) { m.v[num].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector21[j].x); m.v[num].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector21[j].y); m.v[num].z = 0f; m.v[num].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array1[j].x); m.v[num].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array1[j].y); m.v[num].r = color.r; m.v[num].g = color.g; m.v[num].b = color.b; m.v[num].a = color.a; num++; } } else { int num1 = m.Alloc(PrimitiveKind.Quad); for (int k = 0; k < 4; k++) { m.v[num1].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector21[k].x); m.v[num1].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector21[k].y); m.v[num1].z = 0f; m.v[num1].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array1[k].x); m.v[num1].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array1[k].y); m.v[num1].r = color.r; m.v[num1].g = color.g; m.v[num1].b = color.b; m.v[num1].a = color.a; num1++; } } } } return; } if (this.fillDirection == UIFilledSprite.FillDirection.Radial360) { float[] singleArray = new float[] { 0.5f, 1f, 0f, 0.5f, 0.5f, 1f, 0.5f, 1f, 0f, 0.5f, 0.5f, 1f, 0f, 0.5f, 0f, 0.5f }; Vector2[] vector22 = new Vector2[4]; Vector2[] vector2Array2 = new Vector2[4]; for (int l = 0; l < 4; l++) { vector22[0] = new Vector2(0f, 0f); vector22[1] = new Vector2(0f, 1f); vector22[2] = new Vector2(1f, 1f); vector22[3] = new Vector2(1f, 0f); vector2Array2[0] = new Vector2(0f, 0f); vector2Array2[1] = new Vector2(0f, 1f); vector2Array2[2] = new Vector2(1f, 1f); vector2Array2[3] = new Vector2(1f, 0f); if (this.mInvert) { if (l > 0) { this.Rotate(vector22, l); this.Rotate(vector2Array2, l); } } else if (l < 3) { this.Rotate(vector22, 3 - l); this.Rotate(vector2Array2, 3 - l); } for (int m1 = 0; m1 < 4; m1++) { int num2 = (!this.mInvert ? l * 4 : (3 - l) * 4); float single13 = singleArray[num2]; float single14 = singleArray[num2 + 1]; float single15 = singleArray[num2 + 2]; float single16 = singleArray[num2 + 3]; vector22[m1].x = Mathf.Lerp(single13, single14, vector22[m1].x); vector22[m1].y = Mathf.Lerp(single15, single16, vector22[m1].y); vector2Array2[m1].x = Mathf.Lerp(single13, single14, vector2Array2[m1].x); vector2Array2[m1].y = Mathf.Lerp(single15, single16, vector2Array2[m1].y); } float single17 = this.mFillAmount * 4f - (float)l; bool flag1 = l % 2 == 1; if (this.AdjustRadial(vector22, vector2Array2, single17, !flag1)) { if (this.mInvert) { flag1 = !flag1; } if (!flag1) { int num3 = m.Alloc(PrimitiveKind.Quad); for (int n = 3; n > -1; n--) { m.v[num3].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector22[n].x); m.v[num3].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector22[n].y); m.v[num3].z = 0f; m.v[num3].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array2[n].x); m.v[num3].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array2[n].y); m.v[num3].r = color.r; m.v[num3].g = color.g; m.v[num3].b = color.b; m.v[num3].a = color.a; num3++; } } else { int num4 = m.Alloc(PrimitiveKind.Quad); for (int o = 0; o < 4; o++) { m.v[num4].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector22[o].x); m.v[num4].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector22[o].y); m.v[num4].z = 0f; m.v[num4].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array2[o].x); m.v[num4].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array2[o].y); m.v[num4].r = color.r; m.v[num4].g = color.g; m.v[num4].b = color.b; m.v[num4].a = color.a; num4++; } } } } return; } } else if (!this.AdjustRadial(vector2, vector2Array, this.mFillAmount, this.mInvert)) { return; } vertex.x = vector2[0].x; vertex.y = vector2[0].y; vertex.u = vector2Array[0].x; vertex.v = vector2Array[0].y; vertex1.x = vector2[1].x; vertex1.y = vector2[1].y; vertex1.u = vector2Array[1].x; vertex1.v = vector2Array[1].y; vertex2.x = vector2[2].x; vertex2.y = vector2[2].y; vertex2.u = vector2Array[2].x; vertex2.v = vector2Array[2].y; vertex3.x = vector2[3].x; vertex3.y = vector2[3].y; vertex3.u = vector2Array[3].x; vertex3.v = vector2Array[3].y; float single18 = 0f; float single19 = single18; vertex3.z = single18; float single20 = single19; single19 = single20; vertex2.z = single20; float single21 = single19; single19 = single21; vertex1.z = single21; vertex.z = single19; float single22 = color.r; single19 = single22; vertex3.r = single22; float single23 = single19; single19 = single23; vertex2.r = single23; float single24 = single19; single19 = single24; vertex1.r = single24; vertex.r = single19; float single25 = color.g; single19 = single25; vertex3.g = single25; float single26 = single19; single19 = single26; vertex2.g = single26; float single27 = single19; single19 = single27; vertex1.g = single27; vertex.g = single19; float single28 = color.b; single19 = single28; vertex3.b = single28; float single29 = single19; single19 = single29; vertex2.b = single29; float single30 = single19; single19 = single30; vertex1.b = single30; vertex.b = single19; float single31 = color.a; single19 = single31; vertex3.a = single31; float single32 = single19; single19 = single32; vertex2.a = single32; float single33 = single19; single19 = single33; vertex1.a = single33; vertex.a = single19; m.Quad(vertex, vertex1, vertex2, vertex3); }
public override void OnFill(MeshBuffer m) { float single; float single1; Vertex vertex = new Vertex(); Vertex vertex1 = new Vertex(); Vertex vertex2 = new Vertex(); Vertex vertex3 = new Vertex(); float single2 = 0f; float single3 = 0f; float single4 = 1f; float single5 = -1f; float single6 = this.mOuterUV.xMin; float single7 = this.mOuterUV.yMin; float single8 = this.mOuterUV.xMax; float single9 = this.mOuterUV.yMax; if (this.mFillDirection == UIFilledSprite.FillDirection.Horizontal || this.mFillDirection == UIFilledSprite.FillDirection.Vertical) { float single10 = (single8 - single6) * this.mFillAmount; float single11 = (single9 - single7) * this.mFillAmount; if (this.fillDirection == UIFilledSprite.FillDirection.Horizontal) { if (!this.mInvert) { single4 = single4 * this.mFillAmount; single8 = single6 + single10; } else { single2 = 1f - this.mFillAmount; single6 = single8 - single10; } } else if (this.fillDirection == UIFilledSprite.FillDirection.Vertical) { if (!this.mInvert) { single3 = -(1f - this.mFillAmount); single9 = single7 + single11; } else { single5 = single5 * this.mFillAmount; single7 = single9 - single11; } } } Vector2[] vector2 = new Vector2[4]; Vector2[] vector2Array = new Vector2[4]; vector2[0] = new Vector2(single4, single3); vector2[1] = new Vector2(single4, single5); vector2[2] = new Vector2(single2, single5); vector2[3] = new Vector2(single2, single3); vector2Array[0] = new Vector2(single8, single9); vector2Array[1] = new Vector2(single8, single7); vector2Array[2] = new Vector2(single6, single7); vector2Array[3] = new Vector2(single6, single9); Color color = base.color; if (this.fillDirection != UIFilledSprite.FillDirection.Radial90) { if (this.fillDirection == UIFilledSprite.FillDirection.Radial180) { Vector2[] vector21 = new Vector2[4]; Vector2[] vector2Array1 = new Vector2[4]; for (int i = 0; i < 2; i++) { vector21[0] = new Vector2(0f, 0f); vector21[1] = new Vector2(0f, 1f); vector21[2] = new Vector2(1f, 1f); vector21[3] = new Vector2(1f, 0f); vector2Array1[0] = new Vector2(0f, 0f); vector2Array1[1] = new Vector2(0f, 1f); vector2Array1[2] = new Vector2(1f, 1f); vector2Array1[3] = new Vector2(1f, 0f); if (this.mInvert) { if (i > 0) { this.Rotate(vector21, i); this.Rotate(vector2Array1, i); } } else if (i < 1) { this.Rotate(vector21, 1 - i); this.Rotate(vector2Array1, 1 - i); } if (i != 1) { single = (!this.mInvert ? 0.5f : 1f); single1 = (!this.mInvert ? 1f : 0.5f); } else { single = (!this.mInvert ? 1f : 0.5f); single1 = (!this.mInvert ? 0.5f : 1f); } vector21[1].y = Mathf.Lerp(single, single1, vector21[1].y); vector21[2].y = Mathf.Lerp(single, single1, vector21[2].y); vector2Array1[1].y = Mathf.Lerp(single, single1, vector2Array1[1].y); vector2Array1[2].y = Mathf.Lerp(single, single1, vector2Array1[2].y); float single12 = this.mFillAmount * 2f - (float)i; bool flag = i % 2 == 1; if (this.AdjustRadial(vector21, vector2Array1, single12, !flag)) { if (this.mInvert) { flag = !flag; } if (!flag) { int num = m.Alloc(PrimitiveKind.Quad); for (int j = 3; j > -1; j--) { m.v[num].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector21[j].x); m.v[num].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector21[j].y); m.v[num].z = 0f; m.v[num].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array1[j].x); m.v[num].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array1[j].y); m.v[num].r = color.r; m.v[num].g = color.g; m.v[num].b = color.b; m.v[num].a = color.a; num++; } } else { int num1 = m.Alloc(PrimitiveKind.Quad); for (int k = 0; k < 4; k++) { m.v[num1].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector21[k].x); m.v[num1].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector21[k].y); m.v[num1].z = 0f; m.v[num1].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array1[k].x); m.v[num1].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array1[k].y); m.v[num1].r = color.r; m.v[num1].g = color.g; m.v[num1].b = color.b; m.v[num1].a = color.a; num1++; } } } } return; } if (this.fillDirection == UIFilledSprite.FillDirection.Radial360) { float[] singleArray = new float[] { 0.5f, 1f, 0f, 0.5f, 0.5f, 1f, 0.5f, 1f, 0f, 0.5f, 0.5f, 1f, 0f, 0.5f, 0f, 0.5f }; Vector2[] vector22 = new Vector2[4]; Vector2[] vector2Array2 = new Vector2[4]; for (int l = 0; l < 4; l++) { vector22[0] = new Vector2(0f, 0f); vector22[1] = new Vector2(0f, 1f); vector22[2] = new Vector2(1f, 1f); vector22[3] = new Vector2(1f, 0f); vector2Array2[0] = new Vector2(0f, 0f); vector2Array2[1] = new Vector2(0f, 1f); vector2Array2[2] = new Vector2(1f, 1f); vector2Array2[3] = new Vector2(1f, 0f); if (this.mInvert) { if (l > 0) { this.Rotate(vector22, l); this.Rotate(vector2Array2, l); } } else if (l < 3) { this.Rotate(vector22, 3 - l); this.Rotate(vector2Array2, 3 - l); } for (int m1 = 0; m1 < 4; m1++) { int num2 = (!this.mInvert ? l * 4 : (3 - l) * 4); float single13 = singleArray[num2]; float single14 = singleArray[num2 + 1]; float single15 = singleArray[num2 + 2]; float single16 = singleArray[num2 + 3]; vector22[m1].x = Mathf.Lerp(single13, single14, vector22[m1].x); vector22[m1].y = Mathf.Lerp(single15, single16, vector22[m1].y); vector2Array2[m1].x = Mathf.Lerp(single13, single14, vector2Array2[m1].x); vector2Array2[m1].y = Mathf.Lerp(single15, single16, vector2Array2[m1].y); } float single17 = this.mFillAmount * 4f - (float)l; bool flag1 = l % 2 == 1; if (this.AdjustRadial(vector22, vector2Array2, single17, !flag1)) { if (this.mInvert) { flag1 = !flag1; } if (!flag1) { int num3 = m.Alloc(PrimitiveKind.Quad); for (int n = 3; n > -1; n--) { m.v[num3].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector22[n].x); m.v[num3].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector22[n].y); m.v[num3].z = 0f; m.v[num3].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array2[n].x); m.v[num3].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array2[n].y); m.v[num3].r = color.r; m.v[num3].g = color.g; m.v[num3].b = color.b; m.v[num3].a = color.a; num3++; } } else { int num4 = m.Alloc(PrimitiveKind.Quad); for (int o = 0; o < 4; o++) { m.v[num4].x = Mathf.Lerp(vector2[0].x, vector2[2].x, vector22[o].x); m.v[num4].y = Mathf.Lerp(vector2[0].y, vector2[2].y, vector22[o].y); m.v[num4].z = 0f; m.v[num4].u = Mathf.Lerp(vector2Array[0].x, vector2Array[2].x, vector2Array2[o].x); m.v[num4].v = Mathf.Lerp(vector2Array[0].y, vector2Array[2].y, vector2Array2[o].y); m.v[num4].r = color.r; m.v[num4].g = color.g; m.v[num4].b = color.b; m.v[num4].a = color.a; num4++; } } } } return; } } else if (!this.AdjustRadial(vector2, vector2Array, this.mFillAmount, this.mInvert)) { return; } vertex.x = vector2[0].x; vertex.y = vector2[0].y; vertex.u = vector2Array[0].x; vertex.v = vector2Array[0].y; vertex1.x = vector2[1].x; vertex1.y = vector2[1].y; vertex1.u = vector2Array[1].x; vertex1.v = vector2Array[1].y; vertex2.x = vector2[2].x; vertex2.y = vector2[2].y; vertex2.u = vector2Array[2].x; vertex2.v = vector2Array[2].y; vertex3.x = vector2[3].x; vertex3.y = vector2[3].y; vertex3.u = vector2Array[3].x; vertex3.v = vector2Array[3].y; float single18 = 0f; float single19 = single18; vertex3.z = single18; float single20 = single19; single19 = single20; vertex2.z = single20; float single21 = single19; single19 = single21; vertex1.z = single21; vertex.z = single19; float single22 = color.r; single19 = single22; vertex3.r = single22; float single23 = single19; single19 = single23; vertex2.r = single23; float single24 = single19; single19 = single24; vertex1.r = single24; vertex.r = single19; float single25 = color.g; single19 = single25; vertex3.g = single25; float single26 = single19; single19 = single26; vertex2.g = single26; float single27 = single19; single19 = single27; vertex1.g = single27; vertex.g = single19; float single28 = color.b; single19 = single28; vertex3.b = single28; float single29 = single19; single19 = single29; vertex2.b = single29; float single30 = single19; single19 = single30; vertex1.b = single30; vertex.b = single19; float single31 = color.a; single19 = single31; vertex3.a = single31; float single32 = single19; single19 = single32; vertex2.a = single32; float single33 = single19; single19 = single33; vertex1.a = single33; vertex.a = single19; m.Quad(vertex, vertex1, vertex2, vertex3); }
public override void OnFill(MeshBuffer m) { Vertex vertex = new Vertex(); Vertex vertex1 = new Vertex(); Vertex vertex2 = new Vertex(); Vertex vertex3 = new Vertex(); Texture texture = base.material.mainTexture; if (texture == null) { return; } Rect pixels = this.mInner; if (base.atlas.coordinates == UIAtlas.Coordinates.TexCoords) { pixels = NGUIMath.ConvertToPixels(pixels, texture.width, texture.height, true); } Vector2 vector2 = base.cachedTransform.localScale; float single = base.atlas.pixelSize; float single1 = Mathf.Abs(pixels.width / vector2.x) * single; float single2 = Mathf.Abs(pixels.height / vector2.y) * single; if (single1 < 0.01f || single2 < 0.01f) { Debug.LogWarning(string.Concat("The tiled sprite (", NGUITools.GetHierarchy(base.gameObject), ") is too small.\nConsider using a bigger one.")); single1 = 0.01f; single2 = 0.01f; } Vector2 vector21 = new Vector2(pixels.xMin / (float)texture.width, pixels.yMin / (float)texture.height); Vector2 vector22 = new Vector2(pixels.xMax / (float)texture.width, pixels.yMax / (float)texture.height); Vector2 vector23 = vector22; float single3 = 0f; Color color = base.color; float single4 = color.r; float single5 = single4; vertex3.r = single4; float single6 = single5; single5 = single6; vertex2.r = single6; float single7 = single5; single5 = single7; vertex1.r = single7; vertex.r = single5; float single8 = color.g; single5 = single8; vertex3.g = single8; float single9 = single5; single5 = single9; vertex2.g = single9; float single10 = single5; single5 = single10; vertex1.g = single10; vertex.g = single5; float single11 = color.b; single5 = single11; vertex3.b = single11; float single12 = single5; single5 = single12; vertex2.b = single12; float single13 = single5; single5 = single13; vertex1.b = single13; vertex.b = single5; float single14 = color.a; single5 = single14; vertex3.a = single14; float single15 = single5; single5 = single15; vertex2.a = single15; float single16 = single5; single5 = single16; vertex1.a = single16; vertex.a = single5; float single17 = 0f; single5 = single17; vertex3.z = single17; float single18 = single5; single5 = single18; vertex2.z = single18; float single19 = single5; single5 = single19; vertex1.z = single19; vertex.z = single5; while (single3 < 1f) { float single20 = 0f; vector23.x = vector22.x; float single21 = single3 + single2; if (single21 > 1f) { vector23.y = vector21.y + (vector22.y - vector21.y) * (1f - single3) / (single21 - single3); single21 = 1f; } while (single20 < 1f) { float single22 = single20 + single1; if (single22 > 1f) { vector23.x = vector21.x + (vector22.x - vector21.x) * (1f - single20) / (single22 - single20); single22 = 1f; } vertex.x = single22; vertex.y = -single3; vertex1.x = single22; vertex1.y = -single21; vertex2.x = single20; vertex2.y = -single21; vertex3.x = single20; vertex3.y = -single3; vertex.u = vector23.x; vertex.v = 1f - vector21.y; vertex1.u = vector23.x; vertex1.v = 1f - vector23.y; vertex2.u = vector21.x; vertex2.v = 1f - vector23.y; vertex3.u = vector21.x; vertex3.v = 1f - vector21.y; m.Quad(vertex, vertex1, vertex2, vertex3); single20 = single20 + single1; } single3 = single3 + single2; } }
public override void OnFill(MeshBuffer m) { Vertex vertex; Vertex vertex2; Vertex vertex3; Vertex vertex4; float x = 0f; float y = 0f; float num3 = 1f; float num4 = -1f; float xMin = this.mOuterUV.xMin; float yMin = this.mOuterUV.yMin; float xMax = this.mOuterUV.xMax; float yMax = this.mOuterUV.yMax; if ((this.mFillDirection == FillDirection.Horizontal) || (this.mFillDirection == FillDirection.Vertical)) { float num9 = (xMax - xMin) * this.mFillAmount; float num10 = (yMax - yMin) * this.mFillAmount; if (this.fillDirection == FillDirection.Horizontal) { if (this.mInvert) { x = 1f - this.mFillAmount; xMin = xMax - num9; } else { num3 *= this.mFillAmount; xMax = xMin + num9; } } else if (this.fillDirection == FillDirection.Vertical) { if (this.mInvert) { num4 *= this.mFillAmount; yMin = yMax - num10; } else { y = -(1f - this.mFillAmount); yMax = yMin + num10; } } } Vector2[] xy = new Vector2[4]; Vector2[] uv = new Vector2[4]; xy[0] = new Vector2(num3, y); xy[1] = new Vector2(num3, num4); xy[2] = new Vector2(x, num4); xy[3] = new Vector2(x, y); uv[0] = new Vector2(xMax, yMax); uv[1] = new Vector2(xMax, yMin); uv[2] = new Vector2(xMin, yMin); uv[3] = new Vector2(xMin, yMax); Color color = base.color; if (this.fillDirection == FillDirection.Radial90) { if (!this.AdjustRadial(xy, uv, this.mFillAmount, this.mInvert)) { return; } } else { if (this.fillDirection == FillDirection.Radial180) { Vector2[] v = new Vector2[4]; Vector2[] vectorArray4 = new Vector2[4]; for (int i = 0; i < 2; i++) { float num12; float num13; v[0] = new Vector2(0f, 0f); v[1] = new Vector2(0f, 1f); v[2] = new Vector2(1f, 1f); v[3] = new Vector2(1f, 0f); vectorArray4[0] = new Vector2(0f, 0f); vectorArray4[1] = new Vector2(0f, 1f); vectorArray4[2] = new Vector2(1f, 1f); vectorArray4[3] = new Vector2(1f, 0f); if (this.mInvert) { if (i > 0) { this.Rotate(v, i); this.Rotate(vectorArray4, i); } } else if (i < 1) { this.Rotate(v, 1 - i); this.Rotate(vectorArray4, 1 - i); } if (i == 1) { num12 = !this.mInvert ? 1f : 0.5f; num13 = !this.mInvert ? 0.5f : 1f; } else { num12 = !this.mInvert ? 0.5f : 1f; num13 = !this.mInvert ? 1f : 0.5f; } v[1].y = Mathf.Lerp(num12, num13, v[1].y); v[2].y = Mathf.Lerp(num12, num13, v[2].y); vectorArray4[1].y = Mathf.Lerp(num12, num13, vectorArray4[1].y); vectorArray4[2].y = Mathf.Lerp(num12, num13, vectorArray4[2].y); float fill = (this.mFillAmount * 2f) - i; bool flag = (i % 2) == 1; if (this.AdjustRadial(v, vectorArray4, fill, !flag)) { if (this.mInvert) { flag = !flag; } if (flag) { int index = m.Alloc(PrimitiveKind.Quad); for (int j = 0; j < 4; j++) { m.v[index].x = Mathf.Lerp(xy[0].x, xy[2].x, v[j].x); m.v[index].y = Mathf.Lerp(xy[0].y, xy[2].y, v[j].y); m.v[index].z = 0f; m.v[index].u = Mathf.Lerp(uv[0].x, uv[2].x, vectorArray4[j].x); m.v[index].v = Mathf.Lerp(uv[0].y, uv[2].y, vectorArray4[j].y); m.v[index].r = color.r; m.v[index].g = color.g; m.v[index].b = color.b; m.v[index].a = color.a; index++; } } else { int num17 = m.Alloc(PrimitiveKind.Quad); for (int k = 3; k > -1; k--) { m.v[num17].x = Mathf.Lerp(xy[0].x, xy[2].x, v[k].x); m.v[num17].y = Mathf.Lerp(xy[0].y, xy[2].y, v[k].y); m.v[num17].z = 0f; m.v[num17].u = Mathf.Lerp(uv[0].x, uv[2].x, vectorArray4[k].x); m.v[num17].v = Mathf.Lerp(uv[0].y, uv[2].y, vectorArray4[k].y); m.v[num17].r = color.r; m.v[num17].g = color.g; m.v[num17].b = color.b; m.v[num17].a = color.a; num17++; } } } } return; } if (this.fillDirection == FillDirection.Radial360) { float[] numArray = new float[] { 0.5f, 1f, 0f, 0.5f, 0.5f, 1f, 0.5f, 1f, 0f, 0.5f, 0.5f, 1f, 0f, 0.5f, 0f, 0.5f }; Vector2[] vectorArray5 = new Vector2[4]; Vector2[] vectorArray6 = new Vector2[4]; for (int n = 0; n < 4; n++) { vectorArray5[0] = new Vector2(0f, 0f); vectorArray5[1] = new Vector2(0f, 1f); vectorArray5[2] = new Vector2(1f, 1f); vectorArray5[3] = new Vector2(1f, 0f); vectorArray6[0] = new Vector2(0f, 0f); vectorArray6[1] = new Vector2(0f, 1f); vectorArray6[2] = new Vector2(1f, 1f); vectorArray6[3] = new Vector2(1f, 0f); if (this.mInvert) { if (n > 0) { this.Rotate(vectorArray5, n); this.Rotate(vectorArray6, n); } } else if (n < 3) { this.Rotate(vectorArray5, 3 - n); this.Rotate(vectorArray6, 3 - n); } for (int num20 = 0; num20 < 4; num20++) { int num21 = !this.mInvert ? (n * 4) : ((3 - n) * 4); float from = numArray[num21]; float to = numArray[num21 + 1]; float num24 = numArray[num21 + 2]; float num25 = numArray[num21 + 3]; vectorArray5[num20].x = Mathf.Lerp(from, to, vectorArray5[num20].x); vectorArray5[num20].y = Mathf.Lerp(num24, num25, vectorArray5[num20].y); vectorArray6[num20].x = Mathf.Lerp(from, to, vectorArray6[num20].x); vectorArray6[num20].y = Mathf.Lerp(num24, num25, vectorArray6[num20].y); } float num26 = (this.mFillAmount * 4f) - n; bool flag2 = (n % 2) == 1; if (this.AdjustRadial(vectorArray5, vectorArray6, num26, !flag2)) { if (this.mInvert) { flag2 = !flag2; } if (flag2) { int num27 = m.Alloc(PrimitiveKind.Quad); for (int num28 = 0; num28 < 4; num28++) { m.v[num27].x = Mathf.Lerp(xy[0].x, xy[2].x, vectorArray5[num28].x); m.v[num27].y = Mathf.Lerp(xy[0].y, xy[2].y, vectorArray5[num28].y); m.v[num27].z = 0f; m.v[num27].u = Mathf.Lerp(uv[0].x, uv[2].x, vectorArray6[num28].x); m.v[num27].v = Mathf.Lerp(uv[0].y, uv[2].y, vectorArray6[num28].y); m.v[num27].r = color.r; m.v[num27].g = color.g; m.v[num27].b = color.b; m.v[num27].a = color.a; num27++; } } else { int num29 = m.Alloc(PrimitiveKind.Quad); for (int num30 = 3; num30 > -1; num30--) { m.v[num29].x = Mathf.Lerp(xy[0].x, xy[2].x, vectorArray5[num30].x); m.v[num29].y = Mathf.Lerp(xy[0].y, xy[2].y, vectorArray5[num30].y); m.v[num29].z = 0f; m.v[num29].u = Mathf.Lerp(uv[0].x, uv[2].x, vectorArray6[num30].x); m.v[num29].v = Mathf.Lerp(uv[0].y, uv[2].y, vectorArray6[num30].y); m.v[num29].r = color.r; m.v[num29].g = color.g; m.v[num29].b = color.b; m.v[num29].a = color.a; num29++; } } } } return; } } vertex.x = xy[0].x; vertex.y = xy[0].y; vertex.u = uv[0].x; vertex.v = uv[0].y; vertex2.x = xy[1].x; vertex2.y = xy[1].y; vertex2.u = uv[1].x; vertex2.v = uv[1].y; vertex3.x = xy[2].x; vertex3.y = xy[2].y; vertex3.u = uv[2].x; vertex3.v = uv[2].y; vertex4.x = xy[3].x; vertex4.y = xy[3].y; vertex4.u = uv[3].x; vertex4.v = uv[3].y; vertex.z = vertex2.z = vertex3.z = vertex4.z = 0f; vertex.r = vertex2.r = vertex3.r = vertex4.r = color.r; vertex.g = vertex2.g = vertex3.g = vertex4.g = color.g; vertex.b = vertex2.b = vertex3.b = vertex4.b = color.b; vertex.a = vertex2.a = vertex3.a = vertex4.a = color.a; m.Quad(vertex, vertex2, vertex3, vertex4); }
public override void OnFill(MeshBuffer m) { Texture mainTexture = base.material.mainTexture; if (mainTexture != null) { Vertex vertex; Vertex vertex2; Vertex vertex3; Vertex vertex4; Rect mInner = base.mInner; if (base.atlas.coordinates == UIAtlas.Coordinates.TexCoords) { mInner = NGUIMath.ConvertToPixels(mInner, mainTexture.width, mainTexture.height, true); } Vector2 localScale = base.cachedTransform.localScale; float pixelSize = base.atlas.pixelSize; float num2 = Mathf.Abs((float)(mInner.width / localScale.x)) * pixelSize; float num3 = Mathf.Abs((float)(mInner.height / localScale.y)) * pixelSize; if ((num2 < 0.01f) || (num3 < 0.01f)) { Debug.LogWarning("The tiled sprite (" + NGUITools.GetHierarchy(base.gameObject) + ") is too small.\nConsider using a bigger one."); num2 = 0.01f; num3 = 0.01f; } Vector2 vector2 = new Vector2(mInner.xMin / ((float)mainTexture.width), mInner.yMin / ((float)mainTexture.height)); Vector2 vector3 = new Vector2(mInner.xMax / ((float)mainTexture.width), mInner.yMax / ((float)mainTexture.height)); Vector2 vector4 = vector3; float num4 = 0f; Color color = base.color; vertex.r = vertex2.r = vertex3.r = vertex4.r = color.r; vertex.g = vertex2.g = vertex3.g = vertex4.g = color.g; vertex.b = vertex2.b = vertex3.b = vertex4.b = color.b; vertex.a = vertex2.a = vertex3.a = vertex4.a = color.a; vertex.z = vertex2.z = vertex3.z = vertex4.z = 0f; while (num4 < 1f) { float num5 = 0f; vector4.x = vector3.x; float num6 = num4 + num3; if (num6 > 1f) { vector4.y = vector2.y + (((vector3.y - vector2.y) * (1f - num4)) / (num6 - num4)); num6 = 1f; } while (num5 < 1f) { float num7 = num5 + num2; if (num7 > 1f) { vector4.x = vector2.x + (((vector3.x - vector2.x) * (1f - num5)) / (num7 - num5)); num7 = 1f; } vertex.x = num7; vertex.y = -num4; vertex2.x = num7; vertex2.y = -num6; vertex3.x = num5; vertex3.y = -num6; vertex4.x = num5; vertex4.y = -num4; vertex.u = vector4.x; vertex.v = 1f - vector2.y; vertex2.u = vector4.x; vertex2.v = 1f - vector4.y; vertex3.u = vector2.x; vertex3.v = 1f - vector4.y; vertex4.u = vector2.x; vertex4.v = 1f - vector2.y; m.Quad(vertex, vertex2, vertex3, vertex4); num5 += num2; } num4 += num3; } } }
public override void OnFill(MeshBuffer m) { Vertex vertex = new Vertex(); Vertex vertex1 = new Vertex(); Vertex vertex2 = new Vertex(); Vertex vertex3 = new Vertex(); Texture texture = base.material.mainTexture; if (texture == null) { return; } Rect pixels = this.mInner; if (base.atlas.coordinates == UIAtlas.Coordinates.TexCoords) { pixels = NGUIMath.ConvertToPixels(pixels, texture.width, texture.height, true); } Vector2 vector2 = base.cachedTransform.localScale; float single = base.atlas.pixelSize; float single1 = Mathf.Abs(pixels.width / vector2.x) * single; float single2 = Mathf.Abs(pixels.height / vector2.y) * single; if (single1 < 0.01f || single2 < 0.01f) { Debug.LogWarning(string.Concat("The tiled sprite (", NGUITools.GetHierarchy(base.gameObject), ") is too small.\nConsider using a bigger one.")); single1 = 0.01f; single2 = 0.01f; } Vector2 vector21 = new Vector2(pixels.xMin / (float)texture.width, pixels.yMin / (float)texture.height); Vector2 vector22 = new Vector2(pixels.xMax / (float)texture.width, pixels.yMax / (float)texture.height); Vector2 vector23 = vector22; float single3 = 0f; Color color = base.color; float single4 = color.r; float single5 = single4; vertex3.r = single4; float single6 = single5; single5 = single6; vertex2.r = single6; float single7 = single5; single5 = single7; vertex1.r = single7; vertex.r = single5; float single8 = color.g; single5 = single8; vertex3.g = single8; float single9 = single5; single5 = single9; vertex2.g = single9; float single10 = single5; single5 = single10; vertex1.g = single10; vertex.g = single5; float single11 = color.b; single5 = single11; vertex3.b = single11; float single12 = single5; single5 = single12; vertex2.b = single12; float single13 = single5; single5 = single13; vertex1.b = single13; vertex.b = single5; float single14 = color.a; single5 = single14; vertex3.a = single14; float single15 = single5; single5 = single15; vertex2.a = single15; float single16 = single5; single5 = single16; vertex1.a = single16; vertex.a = single5; float single17 = 0f; single5 = single17; vertex3.z = single17; float single18 = single5; single5 = single18; vertex2.z = single18; float single19 = single5; single5 = single19; vertex1.z = single19; vertex.z = single5; while (single3 < 1f) { float single20 = 0f; vector23.x = vector22.x; float single21 = single3 + single2; if (single21 > 1f) { vector23.y = vector21.y + (vector22.y - vector21.y) * (1f - single3) / (single21 - single3); single21 = 1f; } while (single20 < 1f) { float single22 = single20 + single1; if (single22 > 1f) { vector23.x = vector21.x + (vector22.x - vector21.x) * (1f - single20) / (single22 - single20); single22 = 1f; } vertex.x = single22; vertex.y = -single3; vertex1.x = single22; vertex1.y = -single21; vertex2.x = single20; vertex2.y = -single21; vertex3.x = single20; vertex3.y = -single3; vertex.u = vector23.x; vertex.v = 1f - vector21.y; vertex1.u = vector23.x; vertex1.v = 1f - vector23.y; vertex2.u = vector21.x; vertex2.v = 1f - vector23.y; vertex3.u = vector21.x; vertex3.v = 1f - vector21.y; m.Quad(vertex, vertex1, vertex2, vertex3); single20 = single20 + single1; } single3 = single3 + single2; } }