FloatDraggable() private static method

private static FloatDraggable ( Rect rect, UnityEditor.SerializedProperty floatProp, float remap, float dragWidth ) : float
rect UnityEngine.Rect
floatProp UnityEditor.SerializedProperty
remap float
dragWidth float
return float
示例#1
0
        public static float GUIFloat(GUIContent guiContent, SerializedProperty floatProp, string formatString, params GUILayoutOption[] layoutOptions)
        {
            Rect controlRect = ModuleUI.GetControlRect(13, layoutOptions);

            ModuleUI.PrefixLabel(controlRect, guiContent);
            return(ModuleUI.FloatDraggable(controlRect, floatProp, 1f, EditorGUIUtility.labelWidth, formatString));
        }
示例#2
0
        private void DrawBurstListElementCallback(Rect rect, int index, bool isActive, bool isFocused)
        {
            SerializedProperty arrayElementAtIndex = this.m_Bursts.GetArrayElementAtIndex(index);
            SerializedProperty floatProp           = arrayElementAtIndex.FindPropertyRelative("time");
            SerializedProperty serializedProperty  = arrayElementAtIndex.FindPropertyRelative("cycleCount");
            SerializedProperty floatProp2          = arrayElementAtIndex.FindPropertyRelative("repeatInterval");

            rect.width -= 45f;
            rect.width /= 4f;
            ModuleUI.FloatDraggable(rect, floatProp, 1f, 15f, "n3");
            rect.x     += rect.width;
            rect        = ModuleUI.GUIMinMaxCurveInline(rect, this.m_BurstCountCurves[index], 15f);
            rect.x     += rect.width;
            rect.width -= 13f;
            if (!serializedProperty.hasMultipleDifferentValues && serializedProperty.intValue == 0)
            {
                rect.x     += 15f;
                rect.width -= 15f;
                EditorGUI.LabelField(rect, EmissionModuleUI.s_Texts.burstCycleCountInfinite, ParticleSystemStyles.Get().label);
            }
            else
            {
                ModuleUI.IntDraggable(rect, null, serializedProperty, 15f);
            }
            rect.width += 13f;
            Rect popupRect = ModuleUI.GetPopupRect(rect);

            EmissionModuleUI.GUIMMModePopUp(popupRect, serializedProperty);
            rect.x += rect.width;
            ModuleUI.FloatDraggable(rect, floatProp2, 1f, 15f, "n3");
            rect.x += rect.width;
        }
示例#3
0
        public static float GUIFloat(GUIContent guiContent, float floatValue, string formatString)
        {
            Rect controlRect = ModuleUI.GetControlRect(13);

            ModuleUI.PrefixLabel(controlRect, guiContent);
            return(ModuleUI.FloatDraggable(controlRect, floatValue, 1f, EditorGUIUtility.labelWidth, formatString));
        }
示例#4
0
        public static Vector3 GUIVector3Field(GUIContent guiContent, SerializedProperty vecProp)
        {
            Rect rect = ModuleUI.GetControlRect(13);

            rect = ModuleUI.PrefixLabel(rect, guiContent);
            GUIContent[] array = new GUIContent[]
            {
                new GUIContent("X"),
                new GUIContent("Y"),
                new GUIContent("Z")
            };
            float num = (rect.width - 8f) / 3f;

            rect.width = num;
            Vector3 vector3Value = vecProp.vector3Value;

            for (int i = 0; i < 3; i++)
            {
                ModuleUI.Label(rect, array[i]);
                vector3Value[i] = ModuleUI.FloatDraggable(rect, vector3Value[i], 1f, 25f, "g5");
                rect.x         += num + 4f;
            }
            vecProp.vector3Value = vector3Value;
            return(vector3Value);
        }
示例#5
0
        public static float FloatDraggable(Rect rect, SerializedProperty floatProp, float remap, float dragWidth, string formatString)
        {
            float floatValue = floatProp.floatValue;
            float num        = ModuleUI.FloatDraggable(rect, floatValue, remap, dragWidth, formatString);

            if (num != floatValue)
            {
                floatProp.floatValue = num;
            }
            return(num);
        }
示例#6
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);
        }
示例#7
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);
        }
示例#8
0
        public static void GUIToggleWithFloatField(GUIContent guiContent, SerializedProperty boolProp, SerializedProperty floatProp)
        {
            Rect rect = GUILayoutUtility.GetRect(0f, 13f);

            rect = ModuleUI.PrefixLabel(rect, guiContent);
            bool flag = ModuleUI.Toggle(rect, boolProp);

            if (flag)
            {
                float dragWidth = 25f;
                Rect  rect2     = new Rect(rect.x + EditorGUIUtility.labelWidth + 9f, rect.y, rect.width - 9f, rect.height);
                ModuleUI.FloatDraggable(rect2, floatProp, 1f, dragWidth);
            }
        }
