Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="lineSize"></param>
        /// <param name="lineColor"></param>
        /// <param name="fillColor"></param>
        /// <param name="topLeftRadius"></param>
        /// <param name="topRightRadius"></param>
        /// <param name="bottomLeftRadius"></param>
        /// <param name="bottomRightRadius"></param>
        public void DrawRoundRect(float lineSize, Color lineColor, Color fillColor,
                                  float topLeftRadius, float topRightRadius, float bottomLeftRadius, float bottomRightRadius)
        {
            RoundedRectMesh mesh = graphics.GetMeshFactory <RoundedRectMesh>();

            mesh.lineWidth         = lineSize;
            mesh.lineColor         = lineColor;
            mesh.fillColor         = null;
            mesh.topLeftRadius     = topLeftRadius;
            mesh.topRightRadius    = topRightRadius;
            mesh.bottomLeftRadius  = bottomLeftRadius;
            mesh.bottomRightRadius = bottomRightRadius;

            graphics.color = fillColor;
            graphics.SetMeshDirty();
        }
        void UpdateShape()
        {
            if (_border > 0 || _backgroundColor.a > 0)
            {
                CreateGraphics();

                graphics.enabled = true;
                RoundedRectMesh mesh = graphics.GetMeshFactory <RoundedRectMesh>();
                mesh.lineWidth     = _border;
                mesh.lineColor     = _borderColor;
                mesh.fillColor     = _backgroundColor;
                mesh.topLeftRadius = mesh.topRightRadius = mesh.bottomLeftRadius = mesh.bottomRightRadius = corner;
                graphics.SetMeshDirty();
            }
            else
            {
                if (graphics != null)
                {
                    graphics.enabled = false;
                }
            }
        }