Beispiel #1
0
        public override void OnInspectorGUI(ParticleSystem s)
        {
            EditorGUI.BeginChangeCheck();
            bool flag = ModuleUI.GUIToggle(ClampVelocityModuleUI.s_Texts.separateAxes, this.m_SeparateAxes, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                if (flag)
                {
                    this.m_Magnitude.RemoveCurveFromEditor();
                }
                else
                {
                    this.m_X.RemoveCurveFromEditor();
                    this.m_Y.RemoveCurveFromEditor();
                    this.m_Z.RemoveCurveFromEditor();
                }
            }
            SerializedMinMaxCurve arg_88_0 = this.m_Z;
            MinMaxCurveState      state    = this.m_X.state;

            this.m_Y.state = state;
            arg_88_0.state = state;
            if (flag)
            {
                base.GUITripleMinMaxCurve(GUIContent.none, ClampVelocityModuleUI.s_Texts.x, this.m_X, ClampVelocityModuleUI.s_Texts.y, this.m_Y, ClampVelocityModuleUI.s_Texts.z, this.m_Z, null, new GUILayoutOption[0]);
                ModuleUI.GUIBoolAsPopup(ClampVelocityModuleUI.s_Texts.space, this.m_InWorldSpace, ClampVelocityModuleUI.s_Texts.spaces, new GUILayoutOption[0]);
            }
            else
            {
                ModuleUI.GUIMinMaxCurve(ClampVelocityModuleUI.s_Texts.magnitude, this.m_Magnitude, new GUILayoutOption[0]);
            }
            ModuleUI.GUIFloat(ClampVelocityModuleUI.s_Texts.dampen, this.m_Dampen, new GUILayoutOption[0]);
        }
Beispiel #2
0
        public override void OnInspectorGUI(InitialModuleUI initial)
        {
            EditorGUI.BeginChangeCheck();
            bool flag = ModuleUI.GUIToggle(RotationByVelocityModuleUI.s_Texts.separateAxes, this.m_SeparateAxes, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                if (!flag)
                {
                    this.m_X.RemoveCurveFromEditor();
                    this.m_Y.RemoveCurveFromEditor();
                }
            }
            if (!this.m_Z.stateHasMultipleDifferentValues)
            {
                this.m_X.SetMinMaxState(this.m_Z.state, flag);
                this.m_Y.SetMinMaxState(this.m_Z.state, flag);
            }
            MinMaxCurveState state = this.m_Z.state;

            if (flag)
            {
                this.m_Z.m_DisplayName = RotationByVelocityModuleUI.s_Texts.z;
                base.GUITripleMinMaxCurve(GUIContent.none, RotationByVelocityModuleUI.s_Texts.x, this.m_X, RotationByVelocityModuleUI.s_Texts.y, this.m_Y, RotationByVelocityModuleUI.s_Texts.z, this.m_Z, null, new GUILayoutOption[0]);
            }
            else
            {
                this.m_Z.m_DisplayName = RotationByVelocityModuleUI.s_Texts.rotation;
                ModuleUI.GUIMinMaxCurve(RotationByVelocityModuleUI.s_Texts.rotation, this.m_Z, new GUILayoutOption[0]);
            }
            using (new EditorGUI.DisabledScope(state == MinMaxCurveState.k_Scalar || state == MinMaxCurveState.k_TwoScalars))
            {
                ModuleUI.GUIMinMaxRange(RotationByVelocityModuleUI.s_Texts.velocityRange, this.m_Range, new GUILayoutOption[0]);
            }
        }
Beispiel #3
0
        public static void GUIMMCurveStateList(Rect rect, SerializedMinMaxCurve[] minMaxCurves)
        {
            if (!EditorGUI.ButtonMouseDown(rect, GUIContent.none, FocusType.Passive, ParticleSystemStyles.Get().minMaxCurveStateDropDown) || minMaxCurves.Length == 0)
            {
                return;
            }
            GUIContent[] guiContentArray = new GUIContent[4] {
                new GUIContent("Constant"), new GUIContent("Curve"), new GUIContent("Random Between Two Constants"), new GUIContent("Random Between Two Curves")
            };
            MinMaxCurveState[] minMaxCurveStateArray = new MinMaxCurveState[4] {
                MinMaxCurveState.k_Scalar, MinMaxCurveState.k_Curve, MinMaxCurveState.k_TwoScalars, MinMaxCurveState.k_TwoCurves
            };
            bool[] flagArray = new bool[4] {
                (minMaxCurves[0].m_AllowConstant ? 1 : 0) != 0, (minMaxCurves[0].m_AllowCurves ? 1 : 0) != 0, (minMaxCurves[0].m_AllowRandom ? 1 : 0) != 0, (!minMaxCurves[0].m_AllowRandom ? 0 : (minMaxCurves[0].m_AllowCurves ? 1 : 0)) != 0
            };
            GenericMenu genericMenu = new GenericMenu();

            for (int index = 0; index < guiContentArray.Length; ++index)
            {
                if (flagArray[index])
                {
                    genericMenu.AddItem(guiContentArray[index], minMaxCurves[0].state == minMaxCurveStateArray[index], new GenericMenu.MenuFunction2(ModuleUI.SelectMinMaxCurveStateCallback), (object)new ModuleUI.CurveStateCallbackData(minMaxCurveStateArray[index], minMaxCurves));
                }
            }
            genericMenu.DropDown(rect);
            Event.current.Use();
        }
 private void InitSingleScalar(MinMaxCurveState oldState)
 {
     if (oldState == MinMaxCurveState.k_Curve || oldState == MinMaxCurveState.k_TwoCurves || oldState == MinMaxCurveState.k_TwoScalars)
     {
         float maxKeyValue = this.GetMaxKeyValue(this.maxCurve.animationCurveValue.keys);
         this.scalar.floatValue *= maxKeyValue;
     }
     this.SetCurveConstant(this.maxCurve, 1f);
 }