示例#9
0
        public static void GUIToggleWithFloatField(GUIContent guiContent, SerializedProperty boolProp, SerializedProperty floatProp, bool invertToggle)
        {
            Rect rect1 = ModuleUI.PrefixLabel(GUILayoutUtility.GetRect(0.0f, 13f), guiContent);
            Rect rect2 = rect1;

            rect2.xMax = rect2.x + 9f;
            bool flag = ModuleUI.Toggle(rect2, boolProp);

            if (!(!invertToggle ? flag : !flag))
            {
                return;
            }
            float  dragWidth = 25f;
            double num       = (double)ModuleUI.FloatDraggable(new Rect((float)((double)rect1.x + (double)EditorGUIUtility.labelWidth + 9.0), rect1.y, rect1.width - 9f, rect1.height), floatProp, 1f, dragWidth);
        }
示例#10
0
        public static void GUIMinMaxRange(GUIContent label, SerializedProperty vec2Prop)
        {
            Rect    rect         = ModuleUI.PrefixLabel(ModuleUI.SubtractPopupWidth(ModuleUI.GetControlRect(13)), label);
            float   num          = (float)(((double)rect.width - 20.0) * 0.5);
            Vector2 vector2Value = vec2Prop.vector2Value;

            rect.width            = num;
            rect.xMin            -= 20f;
            vector2Value.x        = ModuleUI.FloatDraggable(rect, vector2Value.x, 1f, 20f, "g7");
            vector2Value.x        = Mathf.Clamp(vector2Value.x, 0.0f, vector2Value.y - 0.01f);
            rect.x               += num + 20f;
            vector2Value.y        = ModuleUI.FloatDraggable(rect, vector2Value.y, 1f, 20f, "g7");
            vector2Value.y        = Mathf.Max(vector2Value.x + 0.01f, vector2Value.y);
            vec2Prop.vector2Value = vector2Value;
        }
示例#11
0
        public static float FloatDraggable(Rect rect, SerializedProperty floatProp, float remap, float dragWidth, string formatString)
        {
            Color color = GUI.color;

            if (floatProp.isAnimated)
            {
                GUI.color = AnimationMode.animatedPropertyColor;
            }
            float floatValue = floatProp.floatValue;
            float num        = ModuleUI.FloatDraggable(rect, floatValue, remap, dragWidth, formatString);

            if (num != floatValue)
            {
                floatProp.floatValue = num;
            }
            GUI.color = color;
            return(num);
        }
示例#12
0
        public static void GUIToggleWithFloatField(GUIContent guiContent, SerializedProperty boolProp, SerializedProperty floatProp, bool invertToggle, params GUILayoutOption[] layoutOptions)
        {
            Rect rect = GUILayoutUtility.GetRect(0f, 13f, layoutOptions);

            rect = ModuleUI.PrefixLabel(rect, guiContent);
            Rect rect2 = rect;

            rect2.xMax = rect2.x + 9f;
            bool flag = ModuleUI.Toggle(rect2, boolProp);

            flag = ((!invertToggle) ? flag : (!flag));
            if (flag)
            {
                float dragWidth = 25f;
                Rect  rect3     = new Rect(rect.x + EditorGUIUtility.labelWidth + 9f, rect.y, rect.width - 9f, rect.height);
                ModuleUI.FloatDraggable(rect3, floatProp, 1f, dragWidth);
            }
        }
示例#13
0
        public static void GUIMinMaxRange(GUIContent label, SerializedProperty vec2Prop, params GUILayoutOption[] layoutOptions)
        {
            Rect rect = ModuleUI.GetControlRect(13, layoutOptions);

            rect = ModuleUI.SubtractPopupWidth(rect);
            rect = ModuleUI.PrefixLabel(rect, label);
            float   num          = (rect.width - 20f) * 0.5f;
            Vector2 vector2Value = vec2Prop.vector2Value;

            rect.width            = num;
            rect.xMin            -= 20f;
            vector2Value.x        = ModuleUI.FloatDraggable(rect, vector2Value.x, 1f, 20f, "g7");
            vector2Value.x        = Mathf.Clamp(vector2Value.x, 0f, vector2Value.y - 0.01f);
            rect.x               += num + 20f;
            vector2Value.y        = ModuleUI.FloatDraggable(rect, vector2Value.y, 1f, 20f, "g7");
            vector2Value.y        = Mathf.Max(vector2Value.x + 0.01f, vector2Value.y);
            vec2Prop.vector2Value = vector2Value;
        }
