internal void SetupFloatSlider(string label, EditValue edit, float sliderMin, float sliderMax,
                                       Action <float> func, PresetOperation[] presetOprs, float[] vals1, float[] vals2)
        {
            GUILayout.BeginHorizontal();
            GUILayout.Label(label, uiParams.lStyle, optItemHeight);
            GUILayout.Space(uiParams.marginL);

            var changed = false;

            Action <float> preset = (val) => {
                var cont = new GUIContent(val.ToString(CultureInfo.InvariantCulture));
                if (!GUILayout.Button(cont, bStyleSS, getWidthOpt(cont)))
                {
                    return;
                }

                edit.Set(val);
                changed = true;
            };

            if (vals1 != null)
            {
                foreach (var val in vals1)
                {
                    preset(val);
                }
            }

            if (vals2 != null)
            {
                foreach (var val in vals2)
                {
                    preset(val);
                }
            }

            if (presetOprs != null)
            {
                foreach (var pset in presetOprs)
                {
                    var cont = new GUIContent(pset.label);
                    if (!GUILayout.Button(cont, bStyleSS, getWidthOpt(cont)))
                    {
                        continue;
                    }

                    edit.SetWithCheck(pset.func(edit.val));
                    changed = true;
                }
            }

            GUILayout.EndHorizontal();

            if (changed || DrawValueSlider(null, edit, sliderMin, sliderMax))
            {
                func(edit.val);
            }
        }
Exemple #2
0
        // Token: 0x06000322 RID: 802 RVA: 0x000193A4 File Offset: 0x000175A4
        internal void SetupFloatSlider(string label, EditValue edit, float sliderMin, float sliderMax, Action <float> func, PresetOperation[] presetOprs, float[] vals1, float[] vals2)
        {
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            GUILayout.Label(label, this.uiParams.lStyle, new GUILayoutOption[]
            {
                this.optItemHeight
            });
            GUILayout.Space((float)this.uiParams.marginL);
            bool           changed = false;
            Action <float> action  = delegate(float val)
            {
                GUIContent guicontent2 = new GUIContent(val.ToString(CultureInfo.InvariantCulture));
                if (!GUILayout.Button(guicontent2, this.bStyleSS, new GUILayoutOption[]
                {
                    this.getWidthOpt(guicontent2)
                }))
                {
                    return;
                }
                edit.Set(val);
                changed = true;
            };

            if (vals1 != null)
            {
                foreach (float obj in vals1)
                {
                    action(obj);
                }
            }
            if (vals2 != null)
            {
                foreach (float obj2 in vals2)
                {
                    action(obj2);
                }
            }
            if (presetOprs != null)
            {
                foreach (PresetOperation presetOperation in presetOprs)
                {
                    GUIContent guicontent = new GUIContent(presetOperation.label);
                    if (GUILayout.Button(guicontent, this.bStyleSS, new GUILayoutOption[]
                    {
                        this.getWidthOpt(guicontent)
                    }))
                    {
                        edit.SetWithCheck(presetOperation.func(edit.val));
                        changed = true;
                    }
                }
            }
            GUILayout.EndHorizontal();
            if (changed || this.DrawValueSlider(null, edit, sliderMin, sliderMax))
            {
                func(edit.val);
            }
        }