コード例 #1
0
 public override void OnFill(NGUI.Meshing.MeshBuffer m)
 {
     if (base.mOuterUV == this.mInnerUV)
     {
         base.OnFill(m);
     }
     else
     {
         NineRectangle rectangle;
         NineRectangle rectangle2;
         Vector4       vector;
         Vector4       vector2;
         float3        num = new float3 {
             xyz = base.cachedTransform.localScale
         };
         vector.x  = this.mOuterUV.xMin;
         vector.y  = this.mInnerUV.xMin;
         vector.z  = this.mInnerUV.xMax;
         vector.w  = this.mOuterUV.xMax;
         vector2.x = this.mOuterUV.yMin;
         vector2.y = this.mInnerUV.yMin;
         vector2.z = this.mInnerUV.yMax;
         vector2.w = this.mOuterUV.yMax;
         NineRectangle.Calculate(base.pivot, base.atlas.pixelSize, base.mainTexture, ref vector, ref vector2, ref num.xy, out rectangle, out rectangle2);
         Color color = base.color;
         if (this.mFillCenter)
         {
             NineRectangle.Fill9(ref rectangle, ref rectangle2, ref color, m);
         }
         else
         {
             NineRectangle.Fill8(ref rectangle, ref rectangle2, ref color, m);
         }
     }
 }
コード例 #2
0
    public override void OnFill(MeshBuffer m)
    {
        NineRectangle nineRectangle;
        NineRectangle nineRectangle1;
        Vector4       vector4  = new Vector4();
        Vector4       vector41 = new Vector4();

        if (this.mOuterUV == this.mInnerUV)
        {
            base.OnFill(m);
            return;
        }
        float3 _float3 = new float3()
        {
            xyz = base.cachedTransform.localScale
        };

        vector4.x  = this.mOuterUV.xMin;
        vector4.y  = this.mInnerUV.xMin;
        vector4.z  = this.mInnerUV.xMax;
        vector4.w  = this.mOuterUV.xMax;
        vector41.x = this.mOuterUV.yMin;
        vector41.y = this.mInnerUV.yMin;
        vector41.z = this.mInnerUV.yMax;
        vector41.w = this.mOuterUV.yMax;
        NineRectangle.Calculate(base.pivot, base.atlas.pixelSize, base.mainTexture, ref vector4, ref vector41, ref _float3.xy, out nineRectangle, out nineRectangle1);
        Color color = base.color;

        if (!this.mFillCenter)
        {
            NineRectangle.Fill8(ref nineRectangle, ref nineRectangle1, ref color, m);
        }
        else
        {
            NineRectangle.Fill9(ref nineRectangle, ref nineRectangle1, ref color, m);
        }
    }
