FairyGUI.FillUtils.FillRadial360 C# (CSharp) Method

FillRadial360() public static method

public static FillRadial360 ( Origin360 origin, float amount, bool clockwise, Rect vertRect, Rect uvRect, Vector3 verts, Vector2 uv ) : void
origin Origin360
amount float
clockwise bool
vertRect UnityEngine.Rect
uvRect UnityEngine.Rect
verts UnityEngine.Vector3
uv UnityEngine.Vector2
return void
        public static void FillRadial360(Origin360 origin, float amount, bool clockwise, Rect vertRect, Rect uvRect, Vector3[] verts, Vector2[] uv)
        {
            switch (origin)
            {
                case Origin360.Top:
                    if (amount < 0.5f)
                    {
                        amount = amount / 0.5f;
                        vertRect.width /= 2;
                        uvRect.width /= 2;
                        if (clockwise)
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        FillRadial180(clockwise ? Origin180.Left : Origin180.Right, amount, clockwise, vertRect, uvRect, verts, uv);
                        verts[8] = verts[9] = verts[10] = verts[11] = verts[7];
                        uv[8] = uv[9] = uv[10] = uv[11] = uv[7];
                    }
                    else
                    {
                        vertRect.width /= 2;
                        uvRect.width /= 2;
                        if (!clockwise)
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        amount = (amount - 0.5f) / 0.5f;
                        FillRadial180(clockwise ? Origin180.Right : Origin180.Left, amount, clockwise, vertRect, uvRect, verts, uv);

                        if (clockwise)
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        else
                        {
                            vertRect.x -= vertRect.width;
                            uvRect.x -= uvRect.width;
                        }
                        NGraphics.FillVertsOfQuad(verts, 8, vertRect);
                        NGraphics.FillUVOfQuad(uv, 8, uvRect);
                    }
                    break;

                case Origin360.Bottom:
                    if (amount < 0.5f)
                    {
                        amount = amount / 0.5f;
                        vertRect.width /= 2;
                        uvRect.width /= 2;
                        if (!clockwise)
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        FillRadial180(clockwise ? Origin180.Right : Origin180.Left, amount, clockwise, vertRect, uvRect, verts, uv);
                        verts[8] = verts[9] = verts[10] = verts[11] = verts[7];
                        uv[8] = uv[9] = uv[10] = uv[11] = uv[7];
                    }
                    else
                    {
                        vertRect.width /= 2;
                        uvRect.width /= 2;
                        if (clockwise)
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        amount = (amount - 0.5f) / 0.5f;
                        FillRadial180(clockwise ? Origin180.Left : Origin180.Right, amount, clockwise, vertRect, uvRect, verts, uv);

                        if (clockwise)
                        {
                            vertRect.x -= vertRect.width;
                            uvRect.x -= uvRect.width;
                        }
                        else
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        NGraphics.FillVertsOfQuad(verts, 8, vertRect);
                        NGraphics.FillUVOfQuad(uv, 8, uvRect);
                    }
                    break;

                case Origin360.Left:
                    if (amount < 0.5f)
                    {
                        amount = amount / 0.5f;
                        if (clockwise)
                        {
                            vertRect.height /= 2;
                            uvRect.yMin += uvRect.height / 2;
                        }
                        else
                        {
                            vertRect.yMin += vertRect.height / 2;
                            uvRect.yMax -= uvRect.height / 2;
                        }
                        FillRadial180(clockwise ? Origin180.Bottom : Origin180.Top, amount, clockwise, vertRect, uvRect, verts, uv);
                        verts[8] = verts[9] = verts[10] = verts[11] = verts[7];
                        uv[8] = uv[9] = uv[10] = uv[11] = uv[7];
                    }
                    else
                    {
                        if (clockwise)
                        {
                            vertRect.yMin += vertRect.height / 2;
                            uvRect.yMax -= uvRect.height / 2;
                        }
                        else
                        {
                            vertRect.height /= 2;
                            uvRect.yMin += uvRect.height / 2;
                        }
                        amount = (amount - 0.5f) / 0.5f;
                        FillRadial180(clockwise ? Origin180.Top : Origin180.Bottom, amount, clockwise, vertRect, uvRect, verts, uv);

                        if (clockwise)
                        {
                            vertRect.y -= vertRect.height;
                            uvRect.y += uvRect.height;
                        }
                        else
                        {
                            vertRect.y += vertRect.height;
                            uvRect.y -= uvRect.height;
                        }
                        NGraphics.FillVertsOfQuad(verts, 8, vertRect);
                        NGraphics.FillUVOfQuad(uv, 8, uvRect);
                    }
                    break;

                case Origin360.Right:
                    if (amount < 0.5f)
                    {
                        if (clockwise)
                        {
                            vertRect.yMin += vertRect.height / 2;
                            uvRect.yMax -= uvRect.height / 2;
                        }
                        else
                        {
                            vertRect.height /= 2;
                            uvRect.yMin += uvRect.height / 2;
                        }
                        amount = amount / 0.5f;
                        FillRadial180(clockwise ? Origin180.Top : Origin180.Bottom, amount, clockwise, vertRect, uvRect, verts, uv);
                        verts[8] = verts[9] = verts[10] = verts[11] = verts[7];
                        uv[8] = uv[9] = uv[10] = uv[11] = uv[7];
                    }
                    else
                    {
                        if (clockwise)
                        {
                            vertRect.height /= 2;
                            uvRect.yMin += uvRect.height / 2;
                        }
                        else
                        {
                            vertRect.yMin += vertRect.height / 2;
                            uvRect.yMax -= uvRect.height / 2;
                        }

                        amount = (amount - 0.5f) / 0.5f;
                        FillRadial180(clockwise ? Origin180.Bottom : Origin180.Top, amount, clockwise, vertRect, uvRect, verts, uv);

                        if (clockwise)
                        {
                            vertRect.y += vertRect.height;
                            uvRect.y -= uvRect.height;
                        }
                        else
                        {
                            vertRect.y -= vertRect.height;
                            uvRect.y += uvRect.height;
                        }
                        NGraphics.FillVertsOfQuad(verts, 8, vertRect);
                        NGraphics.FillUVOfQuad(uv, 8, uvRect);
                    }
                    break;
            }
        }

Usage Example

Example #1
0
        public void Fill(FillMethod method, float amount, int origin, bool clockwise, Rect vertRect, Rect uvRect)
        {
            amount = Mathf.Clamp01(amount);
            switch (method)
            {
            case FillMethod.Horizontal:
                Alloc(4);
                FillUtils.FillHorizontal((OriginHorizontal)origin, amount, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Vertical:
                Alloc(4);
                FillUtils.FillVertical((OriginVertical)origin, amount, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Radial90:
                Alloc(4);
                FillUtils.FillRadial90((Origin90)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Radial180:
                Alloc(8);
                FillUtils.FillRadial180((Origin180)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                break;

            case FillMethod.Radial360:
                Alloc(12);
                FillUtils.FillRadial360((Origin360)origin, amount, clockwise, vertRect, uvRect, vertices, uv);
                break;
            }
        }
All Usage Examples Of FairyGUI.FillUtils::FillRadial360