本文整理汇总了C#中UnityEngine.Color.RGBMultiplied方法的典型用法代码示例。如果您正苦于以下问题:C# Color.RGBMultiplied方法的具体用法?C# Color.RGBMultiplied怎么用?C# Color.RGBMultiplied使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Color
的用法示例。
在下文中一共展示了Color.RGBMultiplied方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TryGetColor
public static bool TryGetColor(bool allowHDR, out Color color)
{
bool flag = false;
if (ColorUtility.TryParseHtmlString(EditorGUIUtility.systemCopyBuffer, out color))
flag = true;
else if (EditorGUIUtility.HasPasteboardColor())
{
color = EditorGUIUtility.GetPasteboardColor();
flag = true;
}
if (!flag)
return false;
if (!allowHDR && (double) color.maxColorComponent > 1.0)
color = color.RGBMultiplied(1f / color.maxColorComponent);
return true;
}
示例2: SetColor
private void SetColor(Color c)
{
if (this.m_IsOSColorPicker)
{
OSColorPicker.color = c;
}
else
{
float hdrScaleFactor = this.m_HDRValues.m_HDRScaleFactor;
if (this.m_HDR)
{
float maxColorComponent = c.maxColorComponent;
if ((double) maxColorComponent > 1.0)
c = c.RGBMultiplied(1f / maxColorComponent);
this.SetHDRScaleFactor(Mathf.Max(1f, maxColorComponent));
}
if ((double) this.m_Color.r == (double) c.r && (double) this.m_Color.g == (double) c.g && ((double) this.m_Color.b == (double) c.b && (double) this.m_Color.a == (double) c.a) && (double) hdrScaleFactor == (double) this.m_HDRValues.m_HDRScaleFactor)
return;
if ((double) c.r > 1.0 || (double) c.g > 1.0 || (double) c.b > 1.0)
Debug.LogError((object) string.Format("Invalid normalized color: {0}, normalize value: {1}", (object) c, (object) this.m_HDRValues.m_HDRScaleFactor));
this.m_resetKeyboardControl = true;
this.SetNormalizedColor(c);
this.Repaint();
}
}
示例3: DrawInternal
private void DrawInternal(Rect rect, Color preset)
{
this.Init();
bool flag = preset.maxColorComponent > 1f;
if (flag)
{
preset = preset.RGBMultiplied((float) (1f / preset.maxColorComponent));
}
Color color = GUI.color;
if (((int) rect.height) == 14)
{
if (preset.a > 0.97f)
{
this.RenderSolidSwatch(rect, preset);
}
else
{
this.RenderSwatchWithAlpha(rect, preset, this.m_ColorSwatchTriangular);
}
if (flag)
{
GUI.Label(rect, "h");
}
}
else
{
this.RenderSwatchWithAlpha(rect, preset, this.m_MiniColorSwatchTriangular);
}
GUI.color = color;
}
示例4: DoHexColorTextField
internal static Color DoHexColorTextField(Rect rect, Color color, bool showAlpha, GUIStyle style)
{
bool flag = false;
if ((double) color.maxColorComponent > 1.0)
{
color = color.RGBMultiplied(1f / color.maxColorComponent);
flag = true;
}
Rect position = new Rect(rect.x, rect.y, 14f, rect.height);
rect.xMin += 14f;
GUI.Label(position, GUIContent.Temp("#"));
string text = !showAlpha ? ColorUtility.ToHtmlStringRGB(color) : ColorUtility.ToHtmlStringRGBA(color);
EditorGUI.BeginChangeCheck();
int controlId = GUIUtility.GetControlID(EditorGUI.s_TextFieldHash, FocusType.Keyboard, rect);
bool changed;
string str = EditorGUI.DoTextField(EditorGUI.s_RecycledEditor, controlId, rect, text, style, "0123456789ABCDEFabcdef", out changed, false, false, false);
if (EditorGUI.EndChangeCheck())
{
EditorGUI.s_RecycledEditor.text = EditorGUI.s_RecycledEditor.text.ToUpper();
Color color1;
if (ColorUtility.TryParseHtmlString("#" + str, out color1))
color = new Color(color1.r, color1.g, color1.b, !showAlpha ? color.a : color1.a);
}
if (flag)
{
EditorGUIUtility.SetIconSize(new Vector2(16f, 16f));
GUI.Label(new Rect(position.x - 20f, rect.y, 20f, 20f), EditorGUI.s_HDRWarning);
EditorGUIUtility.SetIconSize(Vector2.zero);
}
return color;
}
示例5: SetColor
private void SetColor(Color c)
{
if (this.m_IsOSColorPicker)
{
OSColorPicker.color = c;
}
else
{
float hDRScaleFactor = this.m_HDRValues.m_HDRScaleFactor;
if (this.m_HDR)
{
float maxColorComponent = c.maxColorComponent;
if (maxColorComponent > 1f)
{
c = c.RGBMultiplied((float) (1f / maxColorComponent));
}
this.SetHDRScaleFactor(Mathf.Max(1f, maxColorComponent));
}
if ((((this.m_Color.r != c.r) || (this.m_Color.g != c.g)) || ((this.m_Color.b != c.b) || (this.m_Color.a != c.a))) || (hDRScaleFactor != this.m_HDRValues.m_HDRScaleFactor))
{
if (((c.r > 1f) || (c.g > 1f)) || (c.b > 1f))
{
Debug.LogError(string.Format("Invalid normalized color: {0}, normalize value: {1}", c, this.m_HDRValues.m_HDRScaleFactor));
}
this.m_resetKeyboardControl = true;
this.SetNormalizedColor(c);
base.Repaint();
}
}
}
示例6: DrawInternal
private void DrawInternal(Rect rect, Color preset)
{
this.Init();
bool flag = (double) preset.maxColorComponent > 1.0;
if (flag)
preset = preset.RGBMultiplied(1f / preset.maxColorComponent);
Color color = GUI.color;
if ((int) rect.height == 14)
{
if ((double) preset.a > 0.970000028610229)
this.RenderSolidSwatch(rect, preset);
else
this.RenderSwatchWithAlpha(rect, preset, this.m_ColorSwatchTriangular);
if (flag)
GUI.Label(rect, "h");
}
else
this.RenderSwatchWithAlpha(rect, preset, this.m_MiniColorSwatchTriangular);
GUI.color = color;
}