コード例 #3
0
ファイル: UISpriteWheel.cs プロジェクト: salvadj1/RustSource
    public override void OnFill(MeshBuffer m)
    {
        NineRectangle rectangle;
        NineRectangle rectangle2;
        NineRectangle rectangle3;
        NineRectangle rectangle4;
        Vector4       vector;
        Vector4       vector2;
        float         num  = this._degreesOfRotation * 0.01745329f;
        float         num2 = this._sliceDegrees * 0.01745329f;
        float         num3 = this._sliceFill;
        int           num4 = this.slices + 1;
        float         num5 = (num - (num2 * this.slices)) * num3;
        float         num6 = num5 / ((float)num4);
        float         num7 = num5 / 6.283185f;
        float         num8 = (num - num5) / ((float)num4);
        float3        num9 = new float3 {
            xyz = base.cachedTransform.localScale
        };
        float num10 = (num9.x >= num9.y) ? num9.x : num9.y;

        num9.xy.x = ((3.141593f * num10) / ((float)num4)) * num7;
        num9.xy.y = num10 * (this.outerRadius * 0.5f);
        vector.x  = this.mOuterUV.xMin;
        vector.y  = this.mInnerUV.xMin;
        vector.z  = this.mInnerUV.xMax;
        vector.w  = this.mOuterUV.xMax;
        vector2.x = this.mOuterUV.yMin;
        vector2.y = this.mInnerUV.yMin;
        vector2.z = this.mInnerUV.yMax;
        vector2.w = this.mOuterUV.yMax;
        NineRectangle.Calculate(UIWidget.Pivot.Center, base.atlas.pixelSize, base.mainTexture, ref vector, ref vector2, ref num9.xy, out rectangle, out rectangle3);
        if ((this.innerRadius > 0f) && !Mathf.Approximately(rectangle.zz.x - rectangle.yy.x, 0f))
        {
            num9.xy.x = (((3.141593f * num10) * this.innerRadius) / ((float)num4)) * num7;
            NineRectangle.Calculate(UIWidget.Pivot.Center, base.atlas.pixelSize, base.mainTexture, ref vector, ref vector2, ref num9.xy, out rectangle2, out rectangle4);
            float num11 = (rectangle.yy.x + rectangle.zz.x) * 0.5f;
            if (rectangle2.yy.x > num11)
            {
                float num12 = (rectangle2.yy.x - num11) / (rectangle.ww.x - num11);
                if (num12 >= 1f)
                {
                    rectangle2.xx.x = rectangle.xx.x;
                    rectangle2.xx.y = rectangle.xx.y;
                    rectangle2.yy.x = rectangle.yy.x;
                    rectangle2.yy.y = rectangle.yy.y;
                    rectangle2.zz.x = rectangle.zz.x;
                    rectangle2.zz.y = rectangle.zz.y;
                    rectangle2.ww.x = rectangle.ww.x;
                    rectangle2.ww.y = rectangle.ww.y;
                    rectangle4.xx.x = rectangle3.xx.x;
                    rectangle4.xx.y = rectangle3.xx.y;
                    rectangle4.yy.x = rectangle3.yy.x;
                    rectangle4.yy.y = rectangle3.yy.y;
                    rectangle4.zz.x = rectangle3.zz.x;
                    rectangle4.zz.y = rectangle3.zz.y;
                    rectangle4.ww.x = rectangle3.ww.x;
                    rectangle4.ww.y = rectangle3.ww.y;
                }
                else
                {
                    float num13 = 1f - num12;
                    rectangle2.xx.y = (rectangle.xx.y * num12) + (rectangle2.xx.y * num13);
                    rectangle2.yy.x = (rectangle.yy.x * num12) + (0.5f * num13);
                    rectangle2.yy.y = (rectangle.yy.y * num12) + (rectangle2.yy.y * num13);
                    rectangle2.zz.x = (rectangle.zz.x * num12) + (0.5f * num13);
                    rectangle2.zz.y = (rectangle.zz.y * num12) + (rectangle2.zz.y * num13);
                    rectangle2.ww.y = (rectangle.ww.y * num12) + (rectangle2.ww.y * num13);
                    rectangle2.ww.x = rectangle.ww.x;
                    rectangle2.xx.x = rectangle.xx.x;
                }
            }
        }
        else
        {
            rectangle2.xx.x = rectangle.xx.x;
            rectangle2.xx.y = rectangle.xx.y;
            rectangle2.yy.x = rectangle.yy.x;
            rectangle2.yy.y = rectangle.yy.y;
            rectangle2.zz.x = rectangle.zz.x;
            rectangle2.zz.y = rectangle.zz.y;
            rectangle2.ww.x = rectangle.ww.x;
            rectangle2.ww.y = rectangle.ww.y;
            rectangle4.xx.x = rectangle3.xx.x;
            rectangle4.xx.y = rectangle3.xx.y;
            rectangle4.yy.x = rectangle3.yy.x;
            rectangle4.yy.y = rectangle3.yy.y;
            rectangle4.zz.x = rectangle3.zz.x;
            rectangle4.zz.y = rectangle3.zz.y;
            rectangle4.ww.x = rectangle3.ww.x;
            rectangle4.ww.y = rectangle3.ww.y;
        }
        float num14 = Mathf.Abs((float)(rectangle.ww.x - rectangle.xx.x));
        float num15 = num6 / num14;

        if (num2 > 0f)
        {
            num14 += num2 / num15;
            num15  = num6 / num14;
        }
        float num16 = this.innerRadius * 0.5f;
        float num17 = this.outerRadius * 0.5f;
        float num18 = Mathf.Min(rectangle.xx.y, rectangle.ww.y);
        float num19 = Mathf.Max(rectangle.ww.y, rectangle.xx.y) - num18;
        Color color = base.color;
        int   vSize = m.vSize;
        float num21 = num8 + num6;
        float num22 = ((num8 * -0.5f) + (((this._facialRotationOffset * 0.5f) + 0.5f) * num6)) + (this._addDegrees * 0.01745329f);

        while (true)
        {
            Vertex[] v     = m.v;
            int      num23 = m.vSize;
            for (int i = vSize; i < num23; i++)
            {
                float num25 = num16 + (((v[i].y - num18) / num19) * num17);
                float f     = (v[i].x * num15) + num22;
                v[i].x = 0.5f + (Mathf.Sin(f) * num25);
                v[i].y = -0.5f + (Mathf.Cos(f) * num25);
            }
            if (--num4 <= 0)
            {
                return;
            }
            num22 += num21;
            vSize  = num23;
        }
    }
