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

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

                sliderInt.RegisterValueChangedCallback((callbackSlide) =>
                {
                    integerField.value = callbackSlide.newValue;
                });
            }