Beispiel #5
0
 private void InitSingleCurve(MinMaxCurveState oldState)
 {
     switch (oldState)
     {
     case MinMaxCurveState.k_Scalar:
         this.SetCurveConstant(this.maxCurve, this.GetNormalizedValueFromScalar());
         break;
     }
     this.SetCurveRequirements();
 }
Beispiel #6
0
        public static void GUIMinMaxCurve(GUIContent label, SerializedMinMaxCurve mmCurve)
        {
            Rect controlRect = GetControlRect(13);
            Rect popupRect   = GetPopupRect(controlRect);

            controlRect = SubtractPopupWidth(controlRect);
            Rect             position = PrefixLabel(controlRect, label);
            MinMaxCurveState state    = mmCurve.state;

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

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

            default:
            {
                Rect ranges = !mmCurve.signedRange ? kUnsignedRange : kSignedRange;
                SerializedProperty minCurve = (state != MinMaxCurveState.k_TwoCurves) ? null : mmCurve.minCurve;
                GUICurveField(position, mmCurve.maxCurve, minCurve, GetColor(mmCurve), ranges, new CurveFieldMouseDownCallback(mmCurve.OnCurveAreaMouseDown));
                break;
            }
            }
            GUIMMCurveStateList(popupRect, mmCurve);
        }
        public void SetMinMaxState(MinMaxCurveState newState, bool addToCurveEditor = true)
        {
            if (!this.stateHasMultipleDifferentValues)
            {
                if (newState == this.state)
                {
                    return;
                }
            }
            MinMaxCurveState          state = this.state;
            ParticleSystemCurveEditor particleSystemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();

            if (particleSystemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
            {
                particleSystemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
            }
            switch (newState)
            {
            case MinMaxCurveState.k_Scalar:
                this.InitSingleScalar(state);
                break;

            case MinMaxCurveState.k_Curve:
                this.InitSingleCurve(state);
                break;

            case MinMaxCurveState.k_TwoCurves:
                this.InitDoubleCurves(state);
                break;

            case MinMaxCurveState.k_TwoScalars:
                this.InitDoubleScalars(state);
                break;
            }
            this.minMaxState.intValue = (int)newState;
            if (addToCurveEditor)
            {
                switch (newState)
                {
                case MinMaxCurveState.k_Scalar:
                case MinMaxCurveState.k_TwoScalars:
                    break;

                case MinMaxCurveState.k_Curve:
                case MinMaxCurveState.k_TwoCurves:
                    particleSystemCurveEditor.AddCurve(this.CreateCurveData(particleSystemCurveEditor.GetAvailableColor()));
                    break;

                default:
                    Debug.LogError("Unhandled enum value");
                    break;
                }
            }
            AnimationCurvePreviewCache.ClearCache();
        }
Beispiel #8
0
        public override void OnInspectorGUI(InitialModuleUI initial)
        {
            MinMaxCurveState state = this.m_X.state;

            base.GUITripleMinMaxCurve(GUIContent.none, ForceModuleUI.s_Texts.x, this.m_X, ForceModuleUI.s_Texts.y, this.m_Y, ForceModuleUI.s_Texts.z, this.m_Z, this.m_RandomizePerFrame, new GUILayoutOption[0]);
            ModuleUI.GUIBoolAsPopup(ForceModuleUI.s_Texts.space, this.m_InWorldSpace, ForceModuleUI.s_Texts.spaces, new GUILayoutOption[0]);
            using (new EditorGUI.DisabledScope(state != MinMaxCurveState.k_TwoScalars && state != MinMaxCurveState.k_TwoCurves))
            {
                ModuleUI.GUIToggle(ForceModuleUI.s_Texts.randomizePerFrame, this.m_RandomizePerFrame, new GUILayoutOption[0]);
            }
        }
 private void InitSingleScalar(MinMaxCurveState oldState)
 {
     switch (oldState)
     {
     case MinMaxCurveState.k_Curve:
     case MinMaxCurveState.k_TwoCurves:
     case MinMaxCurveState.k_TwoScalars:
         this.scalar.floatValue *= this.GetMaxKeyValue(this.maxCurve.animationCurveValue.keys);
         break;
     }
     this.SetCurveConstant(this.maxCurve, 1f);
 }
        override public void OnInspectorGUI(InitialModuleUI initial)
        {
            MinMaxCurveState state = m_X.state;

            GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, m_X, s_Texts.y, m_Y, s_Texts.z, m_Z, m_RandomizePerFrame);

            GUIBoolAsPopup(s_Texts.space, m_InWorldSpace, s_Texts.spaces);

            using (new EditorGUI.DisabledScope((state != MinMaxCurveState.k_TwoScalars) && (state != MinMaxCurveState.k_TwoCurves)))
            {
                GUIToggle(s_Texts.randomizePerFrame, m_RandomizePerFrame);
            }
        }
 private void InitSingleCurve(MinMaxCurveState oldState)
 {
     if (oldState != MinMaxCurveState.k_Scalar)
     {
         if (oldState != MinMaxCurveState.k_TwoScalars && oldState != MinMaxCurveState.k_TwoCurves)
         {
         }
     }
     else
     {
         this.SetCurveConstant(this.maxCurve, this.GetNormalizedValueFromScalar());
     }
     this.SetCurveRequirements();
 }
