/// <inheritdoc />
        protected override void DrawProperty(NonSerializedAttributeWrapper wrapper, SliderAttribute attribute)
        {
            var type = wrapper.Type;

            if (type == typeof(int))
            {
                wrapper.SetValue(EditorGUILayout.IntSlider((int)wrapper.GetValue(), (int)attribute.MinValue, (int)attribute.MaxValue));
            }
            else if (type == typeof(float))
            {
                wrapper.SetValue(EditorGUILayout.Slider((float)wrapper.GetValue(), attribute.MinValue, attribute.MaxValue));
            }
            else
            {
                NotIntFloat(wrapper);
            }
        }
Пример #2
0
        /// <inheritdoc />
        protected override void DrawProperty(NonSerializedAttributeWrapper wrapper, ShowAssetPreviewAttribute attribute)
        {
            if (!typeof(Object).IsAssignableFrom(wrapper.Type))
            {
                NotObject(wrapper);
                return;
            }

            wrapper.DrawDefaultField();

            DrawPreview((Object)wrapper.GetValue(), attribute);
        }
Пример #3
0
        /// <inheritdoc />
        protected override void DrawProperty(NonSerializedAttributeWrapper wrapper, ResizableTextAreaAttribute attribute)
        {
            if (wrapper.Type != typeof(string))
            {
                NotString(wrapper);
                return;
            }

            if (DrawField(wrapper.DisplayName, (string)wrapper.GetValue(), out var textAreaValue))
            {
                wrapper.SetValue(textAreaValue);
            }
        }
Пример #4
0
        /// <inheritdoc />
        protected override void DrawProperty(NonSerializedAttributeWrapper wrapper, ProgressBarAttribute attribute)
        {
            var type = wrapper.Type;

            if (type != typeof(float) && type != typeof(int))
            {
                NotIntFloat(wrapper);
                return;
            }

            var value = (float)wrapper.GetValue();

            this.DrawProgressBar(value, type == typeof(int), attribute);
        }
        /// <inheritdoc />
        protected override void DrawProperty(NonSerializedAttributeWrapper wrapper, MinMaxSliderAttribute attribute)
        {
            if (wrapper.Type != typeof(Vector2))
            {
                NotVector2Field(wrapper);
                return;
            }

            var sliderValue = (Vector2)wrapper.GetValue();

            if (this.DrawProperty(wrapper.DisplayName, ref sliderValue, attribute))
            {
                wrapper.SetValue(sliderValue);
            }
        }