示例#14
0
        public static Vector3 GUIVector3Field(GUIContent guiContent, SerializedProperty vecProp)
        {
            Rect rect = ModuleUI.PrefixLabel(ModuleUI.GetControlRect(13), guiContent);

            GUIContent[] guiContentArray = new GUIContent[3] {
                new GUIContent("X"), new GUIContent("Y"), new GUIContent("Z")
            };
            float num = (float)(((double)rect.width - 8.0) / 3.0);

            rect.width = num;
            Vector3 vector3Value = vecProp.vector3Value;

            for (int index = 0; index < 3; ++index)
            {
                ModuleUI.Label(rect, guiContentArray[index]);
                vector3Value[index] = ModuleUI.FloatDraggable(rect, vector3Value[index], 1f, 25f, "g5");
                rect.x += num + 4f;
            }
            vecProp.vector3Value = vector3Value;
            return(vector3Value);
        }
示例#15
0
 private static float FloatDraggable(Rect rect, SerializedProperty floatProp, float remap, float dragWidth)
 {
     return(ModuleUI.FloatDraggable(rect, floatProp, remap, dragWidth, "g7"));
 }
示例#16
0
        private void DoBurstGUI(ParticleSystem s)
        {
            EditorGUILayout.Space();
            Rect controlRect = ModuleUI.GetControlRect(13);

            GUI.Label(controlRect, s_Texts.burst, ParticleSystemStyles.Get().label);
            float dragWidth = 20f;
            float num2      = 40f;
            float width     = (((num2 + dragWidth) * 2f) + dragWidth) - 1f;
            float a         = controlRect.width - width;

            a = Mathf.Min(a, EditorGUIUtility.labelWidth);
            int  intValue = this.m_BurstCount.intValue;
            Rect position = new Rect(controlRect.x + a, controlRect.y, width, 3f);

            GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().line);
            Rect rect3 = new Rect((controlRect.x + dragWidth) + a, controlRect.y, num2 + dragWidth, controlRect.height);

            GUI.Label(rect3, "Time", ParticleSystemStyles.Get().label);
            rect3.x += dragWidth + num2;
            GUI.Label(rect3, "Particles", ParticleSystemStyles.Get().label);
            position.y += 12f;
            GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().line);
            float duration = s.duration;
            int   num7     = intValue;

            for (int i = 0; i < intValue; i++)
            {
                SerializedProperty floatProp = this.m_BurstTime[i];
                SerializedProperty property2 = this.m_BurstParticleCount[i];
                controlRect = ModuleUI.GetControlRect(13);
                rect3       = new Rect(controlRect.x + a, controlRect.y, dragWidth + num2, controlRect.height);
                float num9 = ModuleUI.FloatDraggable(rect3, floatProp, 1f, dragWidth, "n2");
                if (num9 < 0f)
                {
                    floatProp.floatValue = 0f;
                }
                if (num9 > duration)
                {
                    floatProp.floatValue = duration;
                }
                int num10 = property2.intValue;
                rect3.x           += rect3.width;
                property2.intValue = ModuleUI.IntDraggable(rect3, null, num10, dragWidth);
                if (i == (intValue - 1))
                {
                    rect3.x = position.xMax - 12f;
                    if (ModuleUI.MinusButton(rect3))
                    {
                        intValue--;
                    }
                }
            }
            if (intValue < 4)
            {
                rect3      = ModuleUI.GetControlRect(13);
                rect3.xMin = rect3.xMax - 12f;
                if (ModuleUI.PlusButton(rect3))
                {
                    intValue++;
                }
            }
            if (intValue != num7)
            {
                this.m_BurstCount.intValue = intValue;
            }
        }
示例#17
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);
        }
