示例#1
0
        public void IsValid_With_Incorrect_String()
        {
            object intObj  = 2;
            var    rngattr = new CustomRangeAttribute(3, 10);

            Assert.IsFalse(rngattr.IsValid(intObj));
        }
示例#2
0
        public void IsValid_With_Null_Int()
        {
            object nullObj = null;
            var    rngattr = new CustomRangeAttribute(3, 10);

            Assert.IsTrue(rngattr.IsValid(nullObj));
        }
示例#3
0
        public void IsValid_With_Correct_Value()
        {
            object intObj  = 8;
            var    rngattr = new CustomRangeAttribute(3, 10);

            Assert.IsTrue(rngattr.IsValid(intObj));
        }
示例#4
0
 public override bool Equals(object obj) {
     CustomRangeAttribute cra = obj as CustomRangeAttribute;
     if (cra == null) {
         return false;
     }
     return this.special.Equals(cra.special) &&  base.Equals(obj);
 }
    public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
    {
        CustomRangeAttribute rangAttr = (CustomRangeAttribute)attribute;

        if (property.propertyType == SerializedPropertyType.Float)
        {
            EditorGUI.Slider(position, property, rangAttr.min, rangAttr.max, label);
        }
    }