Exemplo n.º 1
0
        public void Copy(ref int start, Vertex[] v, Vector3[] transformed, int end, MeshBuffer p)
        {
            int num;
            int num1 = (end - start) / Primitive.VertexCount(this.kind);

Label0:
            int num2 = num1;

            num1 = num2 - 1;
            if (num2 <= 0)
            {
                return;
            }
            int num3 = p.Alloc(this.kind, out num);

            while (num3 < num)
            {
                p.v[num3].x = transformed[start].x;
                p.v[num3].y = transformed[start].y;
                p.v[num3].z = transformed[start].z;
                p.v[num3].u = v[start].u;
                p.v[num3].v = v[start].v;
                p.v[num3].r = v[start].r;
                p.v[num3].g = v[start].g;
                p.v[num3].b = v[start].b;
                p.v[num3].a = v[start].a;
                num3++;
                start = start + 1;
            }
            goto Label0;
        }
Exemplo n.º 2
0
        public void Copy(ref int start, Vertex[] v, int end, MeshBuffer p)
        {
            int num;
            int num1 = (end - start) / Primitive.VertexCount(this.kind);

Label0:
            int num2 = num1;

            num1 = num2 - 1;
            if (num2 <= 0)
            {
                return;
            }
            int num3 = p.Alloc(this.kind, out num);

            while (num3 < num)
            {
                int num4 = num3;
                num3 = num4 + 1;
                int num5 = start;
                int num6 = num5;
                start     = num5 + 1;
                p.v[num4] = v[num6];
            }
            goto Label0;
        }
        // Token: 0x06004B24 RID: 19236 RVA: 0x00122C54 File Offset: 0x00120E54
        public void Copy(ref int start, Vertex[] v, int end, MeshBuffer p)
        {
            int num = (end - start) / Primitive.VertexCount(this.kind);

            while (num-- > 0)
            {
                int num2;
                int i = p.Alloc(this.kind, out num2);
                while (i < num2)
                {
                    p.v[i++] = v[start++];
                }
            }
        }
        // Token: 0x06004B25 RID: 19237 RVA: 0x00122CC8 File Offset: 0x00120EC8
        public void Copy(ref int start, Vertex[] v, Vector3[] transformed, int end, MeshBuffer p)
        {
            int num = (end - start) / Primitive.VertexCount(this.kind);

            while (num-- > 0)
            {
                int num2;
                int i = p.Alloc(this.kind, out num2);
                while (i < num2)
                {
                    p.v[i].x = transformed[start].x;
                    p.v[i].y = transformed[start].y;
                    p.v[i].z = transformed[start].z;
                    p.v[i].u = v[start].u;
                    p.v[i].v = v[start].v;
                    p.v[i].r = v[start].r;
                    p.v[i].g = v[start].g;
                    p.v[i].b = v[start].b;
                    p.v[i].a = v[start].a;
                    i++;
                    start++;
                }
            }
        }
    // Token: 0x06004CFE RID: 19710 RVA: 0x0012E744 File Offset: 0x0012C944
    public override void OnFill(NGUI.Meshing.MeshBuffer m)
    {
        float num  = 0f;
        float num2 = 0f;
        float num3 = 1f;
        float num4 = -1f;
        float num5 = this.mOuterUV.xMin;
        float num6 = this.mOuterUV.yMin;
        float num7 = this.mOuterUV.xMax;
        float num8 = this.mOuterUV.yMax;

        if (this.mFillDirection == global::UIFilledSprite.FillDirection.Horizontal || this.mFillDirection == global::UIFilledSprite.FillDirection.Vertical)
        {
            float num9  = (num7 - num5) * this.mFillAmount;
            float num10 = (num8 - num6) * this.mFillAmount;
            if (this.fillDirection == global::UIFilledSprite.FillDirection.Horizontal)
            {
                if (this.mInvert)
                {
                    num  = 1f - this.mFillAmount;
                    num5 = num7 - num9;
                }
                else
                {
                    num3 *= this.mFillAmount;
                    num7  = num5 + num9;
                }
            }
            else if (this.fillDirection == global::UIFilledSprite.FillDirection.Vertical)
            {
                if (this.mInvert)
                {
                    num4 *= this.mFillAmount;
                    num6  = num8 - num10;
                }
                else
                {
                    num2 = -(1f - this.mFillAmount);
                    num8 = num6 + num10;
                }
            }
        }
        Vector2[] array  = new Vector2[4];
        Vector2[] array2 = new Vector2[4];
        array[0]  = new Vector2(num3, num2);
        array[1]  = new Vector2(num3, num4);
        array[2]  = new Vector2(num, num4);
        array[3]  = new Vector2(num, num2);
        array2[0] = new Vector2(num7, num8);
        array2[1] = new Vector2(num7, num6);
        array2[2] = new Vector2(num5, num6);
        array2[3] = new Vector2(num5, num8);
        Color color = base.color;

        if (this.fillDirection == global::UIFilledSprite.FillDirection.Radial90)
        {
            if (!this.AdjustRadial(array, array2, this.mFillAmount, this.mInvert))
            {
                return;
            }
        }
        else
        {
            if (this.fillDirection == global::UIFilledSprite.FillDirection.Radial180)
            {
                Vector2[] array3 = new Vector2[4];
                Vector2[] array4 = new Vector2[4];
                for (int i = 0; i < 2; i++)
                {
                    array3[0] = new Vector2(0f, 0f);
                    array3[1] = new Vector2(0f, 1f);
                    array3[2] = new Vector2(1f, 1f);
                    array3[3] = new Vector2(1f, 0f);
                    array4[0] = new Vector2(0f, 0f);
                    array4[1] = new Vector2(0f, 1f);
                    array4[2] = new Vector2(1f, 1f);
                    array4[3] = new Vector2(1f, 0f);
                    if (this.mInvert)
                    {
                        if (i > 0)
                        {
                            this.Rotate(array3, i);
                            this.Rotate(array4, i);
                        }
                    }
                    else if (i < 1)
                    {
                        this.Rotate(array3, 1 - i);
                        this.Rotate(array4, 1 - i);
                    }
                    float num11;
                    float num12;
                    if (i == 1)
                    {
                        num11 = ((!this.mInvert) ? 1f : 0.5f);
                        num12 = ((!this.mInvert) ? 0.5f : 1f);
                    }
                    else
                    {
                        num11 = ((!this.mInvert) ? 0.5f : 1f);
                        num12 = ((!this.mInvert) ? 1f : 0.5f);
                    }
                    array3[1].y = Mathf.Lerp(num11, num12, array3[1].y);
                    array3[2].y = Mathf.Lerp(num11, num12, array3[2].y);
                    array4[1].y = Mathf.Lerp(num11, num12, array4[1].y);
                    array4[2].y = Mathf.Lerp(num11, num12, array4[2].y);
                    float fill = this.mFillAmount * 2f - (float)i;
                    bool  flag = i % 2 == 1;
                    if (this.AdjustRadial(array3, array4, fill, !flag))
                    {
                        if (this.mInvert)
                        {
                            flag = !flag;
                        }
                        if (flag)
                        {
                            int num13 = m.Alloc(NGUI.Meshing.PrimitiveKind.Quad);
                            for (int j = 0; j < 4; j++)
                            {
                                m.v[num13].x = Mathf.Lerp(array[0].x, array[2].x, array3[j].x);
                                m.v[num13].y = Mathf.Lerp(array[0].y, array[2].y, array3[j].y);
                                m.v[num13].z = 0f;
                                m.v[num13].u = Mathf.Lerp(array2[0].x, array2[2].x, array4[j].x);
                                m.v[num13].v = Mathf.Lerp(array2[0].y, array2[2].y, array4[j].y);
                                m.v[num13].r = color.r;
                                m.v[num13].g = color.g;
                                m.v[num13].b = color.b;
                                m.v[num13].a = color.a;
                                num13++;
                            }
                        }
                        else
                        {
                            int num14 = m.Alloc(NGUI.Meshing.PrimitiveKind.Quad);
                            for (int k = 3; k > -1; k--)
                            {
                                m.v[num14].x = Mathf.Lerp(array[0].x, array[2].x, array3[k].x);
                                m.v[num14].y = Mathf.Lerp(array[0].y, array[2].y, array3[k].y);
                                m.v[num14].z = 0f;
                                m.v[num14].u = Mathf.Lerp(array2[0].x, array2[2].x, array4[k].x);
                                m.v[num14].v = Mathf.Lerp(array2[0].y, array2[2].y, array4[k].y);
                                m.v[num14].r = color.r;
                                m.v[num14].g = color.g;
                                m.v[num14].b = color.b;
                                m.v[num14].a = color.a;
                                num14++;
                            }
                        }
                    }
                }
                return;
            }
            if (this.fillDirection == global::UIFilledSprite.FillDirection.Radial360)
            {
                float[] array5 = 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[] array6 = new Vector2[4];
                Vector2[] array7 = new Vector2[4];
                for (int l = 0; l < 4; l++)
                {
                    array6[0] = new Vector2(0f, 0f);
                    array6[1] = new Vector2(0f, 1f);
                    array6[2] = new Vector2(1f, 1f);
                    array6[3] = new Vector2(1f, 0f);
                    array7[0] = new Vector2(0f, 0f);
                    array7[1] = new Vector2(0f, 1f);
                    array7[2] = new Vector2(1f, 1f);
                    array7[3] = new Vector2(1f, 0f);
                    if (this.mInvert)
                    {
                        if (l > 0)
                        {
                            this.Rotate(array6, l);
                            this.Rotate(array7, l);
                        }
                    }
                    else if (l < 3)
                    {
                        this.Rotate(array6, 3 - l);
                        this.Rotate(array7, 3 - l);
                    }
                    for (int n = 0; n < 4; n++)
                    {
                        int   num15 = (!this.mInvert) ? (l * 4) : ((3 - l) * 4);
                        float num16 = array5[num15];
                        float num17 = array5[num15 + 1];
                        float num18 = array5[num15 + 2];
                        float num19 = array5[num15 + 3];
                        array6[n].x = Mathf.Lerp(num16, num17, array6[n].x);
                        array6[n].y = Mathf.Lerp(num18, num19, array6[n].y);
                        array7[n].x = Mathf.Lerp(num16, num17, array7[n].x);
                        array7[n].y = Mathf.Lerp(num18, num19, array7[n].y);
                    }
                    float fill2 = this.mFillAmount * 4f - (float)l;
                    bool  flag2 = l % 2 == 1;
                    if (this.AdjustRadial(array6, array7, fill2, !flag2))
                    {
                        if (this.mInvert)
                        {
                            flag2 = !flag2;
                        }
                        if (flag2)
                        {
                            int num20 = m.Alloc(NGUI.Meshing.PrimitiveKind.Quad);
                            for (int num21 = 0; num21 < 4; num21++)
                            {
                                m.v[num20].x = Mathf.Lerp(array[0].x, array[2].x, array6[num21].x);
                                m.v[num20].y = Mathf.Lerp(array[0].y, array[2].y, array6[num21].y);
                                m.v[num20].z = 0f;
                                m.v[num20].u = Mathf.Lerp(array2[0].x, array2[2].x, array7[num21].x);
                                m.v[num20].v = Mathf.Lerp(array2[0].y, array2[2].y, array7[num21].y);
                                m.v[num20].r = color.r;
                                m.v[num20].g = color.g;
                                m.v[num20].b = color.b;
                                m.v[num20].a = color.a;
                                num20++;
                            }
                        }
                        else
                        {
                            int num22 = m.Alloc(NGUI.Meshing.PrimitiveKind.Quad);
                            for (int num23 = 3; num23 > -1; num23--)
                            {
                                m.v[num22].x = Mathf.Lerp(array[0].x, array[2].x, array6[num23].x);
                                m.v[num22].y = Mathf.Lerp(array[0].y, array[2].y, array6[num23].y);
                                m.v[num22].z = 0f;
                                m.v[num22].u = Mathf.Lerp(array2[0].x, array2[2].x, array7[num23].x);
                                m.v[num22].v = Mathf.Lerp(array2[0].y, array2[2].y, array7[num23].y);
                                m.v[num22].r = color.r;
                                m.v[num22].g = color.g;
                                m.v[num22].b = color.b;
                                m.v[num22].a = color.a;
                                num22++;
                            }
                        }
                    }
                }
                return;
            }
        }
        NGUI.Meshing.Vertex a;
        a.x = array[0].x;
        a.y = array[0].y;
        a.u = array2[0].x;
        a.v = array2[0].y;
        NGUI.Meshing.Vertex b;
        b.x = array[1].x;
        b.y = array[1].y;
        b.u = array2[1].x;
        b.v = array2[1].y;
        NGUI.Meshing.Vertex c;
        c.x = array[2].x;
        c.y = array[2].y;
        c.u = array2[2].x;
        c.v = array2[2].y;
        NGUI.Meshing.Vertex d;
        d.x = array[3].x;
        d.y = array[3].y;
        d.u = array2[3].x;
        d.v = array2[3].y;
        a.z = (b.z = (c.z = (d.z = 0f)));
        a.r = (b.r = (c.r = (d.r = color.r)));
        a.g = (b.g = (c.g = (d.g = color.g)));
        a.b = (b.b = (c.b = (d.b = color.b)));
        a.a = (b.a = (c.a = (d.a = color.a)));
        m.Quad(a, b, c, d);
    }
Exemplo n.º 6
0
    public override void OnFill(NGUI.Meshing.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);
    }