示例#18
0
        private void DoBurstGUI(ParticleSystem s)
        {
            EditorGUILayout.Space();
            Rect controlRect = ModuleUI.GetControlRect(13);

            GUI.Label(controlRect, EmissionModuleUI.s_Texts.burst, ParticleSystemStyles.Get().label);
            float num  = 20f;
            float num2 = 40f;
            float num3 = (num2 + num) * 3f + num - 1f;
            float num4 = controlRect.width - num3;

            num4 = Mathf.Min(num4, EditorGUIUtility.labelWidth);
            int  num5     = this.m_BurstCount.intValue;
            Rect position = new Rect(controlRect.x + num4, controlRect.y, num3, 3f);

            GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().line);
            Rect controlRect2 = new Rect(controlRect.x + num + num4, controlRect.y, num2 + num, controlRect.height);

            GUI.Label(controlRect2, "Time", ParticleSystemStyles.Get().label);
            controlRect2.x += num + num2;
            GUI.Label(controlRect2, "Min", ParticleSystemStyles.Get().label);
            controlRect2.x += num + num2;
            GUI.Label(controlRect2, "Max", ParticleSystemStyles.Get().label);
            position.y += 12f;
            GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().line);
            float duration = s.duration;
            int   num6     = num5;

            for (int i = 0; i < num5; i++)
            {
                SerializedProperty serializedProperty  = this.m_BurstTime[i];
                SerializedProperty serializedProperty2 = this.m_BurstParticleMinCount[i];
                SerializedProperty serializedProperty3 = this.m_BurstParticleMaxCount[i];
                controlRect  = ModuleUI.GetControlRect(13);
                controlRect2 = new Rect(controlRect.x + num4, controlRect.y, num + num2, controlRect.height);
                float num7 = ModuleUI.FloatDraggable(controlRect2, serializedProperty, 1f, num, "n2");
                if (num7 < 0f)
                {
                    serializedProperty.floatValue = 0f;
                }
                if (num7 > duration)
                {
                    serializedProperty.floatValue = duration;
                }
                int intValue  = serializedProperty2.intValue;
                int intValue2 = serializedProperty3.intValue;
                controlRect2.x += controlRect2.width;
                serializedProperty2.intValue = ModuleUI.IntDraggable(controlRect2, null, intValue, num);
                controlRect2.x += controlRect2.width;
                serializedProperty3.intValue = ModuleUI.IntDraggable(controlRect2, null, intValue2, num);
                if (i == num5 - 1)
                {
                    controlRect2.x = position.xMax - 12f;
                    if (ModuleUI.MinusButton(controlRect2))
                    {
                        num5--;
                    }
                }
            }
            if (num5 < 4)
            {
                controlRect2      = ModuleUI.GetControlRect(13);
                controlRect2.xMin = controlRect2.xMax - 12f;
                if (ModuleUI.PlusButton(controlRect2))
                {
                    num5++;
                }
            }
            if (num5 != num6)
            {
                this.m_BurstCount.intValue = num5;
            }
        }
示例#19
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);
        }
示例#20
0
        private void DoBurstGUI(ParticleSystem s)
        {
            EditorGUILayout.Space();
            Rect controlRect1 = ModuleUI.GetControlRect(13);

            GUI.Label(controlRect1, EmissionModuleUI.s_Texts.burst, ParticleSystemStyles.Get().label);
            float dragWidth = 20f;
            float num1      = 40f;
            float width     = (float)(((double)num1 + (double)dragWidth) * 3.0 + (double)dragWidth - 1.0);
            float num2      = Mathf.Min(controlRect1.width - width, EditorGUIUtility.labelWidth);
            int   intValue1 = this.m_BurstCount.intValue;
            Rect  position  = new Rect(controlRect1.x + num2, controlRect1.y, width, 3f);

            GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().line);
            Rect rect = new Rect(controlRect1.x + dragWidth + num2, controlRect1.y, num1 + dragWidth, controlRect1.height);

            GUI.Label(rect, "Time", ParticleSystemStyles.Get().label);
            rect.x += dragWidth + num1;
            GUI.Label(rect, "Min", ParticleSystemStyles.Get().label);
            rect.x += dragWidth + num1;
            GUI.Label(rect, "Max", ParticleSystemStyles.Get().label);
            position.y += 12f;
            GUI.Label(position, GUIContent.none, ParticleSystemStyles.Get().line);
            float duration = s.duration;
            int   num3     = intValue1;

            for (int index = 0; index < intValue1; ++index)
            {
                SerializedProperty floatProp           = this.m_BurstTime[index];
                SerializedProperty serializedProperty1 = this.m_BurstParticleMinCount[index];
                SerializedProperty serializedProperty2 = this.m_BurstParticleMaxCount[index];
                Rect controlRect2 = ModuleUI.GetControlRect(13);
                rect = new Rect(controlRect2.x + num2, controlRect2.y, dragWidth + num1, controlRect2.height);
                float num4 = ModuleUI.FloatDraggable(rect, floatProp, 1f, dragWidth, "n2");
                if ((double)num4 < 0.0)
                {
                    floatProp.floatValue = 0.0f;
                }
                if ((double)num4 > (double)duration)
                {
                    floatProp.floatValue = duration;
                }
                int intValue2 = serializedProperty1.intValue;
                int intValue3 = serializedProperty2.intValue;
                rect.x += rect.width;
                serializedProperty1.intValue = ModuleUI.IntDraggable(rect, (GUIContent)null, intValue2, dragWidth);
                rect.x += rect.width;
                serializedProperty2.intValue = ModuleUI.IntDraggable(rect, (GUIContent)null, intValue3, dragWidth);
                if (index == intValue1 - 1)
                {
                    rect.x = position.xMax - 12f;
                    if (ModuleUI.MinusButton(rect))
                    {
                        --intValue1;
                    }
                }
            }
            if (intValue1 < 4)
            {
                rect      = ModuleUI.GetControlRect(13);
                rect.xMin = rect.xMax - 12f;
                if (ModuleUI.PlusButton(rect))
                {
                    ++intValue1;
                }
            }
            if (intValue1 == num3)
            {
                return;
            }
            this.m_BurstCount.intValue = intValue1;
        }