using UnityEngine;

namespace PublicTools.Unity
{
    public struct XColor
    {
        //
        // 摘要:
        //     Red component of the color.
        public float r;
        //
        // 摘要:
        //     Green component of the color.
        public float g;
        //
        // 摘要:
        //     Blue component of the color.
        public float b;
        //
        // 摘要:
        //     Alpha component of the color (0 is transparent, 1 is opaque).
        public float a;
        //
        // 摘要:
        //     Constructs a new Color with given r,g,b components and sets a to 1.
        //
        // 参数:
        //   r:
        //     Red component.
        //
        //   g:
        //     Green component.
        //
        //   b:
        //     Blue component.
        public XColor(float r, float g, float b)
        {
            this.r = r;
            this.g = g;
            this.b = b;
            this.a = 1;
        }
        //
        // 摘要:
        //     Constructs a new Color with given r,g,b,a components.
        //
        // 参数:
        //   r:
        //     Red component.
        //
        //   g:
        //     Green component.
        //
        //   b:
        //     Blue component.
        //
        //   a:
        //     Alpha component.
        public XColor(float r, float g, float b, float a)
        {
            this.r = r;
            this.g = g;
            this.b = b;
            this.a = a;
        }
        public XColor(Color color)
        {
            this.r = color.r;
            this.g = color.g;
            this.b = color.b;
            this.a = color.a;
        }
        public Color Trans()
        {
            Color color = Color.black;
            color.r = this.r;
            color.g = this.g;
            color.b = this.b;
            color.a = this.a;
            return color;
        }
        public void Trans(Color color)
        {
            this.r = color.r;
            this.g = color.g;
            this.b = color.b;
            this.a = color.a;
        }
        //public override string ToString()
        //{
        //    return JsonConvert.SerializeObject(this);
        //}
    }
}