示例#1
0
            public EditorFloatSliderField(string label, float value, float min, float max, EventCallback <ChangeEvent <float> > callback)
            {
                slider       = new Slider(label, min, max, SliderDirection.Horizontal);
                slider.name  = nameof(slider);
                slider.value = value;
                labelElement.StylePadding(0, 8, 0, 0);
                Add(slider);

                floatField      = new FloatField();
                floatField.name = nameof(floatField);
                floatField.StyleWidth(64);
                floatField.style.paddingLeft = 4;
                floatField.style.marginRight = 0;
                floatField.value             = value;
                floatField.RegisterValueChangedCallback(callback);
                floatField.RegisterValueChangedCallback((callbackChangedSlider) =>
                {
                    slider.value = callbackChangedSlider.newValue;
                });
                slider.Add(floatField);

                slider.RegisterValueChangedCallback((callbackSlide) =>
                {
                    floatField.value = callbackSlide.newValue;
                });
            }