Exemple #1
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);
        }
Exemple #2
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);
            }
        }
Exemple #3
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);
            }
        }
        /// <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);
            }
        }
 /// <inheritdoc />
 protected override void ValidateProperty(NonSerializedAttributeWrapper wrapper, ValidateInputAttribute attribute)
 {
     ValidateProperty(wrapper, attribute);
 }
Exemple #7
0
 /// <inheritdoc />
 protected override void ValidateProperty(NonSerializedAttributeWrapper wrapper, RequiredAttribute attribute)
 {
 }
Exemple #8
0
        /// <inheritdoc />
        public override void Run(NonSerializedAttributeWrapper wrapper, NaughtyAttribute attribute)
        {
            Assert.IsTrue(attribute is T);

            this.ValidateProperty(wrapper, (T)attribute);
        }
Exemple #9
0
 protected abstract void ValidateProperty(NonSerializedAttributeWrapper wrapper, T attribute);
 /// <inheritdoc />
 protected override void DrawProperty(NonSerializedAttributeWrapper wrapper, DropdownAttribute attribute)
 {
     this.DrawProperty(wrapper, attribute);
 }
 public abstract void Run(NonSerializedAttributeWrapper wrapper, NaughtyAttribute attribute);