当前位置: 首页>>代码示例>>C#>>正文


C# Color.RGBMultiplied方法代码示例

本文整理汇总了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;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:16,代码来源:ColorClipboard.cs

示例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();
   }
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:25,代码来源:ColorPicker.cs

示例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;
 }
开发者ID:CarlosHBC,项目名称:UnityDecompiled,代码行数:30,代码来源:ColorPresetLibrary.cs

示例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;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:31,代码来源:EditorGUI.cs

示例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();
         }
     }
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:30,代码来源:ColorPicker.cs

示例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;
 }
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:20,代码来源:ColorPresetLibrary.cs


注:本文中的UnityEngine.Color.RGBMultiplied方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。