GetBalancedColor() публичный статический Метод

public static GetBalancedColor ( Color c ) : Color
c Color
Результат Color
Пример #1
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 = AnimEditor.kEulerXColor;
                }
                else if (name.EndsWith(".y"))
                {
                    result = AnimEditor.kEulerYColor;
                }
                else if (name.EndsWith(".z"))
                {
                    result = AnimEditor.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(Color.HSVToRGB(num2, 1f, 1f));
            }
            result.a = 1f;
            return(result);
        }