Beispiel #12
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);
        }
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (ForceModuleUI.s_Texts == null)
            {
                ForceModuleUI.s_Texts = new ForceModuleUI.Texts();
            }
            MinMaxCurveState state = this.m_X.state;

            this.GUITripleMinMaxCurve(GUIContent.none, ForceModuleUI.s_Texts.x, this.m_X, ForceModuleUI.s_Texts.y, this.m_Y, ForceModuleUI.s_Texts.z, this.m_Z, this.m_RandomizePerFrame);
            ModuleUI.GUIBoolAsPopup(ForceModuleUI.s_Texts.space, this.m_InWorldSpace, ForceModuleUI.s_Texts.spaces);
            EditorGUI.BeginDisabledGroup(state != MinMaxCurveState.k_TwoScalars && state != MinMaxCurveState.k_TwoCurves);
            ModuleUI.GUIToggle(ForceModuleUI.s_Texts.randomizePerFrame, this.m_RandomizePerFrame);
            EditorGUI.EndDisabledGroup();
        }
Beispiel #14
0
        public void SetMinMaxState(MinMaxCurveState newState, bool addToCurveEditor)
        {
            if (newState == state)
            {
                return;
            }

            MinMaxCurveState          oldState = state;
            ParticleSystemCurveEditor sce      = m_Module.GetParticleSystemCurveEditor();

            if (sce.IsAdded(GetMinCurve(), maxCurve))
            {
                sce.RemoveCurve(GetMinCurve(), maxCurve);
            }

            switch (newState)
            {
            case MinMaxCurveState.k_Curve: SetCurveRequirements(); break;

            case MinMaxCurveState.k_TwoCurves: SetCurveRequirements(); break;
            }

            // Assign state AFTER matching data to new state AND removing curve from curveEditor since it uses current 'state'
            minMaxState.intValue = (int)newState;

            if (addToCurveEditor)
            {
                // Add curve to CurveEditor if needed
                // Keep added to the editor if it was added before
                switch (newState)
                {
                case MinMaxCurveState.k_TwoCurves:
                case MinMaxCurveState.k_Curve:
                    sce.AddCurve(CreateCurveData(sce.GetAvailableColor()));
                    break;

                case MinMaxCurveState.k_Scalar:
                case MinMaxCurveState.k_TwoScalars:
                    // Scalar do not add anything to the curve editor
                    break;

                default:
                    Debug.LogError("Unhandled enum value");
                    break;
                }
            }

            // Ensure we draw new icons for properties
            UnityEditorInternal.AnimationCurvePreviewCache.ClearCache();
        }
 private void InitDoubleCurves(MinMaxCurveState oldState)
 {
     if (oldState != MinMaxCurveState.k_Scalar)
     {
         if ((oldState != MinMaxCurveState.k_TwoScalars) && (oldState == MinMaxCurveState.k_Curve))
         {
         }
     }
     else
     {
         this.SetCurveConstant(this.maxCurve, this.GetNormalizedValueFromScalar());
     }
     this.SetCurveRequirements();
 }
