GetColor() приватный статический Метод

private static GetColor ( SerializedMinMaxCurve mmCurve ) : Color
mmCurve SerializedMinMaxCurve
Результат Color
Пример #1
0
        public static void GUIMinMaxCurve(GUIContent label, SerializedMinMaxCurve mmCurve)
        {
            Rect             controlRect = ModuleUI.GetControlRect(13);
            Rect             popupRect   = ModuleUI.GetPopupRect(controlRect);
            Rect             rect1       = ModuleUI.SubtractPopupWidth(controlRect);
            Rect             position    = ModuleUI.PrefixLabel(rect1, label);
            MinMaxCurveState state       = mmCurve.state;

            switch (state)
            {
            case MinMaxCurveState.k_Scalar:
                float a = ModuleUI.FloatDraggable(rect1, mmCurve.scalar, mmCurve.m_RemapValue, EditorGUIUtility.labelWidth);
                if (!mmCurve.signedRange)
                {
                    mmCurve.scalar.floatValue = Mathf.Max(a, 0.0f);
                    break;
                }
                break;

            case MinMaxCurveState.k_TwoScalars:
                Rect rect2 = position;
                rect2.width = (float)(((double)position.width - 20.0) * 0.5);
                float minConstant = mmCurve.minConstant;
                float maxConstant = mmCurve.maxConstant;
                Rect  rect3       = rect2;
                rect3.xMin -= 20f;
                EditorGUI.BeginChangeCheck();
                float num1 = ModuleUI.FloatDraggable(rect3, minConstant, mmCurve.m_RemapValue, 20f, "g5");
                if (EditorGUI.EndChangeCheck())
                {
                    mmCurve.minConstant = num1;
                }
                rect3.x += rect2.width + 20f;
                EditorGUI.BeginChangeCheck();
                float num2 = ModuleUI.FloatDraggable(rect3, maxConstant, mmCurve.m_RemapValue, 20f, "g5");
                if (EditorGUI.EndChangeCheck())
                {
                    mmCurve.maxConstant = num2;
                    break;
                }
                break;

            default:
                Rect ranges = !mmCurve.signedRange ? ModuleUI.kUnsignedRange : ModuleUI.kSignedRange;
                SerializedProperty minCurve = state != MinMaxCurveState.k_TwoCurves ? (SerializedProperty)null : mmCurve.minCurve;
                ModuleUI.GUICurveField(position, mmCurve.maxCurve, minCurve, ModuleUI.GetColor(mmCurve), ranges, new ModuleUI.CurveFieldMouseDownCallback(mmCurve.OnCurveAreaMouseDown));
                break;
            }
            ModuleUI.GUIMMCurveStateList(popupRect, mmCurve);
        }
Пример #2
0
        public static void GUIMinMaxCurve(GUIContent label, SerializedMinMaxCurve mmCurve)
        {
            Rect rect      = ModuleUI.GetControlRect(13);
            Rect popupRect = ModuleUI.GetPopupRect(rect);

            rect = ModuleUI.SubtractPopupWidth(rect);
            Rect             rect2 = ModuleUI.PrefixLabel(rect, label);
            MinMaxCurveState state = mmCurve.state;

            if (state == MinMaxCurveState.k_Scalar)
            {
                float a = ModuleUI.FloatDraggable(rect, mmCurve.scalar, mmCurve.m_RemapValue, EditorGUIUtility.labelWidth);
                if (!mmCurve.signedRange)
                {
                    mmCurve.scalar.floatValue = Mathf.Max(a, 0f);
                }
            }
            else
            {
                if (state == MinMaxCurveState.k_TwoScalars)
                {
                    Rect rect3 = rect2;
                    rect3.width = (rect2.width - 20f) * 0.5f;
                    float num   = mmCurve.minConstant;
                    float num2  = mmCurve.maxConstant;
                    Rect  rect4 = rect3;
                    rect4.xMin -= 20f;
                    EditorGUI.BeginChangeCheck();
                    num = ModuleUI.FloatDraggable(rect4, num, mmCurve.m_RemapValue, 20f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        mmCurve.minConstant = num;
                    }
                    rect4.x += rect3.width + 20f;
                    EditorGUI.BeginChangeCheck();
                    num2 = ModuleUI.FloatDraggable(rect4, num2, mmCurve.m_RemapValue, 20f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        mmCurve.maxConstant = num2;
                    }
                }
                else
                {
                    Rect ranges = (!mmCurve.signedRange) ? ModuleUI.kUnsignedRange : ModuleUI.kSignedRange;
                    SerializedProperty minCurve = (state != MinMaxCurveState.k_TwoCurves) ? null : mmCurve.minCurve;
                    ModuleUI.GUICurveField(rect2, mmCurve.maxCurve, minCurve, ModuleUI.GetColor(mmCurve), ranges, new ModuleUI.CurveFieldMouseDownCallback(mmCurve.OnCurveAreaMouseDown));
                }
            }
            ModuleUI.GUIMMCurveStateList(popupRect, mmCurve);
        }
