12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- 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);
- //}
- }
- }
|