Beispiel #16
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);
        }
        private void SetMinMaxState(MinMaxCurveState newState)
        {
            if (newState == this.state)
            {
                return;
            }
            MinMaxCurveState          state             = this.state;
            ParticleSystemCurveEditor systemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();

            if (systemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
            {
                systemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
            }
            switch (newState)
            {
            case MinMaxCurveState.k_Scalar:
                this.InitSingleScalar(state);
                break;

            case MinMaxCurveState.k_Curve:
                this.InitSingleCurve(state);
                break;

            case MinMaxCurveState.k_TwoCurves:
                this.InitDoubleCurves(state);
                break;

            case MinMaxCurveState.k_TwoScalars:
                this.InitDoubleScalars(state);
                break;
            }
            this.minMaxState.intValue = (int)newState;
            switch (newState)
            {
            case MinMaxCurveState.k_Scalar:
            case MinMaxCurveState.k_TwoScalars:
                AnimationCurvePreviewCache.ClearCache();
                break;

            case MinMaxCurveState.k_Curve:
            case MinMaxCurveState.k_TwoCurves:
                systemCurveEditor.AddCurve(this.CreateCurveData(systemCurveEditor.GetAvailableColor()));
                goto case MinMaxCurveState.k_Scalar;

            default:
                Debug.LogError((object)"Unhandled enum value");
                goto case MinMaxCurveState.k_Scalar;
            }
        }
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (s_Texts == null)
            {
                s_Texts = new Texts();
            }
            MinMaxCurveState state = this.m_X.state;

            base.GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, this.m_X, s_Texts.y, this.m_Y, s_Texts.z, this.m_Z, this.m_RandomizePerFrame, new GUILayoutOption[0]);
            ModuleUI.GUIBoolAsPopup(s_Texts.space, this.m_InWorldSpace, s_Texts.spaces, new GUILayoutOption[0]);
            using (new EditorGUI.DisabledScope((state != MinMaxCurveState.k_TwoScalars) && (state != MinMaxCurveState.k_TwoCurves)))
            {
                ModuleUI.GUIToggle(s_Texts.randomizePerFrame, this.m_RandomizePerFrame, new GUILayoutOption[0]);
            }
        }
        public void SetMinMaxState(MinMaxCurveState newState, bool addToCurveEditor)
        {
            if (this.stateHasMultipleDifferentValues)
            {
                Debug.LogError("SetMinMaxState is not allowed with multiple different values");
            }
            else if (newState != this.state)
            {
                MinMaxCurveState          state = this.state;
                ParticleSystemCurveEditor particleSystemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();
                if (particleSystemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
                {
                    particleSystemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
                }
                if (newState != MinMaxCurveState.k_Curve)
                {
                    if (newState == MinMaxCurveState.k_TwoCurves)
                    {
                        this.SetCurveRequirements();
                    }
                }
                else
                {
                    this.SetCurveRequirements();
                }
                this.minMaxState.intValue = (int)newState;
                if (addToCurveEditor)
                {
                    switch (newState)
                    {
                    case MinMaxCurveState.k_Scalar:
                    case MinMaxCurveState.k_TwoScalars:
                        break;

                    case MinMaxCurveState.k_Curve:
                    case MinMaxCurveState.k_TwoCurves:
                        particleSystemCurveEditor.AddCurve(this.CreateCurveData(particleSystemCurveEditor.GetAvailableColor()));
                        break;

                    default:
                        Debug.LogError("Unhandled enum value");
                        break;
                    }
                }
                AnimationCurvePreviewCache.ClearCache();
            }
        }
Beispiel #20
0
 public static void GUIMMCurveStateList(Rect rect, SerializedMinMaxCurve[] minMaxCurves)
 {
     if (EditorGUI.ButtonMouseDown(rect, GUIContent.none, FocusType.Passive, ParticleSystemStyles.Get().minMaxCurveStateDropDown))
     {
         if (minMaxCurves.Length != 0)
         {
             GUIContent[] array = new GUIContent[]
             {
                 new GUIContent("Constant"),
                 new GUIContent("Curve"),
                 new GUIContent("Random Between Two Constants"),
                 new GUIContent("Random Between Two Curves")
             };
             MinMaxCurveState[] array2 = new MinMaxCurveState[]
             {
                 MinMaxCurveState.k_Scalar,
                 MinMaxCurveState.k_Curve,
                 MinMaxCurveState.k_TwoScalars,
                 MinMaxCurveState.k_TwoCurves
             };
             bool[] array3 = new bool[]
             {
                 minMaxCurves[0].m_AllowConstant,
                 minMaxCurves[0].m_AllowCurves,
                 minMaxCurves[0].m_AllowRandom,
                 minMaxCurves[0].m_AllowRandom && minMaxCurves[0].m_AllowCurves
             };
             GenericMenu genericMenu = new GenericMenu();
             for (int i = 0; i < array.Length; i++)
             {
                 if (array3[i])
                 {
                     GenericMenu arg_10C_0 = genericMenu;
                     GUIContent  arg_10C_1 = array[i];
                     bool        arg_10C_2 = minMaxCurves[0].state == array2[i];
                     if (ModuleUI.< > f__mg$cache0 == null)
                     {
                         ModuleUI.< > f__mg$cache0 = new GenericMenu.MenuFunction2(ModuleUI.SelectMinMaxCurveStateCallback);
                     }
                     arg_10C_0.AddItem(arg_10C_1, arg_10C_2, ModuleUI.< > f__mg$cache0, new ModuleUI.CurveStateCallbackData(array2[i], minMaxCurves));
                 }
             }
             genericMenu.DropDown(rect);
             Event.current.Use();
         }
     }
 }
Beispiel #21
0
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (SizeByVelocityModuleUI.s_Texts == null)
            {
                SizeByVelocityModuleUI.s_Texts = new SizeByVelocityModuleUI.Texts();
            }
            EditorGUI.BeginChangeCheck();
            bool flag = ModuleUI.GUIToggle(SizeByVelocityModuleUI.s_Texts.separateAxes, this.m_SeparateAxes, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                if (flag)
                {
                    this.m_X.RemoveCurveFromEditor();
                }
                else
                {
                    this.m_X.RemoveCurveFromEditor();
                    this.m_Y.RemoveCurveFromEditor();
                    this.m_Z.RemoveCurveFromEditor();
                }
            }
            SerializedMinMaxCurve arg_9C_0 = this.m_Z;
            MinMaxCurveState      state    = this.m_X.state;

            this.m_Y.state = state;
            arg_9C_0.state = state;
            MinMaxCurveState state2 = this.m_Z.state;

            if (flag)
            {
                this.m_X.m_DisplayName = SizeByVelocityModuleUI.s_Texts.x;
                base.GUITripleMinMaxCurve(GUIContent.none, SizeByVelocityModuleUI.s_Texts.x, this.m_X, SizeByVelocityModuleUI.s_Texts.y, this.m_Y, SizeByVelocityModuleUI.s_Texts.z, this.m_Z, null, new GUILayoutOption[0]);
            }
            else
            {
                this.m_X.m_DisplayName = SizeByVelocityModuleUI.s_Texts.size;
                ModuleUI.GUIMinMaxCurve(SizeByVelocityModuleUI.s_Texts.size, this.m_X, new GUILayoutOption[0]);
            }
            using (new EditorGUI.DisabledScope(state2 == MinMaxCurveState.k_Scalar || state2 == MinMaxCurveState.k_TwoScalars))
            {
                ModuleUI.GUIMinMaxRange(SizeByVelocityModuleUI.s_Texts.velocityRange, this.m_Range, new GUILayoutOption[0]);
            }
        }
