511 lines
12 KiB
C#
511 lines
12 KiB
C#
using System;
|
|
using UnityEngine.Scripting;
|
|
|
|
namespace UnityEngine
|
|
{
|
|
// Token: 0x020003D5 RID: 981
|
|
[UsedByNativeCode]
|
|
public struct Color
|
|
{
|
|
// Token: 0x060037D5 RID: 14293 RVA: 0x0005F0A0 File Offset: 0x0005D2A0
|
|
public Color(float r, float g, float b, float a)
|
|
{
|
|
this.r = r;
|
|
this.g = g;
|
|
this.b = b;
|
|
this.a = a;
|
|
}
|
|
|
|
// Token: 0x060037D6 RID: 14294 RVA: 0x0005F0C0 File Offset: 0x0005D2C0
|
|
public Color(float r, float g, float b)
|
|
{
|
|
this.r = r;
|
|
this.g = g;
|
|
this.b = b;
|
|
this.a = 1f;
|
|
}
|
|
|
|
// Token: 0x060037D7 RID: 14295 RVA: 0x0005F0E4 File Offset: 0x0005D2E4
|
|
public override string ToString()
|
|
{
|
|
return UnityString.Format("RGBA({0:F3}, {1:F3}, {2:F3}, {3:F3})", new object[] { this.r, this.g, this.b, this.a });
|
|
}
|
|
|
|
// Token: 0x060037D8 RID: 14296 RVA: 0x0005F144 File Offset: 0x0005D344
|
|
public string ToString(string format)
|
|
{
|
|
return UnityString.Format("RGBA({0}, {1}, {2}, {3})", new object[]
|
|
{
|
|
this.r.ToString(format),
|
|
this.g.ToString(format),
|
|
this.b.ToString(format),
|
|
this.a.ToString(format)
|
|
});
|
|
}
|
|
|
|
// Token: 0x060037D9 RID: 14297 RVA: 0x0005F1A8 File Offset: 0x0005D3A8
|
|
public override int GetHashCode()
|
|
{
|
|
return this.GetHashCode();
|
|
}
|
|
|
|
// Token: 0x060037DA RID: 14298 RVA: 0x0005F1D8 File Offset: 0x0005D3D8
|
|
public override bool Equals(object other)
|
|
{
|
|
bool flag;
|
|
if (!(other is Color))
|
|
{
|
|
flag = false;
|
|
}
|
|
else
|
|
{
|
|
Color color = (Color)other;
|
|
flag = this.r.Equals(color.r) && this.g.Equals(color.g) && this.b.Equals(color.b) && this.a.Equals(color.a);
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
// Token: 0x060037DB RID: 14299 RVA: 0x0005F260 File Offset: 0x0005D460
|
|
public static Color operator +(Color a, Color b)
|
|
{
|
|
return new Color(a.r + b.r, a.g + b.g, a.b + b.b, a.a + b.a);
|
|
}
|
|
|
|
// Token: 0x060037DC RID: 14300 RVA: 0x0005F2B8 File Offset: 0x0005D4B8
|
|
public static Color operator -(Color a, Color b)
|
|
{
|
|
return new Color(a.r - b.r, a.g - b.g, a.b - b.b, a.a - b.a);
|
|
}
|
|
|
|
// Token: 0x060037DD RID: 14301 RVA: 0x0005F310 File Offset: 0x0005D510
|
|
public static Color operator *(Color a, Color b)
|
|
{
|
|
return new Color(a.r * b.r, a.g * b.g, a.b * b.b, a.a * b.a);
|
|
}
|
|
|
|
// Token: 0x060037DE RID: 14302 RVA: 0x0005F368 File Offset: 0x0005D568
|
|
public static Color operator *(Color a, float b)
|
|
{
|
|
return new Color(a.r * b, a.g * b, a.b * b, a.a * b);
|
|
}
|
|
|
|
// Token: 0x060037DF RID: 14303 RVA: 0x0005F3A8 File Offset: 0x0005D5A8
|
|
public static Color operator *(float b, Color a)
|
|
{
|
|
return new Color(a.r * b, a.g * b, a.b * b, a.a * b);
|
|
}
|
|
|
|
// Token: 0x060037E0 RID: 14304 RVA: 0x0005F3E8 File Offset: 0x0005D5E8
|
|
public static Color operator /(Color a, float b)
|
|
{
|
|
return new Color(a.r / b, a.g / b, a.b / b, a.a / b);
|
|
}
|
|
|
|
// Token: 0x060037E1 RID: 14305 RVA: 0x0005F428 File Offset: 0x0005D628
|
|
public static bool operator ==(Color lhs, Color rhs)
|
|
{
|
|
return lhs == rhs;
|
|
}
|
|
|
|
// Token: 0x060037E2 RID: 14306 RVA: 0x0005F450 File Offset: 0x0005D650
|
|
public static bool operator !=(Color lhs, Color rhs)
|
|
{
|
|
return !(lhs == rhs);
|
|
}
|
|
|
|
// Token: 0x060037E3 RID: 14307 RVA: 0x0005F470 File Offset: 0x0005D670
|
|
public static Color Lerp(Color a, Color b, float t)
|
|
{
|
|
t = Mathf.Clamp01(t);
|
|
return new Color(a.r + (b.r - a.r) * t, a.g + (b.g - a.g) * t, a.b + (b.b - a.b) * t, a.a + (b.a - a.a) * t);
|
|
}
|
|
|
|
// Token: 0x060037E4 RID: 14308 RVA: 0x0005F4F8 File Offset: 0x0005D6F8
|
|
public static Color LerpUnclamped(Color a, Color b, float t)
|
|
{
|
|
return new Color(a.r + (b.r - a.r) * t, a.g + (b.g - a.g) * t, a.b + (b.b - a.b) * t, a.a + (b.a - a.a) * t);
|
|
}
|
|
|
|
// Token: 0x060037E5 RID: 14309 RVA: 0x0005F578 File Offset: 0x0005D778
|
|
internal Color RGBMultiplied(float multiplier)
|
|
{
|
|
return new Color(this.r * multiplier, this.g * multiplier, this.b * multiplier, this.a);
|
|
}
|
|
|
|
// Token: 0x060037E6 RID: 14310 RVA: 0x0005F5B0 File Offset: 0x0005D7B0
|
|
internal Color AlphaMultiplied(float multiplier)
|
|
{
|
|
return new Color(this.r, this.g, this.b, this.a * multiplier);
|
|
}
|
|
|
|
// Token: 0x060037E7 RID: 14311 RVA: 0x0005F5E4 File Offset: 0x0005D7E4
|
|
internal Color RGBMultiplied(Color multiplier)
|
|
{
|
|
return new Color(this.r * multiplier.r, this.g * multiplier.g, this.b * multiplier.b, this.a);
|
|
}
|
|
|
|
// Token: 0x17000CD6 RID: 3286
|
|
// (get) Token: 0x060037E8 RID: 14312 RVA: 0x0005F630 File Offset: 0x0005D830
|
|
public static Color red
|
|
{
|
|
get
|
|
{
|
|
return new Color(1f, 0f, 0f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CD7 RID: 3287
|
|
// (get) Token: 0x060037E9 RID: 14313 RVA: 0x0005F660 File Offset: 0x0005D860
|
|
public static Color green
|
|
{
|
|
get
|
|
{
|
|
return new Color(0f, 1f, 0f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CD8 RID: 3288
|
|
// (get) Token: 0x060037EA RID: 14314 RVA: 0x0005F690 File Offset: 0x0005D890
|
|
public static Color blue
|
|
{
|
|
get
|
|
{
|
|
return new Color(0f, 0f, 1f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CD9 RID: 3289
|
|
// (get) Token: 0x060037EB RID: 14315 RVA: 0x0005F6C0 File Offset: 0x0005D8C0
|
|
public static Color white
|
|
{
|
|
get
|
|
{
|
|
return new Color(1f, 1f, 1f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CDA RID: 3290
|
|
// (get) Token: 0x060037EC RID: 14316 RVA: 0x0005F6F0 File Offset: 0x0005D8F0
|
|
public static Color black
|
|
{
|
|
get
|
|
{
|
|
return new Color(0f, 0f, 0f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CDB RID: 3291
|
|
// (get) Token: 0x060037ED RID: 14317 RVA: 0x0005F720 File Offset: 0x0005D920
|
|
public static Color yellow
|
|
{
|
|
get
|
|
{
|
|
return new Color(1f, 0.92156863f, 0.015686275f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CDC RID: 3292
|
|
// (get) Token: 0x060037EE RID: 14318 RVA: 0x0005F750 File Offset: 0x0005D950
|
|
public static Color cyan
|
|
{
|
|
get
|
|
{
|
|
return new Color(0f, 1f, 1f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CDD RID: 3293
|
|
// (get) Token: 0x060037EF RID: 14319 RVA: 0x0005F780 File Offset: 0x0005D980
|
|
public static Color magenta
|
|
{
|
|
get
|
|
{
|
|
return new Color(1f, 0f, 1f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CDE RID: 3294
|
|
// (get) Token: 0x060037F0 RID: 14320 RVA: 0x0005F7B0 File Offset: 0x0005D9B0
|
|
public static Color gray
|
|
{
|
|
get
|
|
{
|
|
return new Color(0.5f, 0.5f, 0.5f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CDF RID: 3295
|
|
// (get) Token: 0x060037F1 RID: 14321 RVA: 0x0005F7E0 File Offset: 0x0005D9E0
|
|
public static Color grey
|
|
{
|
|
get
|
|
{
|
|
return new Color(0.5f, 0.5f, 0.5f, 1f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CE0 RID: 3296
|
|
// (get) Token: 0x060037F2 RID: 14322 RVA: 0x0005F810 File Offset: 0x0005DA10
|
|
public static Color clear
|
|
{
|
|
get
|
|
{
|
|
return new Color(0f, 0f, 0f, 0f);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CE1 RID: 3297
|
|
// (get) Token: 0x060037F3 RID: 14323 RVA: 0x0005F840 File Offset: 0x0005DA40
|
|
public float grayscale
|
|
{
|
|
get
|
|
{
|
|
return 0.299f * this.r + 0.587f * this.g + 0.114f * this.b;
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CE2 RID: 3298
|
|
// (get) Token: 0x060037F4 RID: 14324 RVA: 0x0005F87C File Offset: 0x0005DA7C
|
|
public Color linear
|
|
{
|
|
get
|
|
{
|
|
return new Color(Mathf.GammaToLinearSpace(this.r), Mathf.GammaToLinearSpace(this.g), Mathf.GammaToLinearSpace(this.b), this.a);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CE3 RID: 3299
|
|
// (get) Token: 0x060037F5 RID: 14325 RVA: 0x0005F8C0 File Offset: 0x0005DAC0
|
|
public Color gamma
|
|
{
|
|
get
|
|
{
|
|
return new Color(Mathf.LinearToGammaSpace(this.r), Mathf.LinearToGammaSpace(this.g), Mathf.LinearToGammaSpace(this.b), this.a);
|
|
}
|
|
}
|
|
|
|
// Token: 0x17000CE4 RID: 3300
|
|
// (get) Token: 0x060037F6 RID: 14326 RVA: 0x0005F904 File Offset: 0x0005DB04
|
|
public float maxColorComponent
|
|
{
|
|
get
|
|
{
|
|
return Mathf.Max(Mathf.Max(this.r, this.g), this.b);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060037F7 RID: 14327 RVA: 0x0005F938 File Offset: 0x0005DB38
|
|
public static implicit operator Vector4(Color c)
|
|
{
|
|
return new Vector4(c.r, c.g, c.b, c.a);
|
|
}
|
|
|
|
// Token: 0x060037F8 RID: 14328 RVA: 0x0005F970 File Offset: 0x0005DB70
|
|
public static implicit operator Color(Vector4 v)
|
|
{
|
|
return new Color(v.x, v.y, v.z, v.w);
|
|
}
|
|
|
|
// Token: 0x17000CE5 RID: 3301
|
|
public float this[int index]
|
|
{
|
|
get
|
|
{
|
|
float num;
|
|
switch (index)
|
|
{
|
|
case 0:
|
|
num = this.r;
|
|
break;
|
|
case 1:
|
|
num = this.g;
|
|
break;
|
|
case 2:
|
|
num = this.b;
|
|
break;
|
|
case 3:
|
|
num = this.a;
|
|
break;
|
|
default:
|
|
throw new IndexOutOfRangeException("Invalid Vector3 index!");
|
|
}
|
|
return num;
|
|
}
|
|
set
|
|
{
|
|
switch (index)
|
|
{
|
|
case 0:
|
|
this.r = value;
|
|
break;
|
|
case 1:
|
|
this.g = value;
|
|
break;
|
|
case 2:
|
|
this.b = value;
|
|
break;
|
|
case 3:
|
|
this.a = value;
|
|
break;
|
|
default:
|
|
throw new IndexOutOfRangeException("Invalid Vector3 index!");
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x060037FB RID: 14331 RVA: 0x0005FA74 File Offset: 0x0005DC74
|
|
public static void RGBToHSV(Color rgbColor, out float H, out float S, out float V)
|
|
{
|
|
if (rgbColor.b > rgbColor.g && rgbColor.b > rgbColor.r)
|
|
{
|
|
Color.RGBToHSVHelper(4f, rgbColor.b, rgbColor.r, rgbColor.g, out H, out S, out V);
|
|
}
|
|
else if (rgbColor.g > rgbColor.r)
|
|
{
|
|
Color.RGBToHSVHelper(2f, rgbColor.g, rgbColor.b, rgbColor.r, out H, out S, out V);
|
|
}
|
|
else
|
|
{
|
|
Color.RGBToHSVHelper(0f, rgbColor.r, rgbColor.g, rgbColor.b, out H, out S, out V);
|
|
}
|
|
}
|
|
|
|
// Token: 0x060037FC RID: 14332 RVA: 0x0005FB2C File Offset: 0x0005DD2C
|
|
private static void RGBToHSVHelper(float offset, float dominantcolor, float colorone, float colortwo, out float H, out float S, out float V)
|
|
{
|
|
V = dominantcolor;
|
|
if (V != 0f)
|
|
{
|
|
float num;
|
|
if (colorone > colortwo)
|
|
{
|
|
num = colortwo;
|
|
}
|
|
else
|
|
{
|
|
num = colorone;
|
|
}
|
|
float num2 = V - num;
|
|
if (num2 != 0f)
|
|
{
|
|
S = num2 / V;
|
|
H = offset + (colorone - colortwo) / num2;
|
|
}
|
|
else
|
|
{
|
|
S = 0f;
|
|
H = offset + (colorone - colortwo);
|
|
}
|
|
H /= 6f;
|
|
if (H < 0f)
|
|
{
|
|
H += 1f;
|
|
}
|
|
}
|
|
else
|
|
{
|
|
S = 0f;
|
|
H = 0f;
|
|
}
|
|
}
|
|
|
|
// Token: 0x060037FD RID: 14333 RVA: 0x0005FBDC File Offset: 0x0005DDDC
|
|
public static Color HSVToRGB(float H, float S, float V)
|
|
{
|
|
return Color.HSVToRGB(H, S, V, true);
|
|
}
|
|
|
|
// Token: 0x060037FE RID: 14334 RVA: 0x0005FBFC File Offset: 0x0005DDFC
|
|
public static Color HSVToRGB(float H, float S, float V, bool hdr)
|
|
{
|
|
Color white = Color.white;
|
|
if (S == 0f)
|
|
{
|
|
white.r = V;
|
|
white.g = V;
|
|
white.b = V;
|
|
}
|
|
else if (V == 0f)
|
|
{
|
|
white.r = 0f;
|
|
white.g = 0f;
|
|
white.b = 0f;
|
|
}
|
|
else
|
|
{
|
|
white.r = 0f;
|
|
white.g = 0f;
|
|
white.b = 0f;
|
|
float num = H * 6f;
|
|
int num2 = (int)Mathf.Floor(num);
|
|
float num3 = num - (float)num2;
|
|
float num4 = V * (1f - S);
|
|
float num5 = V * (1f - S * num3);
|
|
float num6 = V * (1f - S * (1f - num3));
|
|
switch (num2 + 1)
|
|
{
|
|
case 0:
|
|
white.r = V;
|
|
white.g = num4;
|
|
white.b = num5;
|
|
break;
|
|
case 1:
|
|
white.r = V;
|
|
white.g = num6;
|
|
white.b = num4;
|
|
break;
|
|
case 2:
|
|
white.r = num5;
|
|
white.g = V;
|
|
white.b = num4;
|
|
break;
|
|
case 3:
|
|
white.r = num4;
|
|
white.g = V;
|
|
white.b = num6;
|
|
break;
|
|
case 4:
|
|
white.r = num4;
|
|
white.g = num5;
|
|
white.b = V;
|
|
break;
|
|
case 5:
|
|
white.r = num6;
|
|
white.g = num4;
|
|
white.b = V;
|
|
break;
|
|
case 6:
|
|
white.r = V;
|
|
white.g = num4;
|
|
white.b = num5;
|
|
break;
|
|
case 7:
|
|
white.r = V;
|
|
white.g = num6;
|
|
white.b = num4;
|
|
break;
|
|
}
|
|
if (!hdr)
|
|
{
|
|
white.r = Mathf.Clamp(white.r, 0f, 1f);
|
|
white.g = Mathf.Clamp(white.g, 0f, 1f);
|
|
white.b = Mathf.Clamp(white.b, 0f, 1f);
|
|
}
|
|
}
|
|
return white;
|
|
}
|
|
|
|
// Token: 0x04000D2A RID: 3370
|
|
public float r;
|
|
|
|
// Token: 0x04000D2B RID: 3371
|
|
public float g;
|
|
|
|
// Token: 0x04000D2C RID: 3372
|
|
public float b;
|
|
|
|
// Token: 0x04000D2D RID: 3373
|
|
public float a;
|
|
}
|
|
}
|