FairyGUI.FillUtils.FillRadial180 C# (CSharp) Method

FillRadial180() public static method

public static FillRadial180 ( Origin180 origin, float amount, bool clockwise, Rect vertRect, Rect uvRect, Vector3 verts, Vector2 uv ) : void
origin Origin180
amount float
clockwise bool
vertRect UnityEngine.Rect
uvRect UnityEngine.Rect
verts UnityEngine.Vector3
uv UnityEngine.Vector2
return void
        public static void FillRadial180(Origin180 origin, float amount, bool clockwise, Rect vertRect, Rect uvRect, Vector3[] verts, Vector2[] uv)
        {
            switch (origin)
            {
                case Origin180.Top:
                    if (amount <= 0.5f)
                    {
                        vertRect.width /= 2;
                        uvRect.width /= 2;
                        if (clockwise)
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        amount = amount / 0.5f;
                        FillRadial90(clockwise ? Origin90.TopLeft : Origin90.TopRight, amount, clockwise, vertRect, uvRect, verts, uv);
                        verts[4] = verts[5] = verts[6] = verts[7] = verts[0];
                        uv[4] = uv[5] = uv[6] = uv[7] = uv[0];
                    }
                    else
                    {
                        vertRect.width /= 2;
                        uvRect.width /= 2;
                        if (!clockwise)
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        amount = (amount - 0.5f) / 0.5f;
                        FillRadial90(clockwise ? Origin90.TopRight : Origin90.TopLeft, 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, 4, vertRect);
                        NGraphics.FillUVOfQuad(uv, 4, uvRect);
                    }
                    break;

                case Origin180.Bottom:
                    if (amount <= 0.5f)
                    {
                        vertRect.width /= 2;
                        uvRect.width /= 2;
                        if (!clockwise)
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        amount = amount / 0.5f;
                        FillRadial90(clockwise ? Origin90.BottomRight : Origin90.BottomLeft, amount, clockwise, vertRect, uvRect, verts, uv);
                        verts[4] = verts[5] = verts[6] = verts[7] = verts[0];
                        uv[4] = uv[5] = uv[6] = uv[7] = uv[0];
                    }
                    else
                    {
                        vertRect.width /= 2;
                        uvRect.width /= 2;
                        if (clockwise)
                        {
                            vertRect.x += vertRect.width;
                            uvRect.x += uvRect.width;
                        }
                        amount = (amount - 0.5f) / 0.5f;
                        FillRadial90(clockwise ? Origin90.BottomLeft : Origin90.BottomRight, 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, 4, vertRect);
                        NGraphics.FillUVOfQuad(uv, 4, uvRect);
                    }
                    break;

                case Origin180.Left:
                    if (amount <= 0.5f)
                    {
                        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;
                        FillRadial90(clockwise ? Origin90.BottomLeft : Origin90.TopLeft, amount, clockwise, vertRect, uvRect, verts, uv);
                        verts[4] = verts[5] = verts[6] = verts[7] = verts[0];
                        uv[4] = uv[5] = uv[6] = uv[7] = uv[0];
                    }
                    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;
                        FillRadial90(clockwise ? Origin90.TopLeft : Origin90.BottomLeft, 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, 4, vertRect);
                        NGraphics.FillUVOfQuad(uv, 4, uvRect);
                    }
                    break;

                case Origin180.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;
                        FillRadial90(clockwise ? Origin90.TopRight : Origin90.BottomRight, amount, clockwise, vertRect, uvRect, verts, uv);
                        verts[4] = verts[5] = verts[6] = verts[7] = verts[0];
                        uv[4] = uv[5] = uv[6] = uv[7] = uv[0];
                    }
                    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;
                        FillRadial90(clockwise ? Origin90.BottomRight : Origin90.TopRight, 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, 4, vertRect);
                        NGraphics.FillUVOfQuad(uv, 4, 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::FillRadial180