Beispiel #22
0
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (s_Texts == null)
            {
                s_Texts = new Texts();
            }
            EditorGUI.BeginChangeCheck();
            bool flag = ModuleUI.GUIToggle(s_Texts.separateAxes, this.m_SeparateAxes, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                if (flag)
                {
                    this.m_Z.RemoveCurveFromEditor();
                }
                else
                {
                    this.m_X.RemoveCurveFromEditor();
                    this.m_Y.RemoveCurveFromEditor();
                    this.m_Z.RemoveCurveFromEditor();
                }
            }
            MinMaxCurveState state = this.m_Z.state;

            this.m_Y.state = state;
            this.m_X.state = state;
            MinMaxCurveState state2 = this.m_Z.state;

            if (flag)
            {
                this.m_Z.m_DisplayName = s_Texts.z;
                base.GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, this.m_X, s_Texts.y, this.m_Y, s_Texts.z, this.m_Z, null, new GUILayoutOption[0]);
            }
            else
            {
                this.m_Z.m_DisplayName = s_Texts.rotation;
                ModuleUI.GUIMinMaxCurve(s_Texts.rotation, this.m_Z, new GUILayoutOption[0]);
            }
            using (new EditorGUI.DisabledScope((state2 == MinMaxCurveState.k_Scalar) || (state2 == MinMaxCurveState.k_TwoScalars)))
            {
                ModuleUI.GUIMinMaxRange(s_Texts.velocityRange, this.m_Range, new GUILayoutOption[0]);
            }
        }
        private void InitDoubleScalars(MinMaxCurveState oldState)
        {
            this.minConstant = this.GetAverageKeyValue(this.minCurve.animationCurveValue.keys) * this.scalar.floatValue;
            switch (oldState)
            {
            case MinMaxCurveState.k_Scalar:
                this.maxConstant = this.scalar.floatValue;
                break;

            case MinMaxCurveState.k_Curve:
            case MinMaxCurveState.k_TwoCurves:
                this.maxConstant = this.GetAverageKeyValue(this.maxCurve.animationCurveValue.keys) * this.scalar.floatValue;
                break;

            default:
                Debug.LogError("Enum not handled!");
                break;
            }
            this.SetCurveRequirements();
        }
        override public void OnInspectorGUI(InitialModuleUI initial)
        {
            EditorGUI.BeginChangeCheck();
            bool separateAxes = GUIToggle(s_Texts.separateAxes, m_SeparateAxes);

            if (EditorGUI.EndChangeCheck())
            {
                // Remove old curves from curve editor
                if (!separateAxes)
                {
                    m_Y.RemoveCurveFromEditor();
                    m_Z.RemoveCurveFromEditor();
                }
            }

            // Keep states in sync
            if (!m_X.stateHasMultipleDifferentValues)
            {
                m_Z.SetMinMaxState(m_X.state, separateAxes);
                m_Y.SetMinMaxState(m_X.state, separateAxes);
            }

            MinMaxCurveState state = m_Z.state;

            if (separateAxes)
            {
                m_X.m_DisplayName = s_Texts.x;
                GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, m_X, s_Texts.y, m_Y, s_Texts.z, m_Z, null);
            }
            else
            {
                m_X.m_DisplayName = s_Texts.size;
                GUIMinMaxCurve(s_Texts.size, m_X);
            }

            using (new EditorGUI.DisabledScope((state == MinMaxCurveState.k_Scalar) || (state == MinMaxCurveState.k_TwoScalars)))
            {
                GUIMinMaxRange(s_Texts.velocityRange, m_Range);
            }
        }
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (RotationModuleUI.s_Texts == null)
            {
                RotationModuleUI.s_Texts = new RotationModuleUI.Texts();
            }
            EditorGUI.BeginChangeCheck();
            bool flag = ModuleUI.GUIToggle(RotationModuleUI.s_Texts.separateAxes, this.m_SeparateAxes, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                if (flag)
                {
                    this.m_Z.RemoveCurveFromEditor();
                }
                else
                {
                    this.m_X.RemoveCurveFromEditor();
                    this.m_Y.RemoveCurveFromEditor();
                    this.m_Z.RemoveCurveFromEditor();
                }
            }
            SerializedMinMaxCurve arg_9C_0 = this.m_X;
            MinMaxCurveState      state    = this.m_Z.state;

            this.m_Y.state = state;
            arg_9C_0.state = state;
            if (flag)
            {
                this.m_Z.m_DisplayName = RotationModuleUI.s_Texts.z;
                base.GUITripleMinMaxCurve(GUIContent.none, RotationModuleUI.s_Texts.x, this.m_X, RotationModuleUI.s_Texts.y, this.m_Y, RotationModuleUI.s_Texts.z, this.m_Z, null, new GUILayoutOption[0]);
            }
            else
            {
                this.m_Z.m_DisplayName = RotationModuleUI.s_Texts.rotation;
                ModuleUI.GUIMinMaxCurve(RotationModuleUI.s_Texts.rotation, this.m_Z, new GUILayoutOption[0]);
            }
        }