Пример #3
0
        public void GUITripleMinMaxCurve(GUIContent label, GUIContent x, SerializedMinMaxCurve xCurve, GUIContent y, SerializedMinMaxCurve yCurve, GUIContent z, SerializedMinMaxCurve zCurve, SerializedProperty randomizePerFrame)
        {
            MinMaxCurveState state = xCurve.state;
            bool             flag  = label != GUIContent.none;
            int num = (!flag) ? 1 : 2;

            if (state == MinMaxCurveState.k_TwoScalars)
            {
                num++;
            }
            Rect rect      = ModuleUI.GetControlRect(13 * num);
            Rect popupRect = ModuleUI.GetPopupRect(rect);

            rect = ModuleUI.SubtractPopupWidth(rect);
            Rect  rect2 = rect;
            float num2  = (rect.width - 8f) / 3f;

            if (num > 1)
            {
                rect2.height = 13f;
            }
            if (flag)
            {
                ModuleUI.PrefixLabel(rect, label);
                rect2.y += rect2.height;
            }
            rect2.width = num2;
            GUIContent[] array = new GUIContent[]
            {
                x,
                y,
                z
            };
            SerializedMinMaxCurve[] array2 = new SerializedMinMaxCurve[]
            {
                xCurve,
                yCurve,
                zCurve
            };
            if (state == MinMaxCurveState.k_Scalar)
            {
                for (int i = 0; i < array2.Length; i++)
                {
                    ModuleUI.Label(rect2, array[i]);
                    float a = ModuleUI.FloatDraggable(rect2, array2[i].scalar, array2[i].m_RemapValue, 10f);
                    if (!array2[i].signedRange)
                    {
                        array2[i].scalar.floatValue = Mathf.Max(a, 0f);
                    }
                    rect2.x += num2 + 4f;
                }
            }
            else if (state == MinMaxCurveState.k_TwoScalars)
            {
                for (int j = 0; j < array2.Length; j++)
                {
                    ModuleUI.Label(rect2, array[j]);
                    float num3 = array2[j].minConstant;
                    float num4 = array2[j].maxConstant;
                    EditorGUI.BeginChangeCheck();
                    num4 = ModuleUI.FloatDraggable(rect2, num4, array2[j].m_RemapValue, 10f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        array2[j].maxConstant = num4;
                    }
                    rect2.y += 13f;
                    EditorGUI.BeginChangeCheck();
                    num3 = ModuleUI.FloatDraggable(rect2, num3, array2[j].m_RemapValue, 10f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        array2[j].minConstant = num3;
                    }
                    rect2.x += num2 + 4f;
                    rect2.y -= 13f;
                }
            }
            else
            {
                rect2.width = num2;
                Rect ranges = (!xCurve.signedRange) ? ModuleUI.kUnsignedRange : ModuleUI.kSignedRange;
                for (int k = 0; k < array2.Length; k++)
                {
                    ModuleUI.Label(rect2, array[k]);
                    Rect position = rect2;
                    position.xMin += 10f;
                    SerializedProperty minCurve = (state != MinMaxCurveState.k_TwoCurves) ? null : array2[k].minCurve;
                    ModuleUI.GUICurveField(position, array2[k].maxCurve, minCurve, ModuleUI.GetColor(array2[k]), ranges, new ModuleUI.CurveFieldMouseDownCallback(array2[k].OnCurveAreaMouseDown));
                    rect2.x += num2 + 4f;
                }
            }
            ModuleUI.GUIMMCurveStateList(popupRect, array2);
        }
