Ejemplo n.º 1
0
        private void HSVToRGB()
        {
            Color color = EditorGUIUtility.HSVToRGB(this.m_H, this.m_S, this.m_V);

            this.m_R = color.r;
            this.m_G = color.g;
            this.m_B = color.b;
        }
Ejemplo n.º 2
0
        private static void HSVToRGBArray(Color[] colors)
        {
            int num = colors.Length;

            for (int i = 0; i < num; i++)
            {
                Color color  = colors[i];
                Color color2 = EditorGUIUtility.HSVToRGB(color.r, color.g, color.b);
                color2.a  = color.a;
                colors[i] = color2;
            }
        }
Ejemplo n.º 3
0
        public static Color GetPropertyColor(string name)
        {
            Color white = Color.white;
            int   num   = 0;

            if (name.StartsWith("m_LocalPosition"))
            {
                num = 1;
            }
            if (name.StartsWith("localEulerAngles"))
            {
                num = 2;
            }
            if (name.StartsWith("m_LocalScale"))
            {
                num = 3;
            }
            if (num == 1)
            {
                if (name.EndsWith(".x"))
                {
                    white = Handles.xAxisColor;
                }
                else if (name.EndsWith(".y"))
                {
                    white = Handles.yAxisColor;
                }
                else if (name.EndsWith(".z"))
                {
                    white = Handles.zAxisColor;
                }
            }
            else if (num == 2)
            {
                if (name.EndsWith(".x"))
                {
                    white = (Color)AnimEditor.kEulerXColor;
                }
                else if (name.EndsWith(".y"))
                {
                    white = (Color)AnimEditor.kEulerYColor;
                }
                else if (name.EndsWith(".z"))
                {
                    white = (Color)AnimEditor.kEulerZColor;
                }
            }
            else if (num == 3)
            {
                if (name.EndsWith(".x"))
                {
                    white = GetBalancedColor(new Color(0.7f, 0.4f, 0.4f));
                }
                else if (name.EndsWith(".y"))
                {
                    white = GetBalancedColor(new Color(0.4f, 0.7f, 0.4f));
                }
                else if (name.EndsWith(".z"))
                {
                    white = GetBalancedColor(new Color(0.4f, 0.4f, 0.7f));
                }
            }
            else if (name.EndsWith(".x"))
            {
                white = Handles.xAxisColor;
            }
            else if (name.EndsWith(".y"))
            {
                white = Handles.yAxisColor;
            }
            else if (name.EndsWith(".z"))
            {
                white = Handles.zAxisColor;
            }
            else if (name.EndsWith(".w"))
            {
                white = new Color(1f, 0.5f, 0f);
            }
            else if (name.EndsWith(".r"))
            {
                white = GetBalancedColor(Color.red);
            }
            else if (name.EndsWith(".g"))
            {
                white = GetBalancedColor(Color.green);
            }
            else if (name.EndsWith(".b"))
            {
                white = GetBalancedColor(Color.blue);
            }
            else if (name.EndsWith(".a"))
            {
                white = GetBalancedColor(Color.yellow);
            }
            else if (name.EndsWith(".width"))
            {
                white = GetBalancedColor(Color.blue);
            }
            else if (name.EndsWith(".height"))
            {
                white = GetBalancedColor(Color.yellow);
            }
            else
            {
                float f = 6.283185f * (name.GetHashCode() % 0x3e8);
                f    -= Mathf.Floor(f);
                white = GetBalancedColor(EditorGUIUtility.HSVToRGB(f, 1f, 1f));
            }
            white.a = 1f;
            return(white);
        }
Ejemplo n.º 4
0
        public static Color GetPropertyColor(string name)
        {
            Color result = Color.white;
            int   num    = 0;

            if (name.StartsWith("m_LocalPosition"))
            {
                num = 1;
            }
            if (name.StartsWith("localEulerAngles"))
            {
                num = 2;
            }
            if (name.StartsWith("m_LocalScale"))
            {
                num = 3;
            }
            if (num == 1)
            {
                if (name.EndsWith(".x"))
                {
                    result = Handles.xAxisColor;
                }
                else
                {
                    if (name.EndsWith(".y"))
                    {
                        result = Handles.yAxisColor;
                    }
                    else
                    {
                        if (name.EndsWith(".z"))
                        {
                            result = Handles.zAxisColor;
                        }
                    }
                }
            }
            else
            {
                if (num == 2)
                {
                    if (name.EndsWith(".x"))
                    {
                        result = AnimationWindow.kEulerXColor;
                    }
                    else
                    {
                        if (name.EndsWith(".y"))
                        {
                            result = AnimationWindow.kEulerYColor;
                        }
                        else
                        {
                            if (name.EndsWith(".z"))
                            {
                                result = AnimationWindow.kEulerZColor;
                            }
                        }
                    }
                }
                else
                {
                    if (num == 3)
                    {
                        if (name.EndsWith(".x"))
                        {
                            result = CurveUtility.GetBalancedColor(new Color(0.7f, 0.4f, 0.4f));
                        }
                        else
                        {
                            if (name.EndsWith(".y"))
                            {
                                result = CurveUtility.GetBalancedColor(new Color(0.4f, 0.7f, 0.4f));
                            }
                            else
                            {
                                if (name.EndsWith(".z"))
                                {
                                    result = CurveUtility.GetBalancedColor(new Color(0.4f, 0.4f, 0.7f));
                                }
                            }
                        }
                    }
                    else
                    {
                        if (name.EndsWith(".x"))
                        {
                            result = Handles.xAxisColor;
                        }
                        else
                        {
                            if (name.EndsWith(".y"))
                            {
                                result = Handles.yAxisColor;
                            }
                            else
                            {
                                if (name.EndsWith(".z"))
                                {
                                    result = Handles.zAxisColor;
                                }
                                else
                                {
                                    if (name.EndsWith(".w"))
                                    {
                                        result = new Color(1f, 0.5f, 0f);
                                    }
                                    else
                                    {
                                        if (name.EndsWith(".r"))
                                        {
                                            result = CurveUtility.GetBalancedColor(Color.red);
                                        }
                                        else
                                        {
                                            if (name.EndsWith(".g"))
                                            {
                                                result = CurveUtility.GetBalancedColor(Color.green);
                                            }
                                            else
                                            {
                                                if (name.EndsWith(".b"))
                                                {
                                                    result = CurveUtility.GetBalancedColor(Color.blue);
                                                }
                                                else
                                                {
                                                    if (name.EndsWith(".a"))
                                                    {
                                                        result = CurveUtility.GetBalancedColor(Color.yellow);
                                                    }
                                                    else
                                                    {
                                                        if (name.EndsWith(".width"))
                                                        {
                                                            result = CurveUtility.GetBalancedColor(Color.blue);
                                                        }
                                                        else
                                                        {
                                                            if (name.EndsWith(".height"))
                                                            {
                                                                result = CurveUtility.GetBalancedColor(Color.yellow);
                                                            }
                                                            else
                                                            {
                                                                float num2 = 6.28318548f * (float)(name.GetHashCode() % 1000);
                                                                num2  -= Mathf.Floor(num2);
                                                                result = CurveUtility.GetBalancedColor(EditorGUIUtility.HSVToRGB(num2, 1f, 1f));
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            result.a = 1f;
            return(result);
        }