Beispiel #26
0
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (SizeModuleUI.s_Texts == null)
            {
                SizeModuleUI.s_Texts = new SizeModuleUI.Texts();
            }
            EditorGUI.BeginChangeCheck();
            bool flag = ModuleUI.GUIToggle(SizeModuleUI.s_Texts.separateAxes, this.m_SeparateAxes);

            if (EditorGUI.EndChangeCheck())
            {
                if (flag)
                {
                    this.m_X.RemoveCurveFromEditor();
                }
                else
                {
                    this.m_X.RemoveCurveFromEditor();
                    this.m_Y.RemoveCurveFromEditor();
                    this.m_Z.RemoveCurveFromEditor();
                }
            }
            SerializedMinMaxCurve arg_8F_0 = this.m_Z;
            MinMaxCurveState      state    = this.m_X.state;

            this.m_Y.state = state;
            arg_8F_0.state = state;
            if (flag)
            {
                this.m_X.m_DisplayName = SizeModuleUI.s_Texts.x;
                base.GUITripleMinMaxCurve(GUIContent.none, SizeModuleUI.s_Texts.x, this.m_X, SizeModuleUI.s_Texts.y, this.m_Y, SizeModuleUI.s_Texts.z, this.m_Z, null);
            }
            else
            {
                this.m_X.m_DisplayName = SizeModuleUI.s_Texts.size;
                ModuleUI.GUIMinMaxCurve(SizeModuleUI.s_Texts.size, this.m_X);
            }
        }
Beispiel #27
0
 public static void GUIMMCurveStateList(Rect rect, SerializedMinMaxCurve[] minMaxCurves)
 {
     if (EditorGUI.ButtonMouseDown(rect, GUIContent.none, FocusType.Passive, ParticleSystemStyles.Get().minMaxCurveStateDropDown) && (minMaxCurves.Length != 0))
     {
         GUIContent[]       contentArray = new GUIContent[] { new GUIContent("Constant"), new GUIContent("Curve"), new GUIContent("Random Between Two Constants"), new GUIContent("Random Between Two Curves") };
         MinMaxCurveState[] stateArray1  = new MinMaxCurveState[4];
         stateArray1[1] = MinMaxCurveState.k_Curve;
         stateArray1[2] = MinMaxCurveState.k_TwoScalars;
         stateArray1[3] = MinMaxCurveState.k_TwoCurves;
         MinMaxCurveState[] stateArray = stateArray1;
         bool[]             flagArray  = new bool[] { minMaxCurves[0].m_AllowConstant, true, minMaxCurves[0].m_AllowRandom, minMaxCurves[0].m_AllowRandom };
         GenericMenu        menu       = new GenericMenu();
         for (int i = 0; i < contentArray.Length; i++)
         {
             if (flagArray[i])
             {
                 menu.AddItem(contentArray[i], minMaxCurves[0].state == stateArray[i], new GenericMenu.MenuFunction2(ModuleUI.SelectMinMaxCurveStateCallback), new CurveStateCallbackData(stateArray[i], minMaxCurves));
             }
         }
         menu.DropDown(rect);
         Event.current.Use();
     }
 }