Пример #4
0
        public void GUITripleMinMaxCurve(GUIContent label, GUIContent x, SerializedMinMaxCurve xCurve, GUIContent y, SerializedMinMaxCurve yCurve, GUIContent z, SerializedMinMaxCurve zCurve, SerializedProperty randomizePerFrame)
        {
            MinMaxCurveState state = xCurve.state;
            bool             flag  = label != GUIContent.none;
            int num1 = !flag ? 1 : 2;

            if (state == MinMaxCurveState.k_TwoScalars)
            {
                ++num1;
            }
            Rect  controlRect   = ModuleUI.GetControlRect(13 * num1);
            Rect  popupRect     = ModuleUI.GetPopupRect(controlRect);
            Rect  totalPosition = ModuleUI.SubtractPopupWidth(controlRect);
            Rect  rect          = totalPosition;
            float num2          = (float)(((double)totalPosition.width - 8.0) / 3.0);

            if (num1 > 1)
            {
                rect.height = 13f;
            }
            if (flag)
            {
                ModuleUI.PrefixLabel(totalPosition, label);
                rect.y += rect.height;
            }
            rect.width = num2;
            GUIContent[] guiContentArray = new GUIContent[3] {
                x, y, z
            };
            SerializedMinMaxCurve[] minMaxCurves = new SerializedMinMaxCurve[3] {
                xCurve, yCurve, zCurve
            };
            if (state == MinMaxCurveState.k_Scalar)
            {
                for (int index = 0; index < minMaxCurves.Length; ++index)
                {
                    ModuleUI.Label(rect, guiContentArray[index]);
                    float a = ModuleUI.FloatDraggable(rect, minMaxCurves[index].scalar, minMaxCurves[index].m_RemapValue, 10f);
                    if (!minMaxCurves[index].signedRange)
                    {
                        minMaxCurves[index].scalar.floatValue = Mathf.Max(a, 0.0f);
                    }
                    rect.x += num2 + 4f;
                }
            }
            else if (state == MinMaxCurveState.k_TwoScalars)
            {
                for (int index = 0; index < minMaxCurves.Length; ++index)
                {
                    ModuleUI.Label(rect, guiContentArray[index]);
                    float minConstant = minMaxCurves[index].minConstant;
                    float maxConstant = minMaxCurves[index].maxConstant;
                    EditorGUI.BeginChangeCheck();
                    float num3 = ModuleUI.FloatDraggable(rect, maxConstant, minMaxCurves[index].m_RemapValue, 10f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        minMaxCurves[index].maxConstant = num3;
                    }
                    rect.y += 13f;
                    EditorGUI.BeginChangeCheck();
                    float num4 = ModuleUI.FloatDraggable(rect, minConstant, minMaxCurves[index].m_RemapValue, 10f, "g5");
                    if (EditorGUI.EndChangeCheck())
                    {
                        minMaxCurves[index].minConstant = num4;
                    }
                    rect.x += num2 + 4f;
                    rect.y -= 13f;
                }
            }
            else
            {
                rect.width = num2;
                Rect ranges = !xCurve.signedRange ? ModuleUI.kUnsignedRange : ModuleUI.kSignedRange;
                for (int index = 0; index < minMaxCurves.Length; ++index)
                {
                    ModuleUI.Label(rect, guiContentArray[index]);
                    Rect position = rect;
                    position.xMin += 10f;
                    SerializedProperty minCurve = state != MinMaxCurveState.k_TwoCurves ? (SerializedProperty)null : minMaxCurves[index].minCurve;
                    ModuleUI.GUICurveField(position, minMaxCurves[index].maxCurve, minCurve, ModuleUI.GetColor(minMaxCurves[index]), ranges, new ModuleUI.CurveFieldMouseDownCallback(minMaxCurves[index].OnCurveAreaMouseDown));
                    rect.x += num2 + 4f;
                }
            }
            ModuleUI.GUIMMCurveStateList(popupRect, minMaxCurves);
        }