コード例 #4
0
    public override void OnFill(MeshBuffer m)
    {
        NineRectangle nineRectangle;
        NineRectangle nineRectangle1 = new NineRectangle();
        NineRectangle nineRectangle2;
        NineRectangle nineRectangle3 = new NineRectangle();
        Vector4       vector4        = new Vector4();
        Vector4       vector41       = new Vector4();
        float         single         = this._degreesOfRotation * 0.0174532924f;
        float         single1        = this._sliceDegrees * 0.0174532924f;
        float         single2        = this._sliceFill;
        int           num            = this.slices + 1;
        float         single3        = (single - single1 * (float)this.slices) * single2;
        float         single4        = single3 / (float)num;
        float         single5        = single3 / 6.28318548f;
        float         single6        = (single - single3) / (float)num;
        float3        _float3        = new float3()
        {
            xyz = base.cachedTransform.localScale
        };
        float single7 = (_float3.x >= _float3.y ? _float3.x : _float3.y);

        _float3.xy.x = 3.14159274f * single7 / (float)num * single5;
        _float3.xy.y = single7 * (this.outerRadius * 0.5f);
        vector4.x    = this.mOuterUV.xMin;
        vector4.y    = this.mInnerUV.xMin;
        vector4.z    = this.mInnerUV.xMax;
        vector4.w    = this.mOuterUV.xMax;
        vector41.x   = this.mOuterUV.yMin;
        vector41.y   = this.mInnerUV.yMin;
        vector41.z   = this.mInnerUV.yMax;
        vector41.w   = this.mOuterUV.yMax;
        NineRectangle.Calculate(UIWidget.Pivot.Center, base.atlas.pixelSize, base.mainTexture, ref vector4, ref vector41, ref _float3.xy, out nineRectangle, out nineRectangle2);
        if (this.innerRadius <= 0f || Mathf.Approximately(nineRectangle.zz.x - nineRectangle.yy.x, 0f))
        {
            nineRectangle1.xx.x = nineRectangle.xx.x;
            nineRectangle1.xx.y = nineRectangle.xx.y;
            nineRectangle1.yy.x = nineRectangle.yy.x;
            nineRectangle1.yy.y = nineRectangle.yy.y;
            nineRectangle1.zz.x = nineRectangle.zz.x;
            nineRectangle1.zz.y = nineRectangle.zz.y;
            nineRectangle1.ww.x = nineRectangle.ww.x;
            nineRectangle1.ww.y = nineRectangle.ww.y;
            nineRectangle3.xx.x = nineRectangle2.xx.x;
            nineRectangle3.xx.y = nineRectangle2.xx.y;
            nineRectangle3.yy.x = nineRectangle2.yy.x;
            nineRectangle3.yy.y = nineRectangle2.yy.y;
            nineRectangle3.zz.x = nineRectangle2.zz.x;
            nineRectangle3.zz.y = nineRectangle2.zz.y;
            nineRectangle3.ww.x = nineRectangle2.ww.x;
            nineRectangle3.ww.y = nineRectangle2.ww.y;
        }
        else
        {
            _float3.xy.x = 3.14159274f * single7 * this.innerRadius / (float)num * single5;
            NineRectangle.Calculate(UIWidget.Pivot.Center, base.atlas.pixelSize, base.mainTexture, ref vector4, ref vector41, ref _float3.xy, out nineRectangle1, out nineRectangle3);
            float single8 = (nineRectangle.yy.x + nineRectangle.zz.x) * 0.5f;
            if (nineRectangle1.yy.x > single8)
            {
                float single9 = (nineRectangle1.yy.x - single8) / (nineRectangle.ww.x - single8);
                if (single9 < 1f)
                {
                    float single10 = 1f - single9;
                    nineRectangle1.xx.y = nineRectangle.xx.y * single9 + nineRectangle1.xx.y * single10;
                    nineRectangle1.yy.x = nineRectangle.yy.x * single9 + 0.5f * single10;
                    nineRectangle1.yy.y = nineRectangle.yy.y * single9 + nineRectangle1.yy.y * single10;
                    nineRectangle1.zz.x = nineRectangle.zz.x * single9 + 0.5f * single10;
                    nineRectangle1.zz.y = nineRectangle.zz.y * single9 + nineRectangle1.zz.y * single10;
                    nineRectangle1.ww.y = nineRectangle.ww.y * single9 + nineRectangle1.ww.y * single10;
                    nineRectangle1.ww.x = nineRectangle.ww.x;
                    nineRectangle1.xx.x = nineRectangle.xx.x;
                }
                else
                {
                    nineRectangle1.xx.x = nineRectangle.xx.x;
                    nineRectangle1.xx.y = nineRectangle.xx.y;
                    nineRectangle1.yy.x = nineRectangle.yy.x;
                    nineRectangle1.yy.y = nineRectangle.yy.y;
                    nineRectangle1.zz.x = nineRectangle.zz.x;
                    nineRectangle1.zz.y = nineRectangle.zz.y;
                    nineRectangle1.ww.x = nineRectangle.ww.x;
                    nineRectangle1.ww.y = nineRectangle.ww.y;
                    nineRectangle3.xx.x = nineRectangle2.xx.x;
                    nineRectangle3.xx.y = nineRectangle2.xx.y;
                    nineRectangle3.yy.x = nineRectangle2.yy.x;
                    nineRectangle3.yy.y = nineRectangle2.yy.y;
                    nineRectangle3.zz.x = nineRectangle2.zz.x;
                    nineRectangle3.zz.y = nineRectangle2.zz.y;
                    nineRectangle3.ww.x = nineRectangle2.ww.x;
                    nineRectangle3.ww.y = nineRectangle2.ww.y;
                }
            }
        }
        float single11 = Mathf.Abs(nineRectangle.ww.x - nineRectangle.xx.x);
        float single12 = single4 / single11;

        if (single1 > 0f)
        {
            single11 = single11 + single1 / single12;
            single12 = single4 / single11;
        }
        float single13 = this.innerRadius * 0.5f;
        float single14 = this.outerRadius * 0.5f;
        float single15 = Mathf.Min(nineRectangle.xx.y, nineRectangle.ww.y);
        float single16 = Mathf.Max(nineRectangle.ww.y, nineRectangle.xx.y) - single15;
        Color color    = base.color;
        int   num1     = m.vSize;
        float single17 = single6 + single4;
        float single18 = single6 * -0.5f + (this._facialRotationOffset * 0.5f + 0.5f) * single4 + this._addDegrees * 0.0174532924f;

        while (true)
        {
            Vertex[] vertexArray = m.v;
            int      num2        = m.vSize;
            for (int i = num1; i < num2; i++)
            {
                float single19 = single13 + (vertexArray[i].y - single15) / single16 * single14;
                float single20 = vertexArray[i].x * single12 + single18;
                vertexArray[i].x = 0.5f + Mathf.Sin(single20) * single19;
                vertexArray[i].y = -0.5f + Mathf.Cos(single20) * single19;
            }
            int num3 = num - 1;
            num = num3;
            if (num3 <= 0)
            {
                break;
            }
            single18 = single18 + single17;
            num1     = num2;
        }
    }