Beispiel #28
0
        public override void OnInspectorGUI(ParticleSystem s)
        {
            if (s_Texts == null)
            {
                s_Texts = new Texts();
            }
            EditorGUI.BeginChangeCheck();
            bool flag = ModuleUI.GUIToggle(s_Texts.separateAxes, this.m_SeparateAxes, new GUILayoutOption[0]);

            if (EditorGUI.EndChangeCheck())
            {
                if (flag)
                {
                    this.m_X.RemoveCurveFromEditor();
                }
                else
                {
                    this.m_X.RemoveCurveFromEditor();
                    this.m_Y.RemoveCurveFromEditor();
                    this.m_Z.RemoveCurveFromEditor();
                }
            }
            MinMaxCurveState state = this.m_X.state;

            this.m_Y.state = state;
            this.m_Z.state = state;
            if (flag)
            {
                this.m_X.m_DisplayName = s_Texts.x;
                base.GUITripleMinMaxCurve(GUIContent.none, s_Texts.x, this.m_X, s_Texts.y, this.m_Y, s_Texts.z, this.m_Z, null, new GUILayoutOption[0]);
            }
            else
            {
                this.m_X.m_DisplayName = s_Texts.size;
                ModuleUI.GUIMinMaxCurve(s_Texts.size, this.m_X, new GUILayoutOption[0]);
            }
        }
 public CurveStateCallbackData(MinMaxCurveState state, SerializedMinMaxCurve[] curves)
 {
   this.minMaxCurves = curves;
   this.selectedState = state;
 }
 public static void GUIMMCurveStateList(Rect rect, SerializedMinMaxCurve[] minMaxCurves)
 {
   if (!EditorGUI.ButtonMouseDown(rect, GUIContent.none, FocusType.Passive, ParticleSystemStyles.Get().minMaxCurveStateDropDown) || minMaxCurves.Length == 0)
     return;
   GUIContent[] guiContentArray = new GUIContent[4]{ new GUIContent("Constant"), new GUIContent("Curve"), new GUIContent("Random Between Two Constants"), new GUIContent("Random Between Two Curves") };
   MinMaxCurveState[] minMaxCurveStateArray = new MinMaxCurveState[4]{ MinMaxCurveState.k_Scalar, MinMaxCurveState.k_Curve, MinMaxCurveState.k_TwoScalars, MinMaxCurveState.k_TwoCurves };
   bool[] flagArray = new bool[4]{ (minMaxCurves[0].m_AllowConstant ? 1 : 0) != 0, (minMaxCurves[0].m_AllowCurves ? 1 : 0) != 0, (minMaxCurves[0].m_AllowRandom ? 1 : 0) != 0, (!minMaxCurves[0].m_AllowRandom ? 0 : (minMaxCurves[0].m_AllowCurves ? 1 : 0)) != 0 };
   GenericMenu genericMenu = new GenericMenu();
   for (int index = 0; index < guiContentArray.Length; ++index)
   {
     if (flagArray[index])
       genericMenu.AddItem(guiContentArray[index], minMaxCurves[0].state == minMaxCurveStateArray[index], new GenericMenu.MenuFunction2(ModuleUI.SelectMinMaxCurveStateCallback), (object) new ModuleUI.CurveStateCallbackData(minMaxCurveStateArray[index], minMaxCurves));
   }
   genericMenu.DropDown(rect);
   Event.current.Use();
 }
Beispiel #31
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);
        }
Beispiel #32
0
 public CurveStateCallbackData(MinMaxCurveState state, SerializedMinMaxCurve[] curves)
 {
     this.minMaxCurves  = curves;
     this.selectedState = state;
 }
Beispiel #33
0
		public static void GUIMMCurveStateList(Rect rect, SerializedMinMaxCurve[] minMaxCurves)
		{
			if (EditorGUI.ButtonMouseDown(rect, GUIContent.none, FocusType.Passive, ParticleSystemStyles.Get().minMaxCurveStateDropDown))
			{
				if (minMaxCurves.Length == 0)
				{
					return;
				}
				GUIContent[] array = new GUIContent[]
				{
					new GUIContent("Constant"),
					new GUIContent("Curve"),
					new GUIContent("Random Between Two Constants"),
					new GUIContent("Random Between Two Curves")
				};
				MinMaxCurveState[] array2 = new MinMaxCurveState[]
				{
					MinMaxCurveState.k_Scalar,
					MinMaxCurveState.k_Curve,
					MinMaxCurveState.k_TwoScalars,
					MinMaxCurveState.k_TwoCurves
				};
				bool[] array3 = new bool[]
				{
					minMaxCurves[0].m_AllowConstant,
					true,
					minMaxCurves[0].m_AllowRandom,
					minMaxCurves[0].m_AllowRandom
				};
				GenericMenu genericMenu = new GenericMenu();
				for (int i = 0; i < array.Length; i++)
				{
					if (array3[i])
					{
						genericMenu.AddItem(array[i], minMaxCurves[0].state == array2[i], new GenericMenu.MenuFunction2(ModuleUI.SelectMinMaxCurveStateCallback), new ModuleUI.CurveStateCallbackData(array2[i], minMaxCurves));
					}
				}
				genericMenu.DropDown(rect);
				Event.current.Use();
			}
		}
Beispiel #34
0
 public static void GUIMMCurveStateList(Rect rect, SerializedMinMaxCurve[] minMaxCurves)
 {
     if (EditorGUI.ButtonMouseDown(rect, GUIContent.none, FocusType.Passive, ParticleSystemStyles.Get().minMaxCurveStateDropDown) && (minMaxCurves.Length != 0))
     {
         GUIContent[] contentArray = new GUIContent[] { new GUIContent("Constant"), new GUIContent("Curve"), new GUIContent("Random Between Two Constants"), new GUIContent("Random Between Two Curves") };
         MinMaxCurveState[] stateArray1 = new MinMaxCurveState[4];
         stateArray1[1] = MinMaxCurveState.k_Curve;
         stateArray1[2] = MinMaxCurveState.k_TwoScalars;
         stateArray1[3] = MinMaxCurveState.k_TwoCurves;
         MinMaxCurveState[] stateArray = stateArray1;
         bool[] flagArray = new bool[] { minMaxCurves[0].m_AllowConstant, true, minMaxCurves[0].m_AllowRandom, minMaxCurves[0].m_AllowRandom };
         GenericMenu menu = new GenericMenu();
         for (int i = 0; i < contentArray.Length; i++)
         {
             if (flagArray[i])
             {
                 menu.AddItem(contentArray[i], minMaxCurves[0].state == stateArray[i], new GenericMenu.MenuFunction2(ModuleUI.SelectMinMaxCurveStateCallback), new CurveStateCallbackData(stateArray[i], minMaxCurves));
             }
         }
         menu.DropDown(rect);
         Event.current.Use();
     }
 }
 private void InitSingleScalar(MinMaxCurveState oldState)
 {
     if (((oldState == MinMaxCurveState.k_Curve) || (oldState == MinMaxCurveState.k_TwoCurves)) || (oldState == MinMaxCurveState.k_TwoScalars))
     {
         float maxKeyValue = this.GetMaxKeyValue(this.maxCurve.animationCurveValue.keys);
         this.scalar.floatValue *= maxKeyValue;
     }
     this.SetCurveConstant(this.maxCurve, 1f);
 }
        private void SetMinMaxState(MinMaxCurveState newState)
        {
            if (newState != this.state)
            {
                MinMaxCurveState oldState = this.state;
                ParticleSystemCurveEditor particleSystemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();
                if (particleSystemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
                {
                    particleSystemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
                }
                switch (newState)
                {
                    case MinMaxCurveState.k_Scalar:
                        this.InitSingleScalar(oldState);
                        break;

                    case MinMaxCurveState.k_Curve:
                        this.InitSingleCurve(oldState);
                        break;

                    case MinMaxCurveState.k_TwoCurves:
                        this.InitDoubleCurves(oldState);
                        break;

                    case MinMaxCurveState.k_TwoScalars:
                        this.InitDoubleScalars(oldState);
                        break;
                }
                this.minMaxState.intValue = (int) newState;
                switch (newState)
                {
                    case MinMaxCurveState.k_Scalar:
                    case MinMaxCurveState.k_TwoScalars:
                        break;

                    case MinMaxCurveState.k_Curve:
                    case MinMaxCurveState.k_TwoCurves:
                        particleSystemCurveEditor.AddCurve(this.CreateCurveData(particleSystemCurveEditor.GetAvailableColor()));
                        break;

                    default:
                        Debug.LogError("Unhandled enum value");
                        break;
                }
                AnimationCurvePreviewCache.ClearCache();
            }
        }
 private void InitSingleCurve(MinMaxCurveState oldState)
 {
     if (oldState != MinMaxCurveState.k_Scalar)
     {
         if ((oldState == MinMaxCurveState.k_TwoScalars) || (oldState == MinMaxCurveState.k_TwoCurves))
         {
         }
     }
     else
     {
         this.SetCurveConstant(this.maxCurve, this.GetNormalizedValueFromScalar());
     }
     this.SetCurveRequirements();
 }
        private void InitDoubleScalars(MinMaxCurveState oldState)
        {
            this.minConstant = this.GetAverageKeyValue(this.minCurve.animationCurveValue.keys) * this.scalar.floatValue;
            switch (oldState)
            {
                case MinMaxCurveState.k_Scalar:
                    this.maxConstant = this.scalar.floatValue;
                    break;

                case MinMaxCurveState.k_Curve:
                case MinMaxCurveState.k_TwoCurves:
                    this.maxConstant = this.GetAverageKeyValue(this.maxCurve.animationCurveValue.keys) * this.scalar.floatValue;
                    break;

                default:
                    Debug.LogError("Enum not handled!");
                    break;
            }
            this.SetCurveRequirements();
        }
 private void InitDoubleCurves(MinMaxCurveState oldState)
 {
   switch (oldState)
   {
     case MinMaxCurveState.k_Scalar:
       this.SetCurveConstant(this.maxCurve, this.GetNormalizedValueFromScalar());
       break;
   }
   this.SetCurveRequirements();
 }
 private void InitSingleScalar(MinMaxCurveState oldState)
 {
   switch (oldState)
   {
     case MinMaxCurveState.k_Curve:
     case MinMaxCurveState.k_TwoCurves:
     case MinMaxCurveState.k_TwoScalars:
       this.scalar.floatValue *= this.GetMaxKeyValue(this.maxCurve.animationCurveValue.keys);
       break;
   }
   this.SetCurveConstant(this.maxCurve, 1f);
 }
 private void SetMinMaxState(MinMaxCurveState newState)
 {
   if (newState == this.state)
     return;
   MinMaxCurveState state = this.state;
   ParticleSystemCurveEditor systemCurveEditor = this.m_Module.GetParticleSystemCurveEditor();
   if (systemCurveEditor.IsAdded(this.GetMinCurve(), this.maxCurve))
     systemCurveEditor.RemoveCurve(this.GetMinCurve(), this.maxCurve);
   switch (newState)
   {
     case MinMaxCurveState.k_Scalar:
       this.InitSingleScalar(state);
       break;
     case MinMaxCurveState.k_Curve:
       this.InitSingleCurve(state);
       break;
     case MinMaxCurveState.k_TwoCurves:
       this.InitDoubleCurves(state);
       break;
     case MinMaxCurveState.k_TwoScalars:
       this.InitDoubleScalars(state);
       break;
   }
   this.minMaxState.intValue = (int) newState;
   switch (newState)
   {
     case MinMaxCurveState.k_Scalar:
     case MinMaxCurveState.k_TwoScalars:
       AnimationCurvePreviewCache.ClearCache();
       break;
     case MinMaxCurveState.k_Curve:
     case MinMaxCurveState.k_TwoCurves:
       systemCurveEditor.AddCurve(this.CreateCurveData(systemCurveEditor.GetAvailableColor()));
       goto case MinMaxCurveState.k_Scalar;
     default:
       Debug.LogError((object) "Unhandled enum value");
       goto case MinMaxCurveState.k_Scalar;
   }
 }