Exemplo n.º 1
0
        public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
        {
            ExposeAttribute exposeAttribute = attribute as ExposeAttribute;

            if (property.propertyType == SerializedPropertyType.Generic)
            {
                if (ser_target == null)
                {
                    ser_target = property.FindPropertyRelative("target");
                }

                if (ser_target != null)
                {
                    if (exposeAttribute != null)
                    {
                        EditorGUIUtils.DrawProperty(position, ser_target, label);
                    }
                    else
                    {
                        Debug.LogError("Failed to assign the attribute.");
                    }
                }
                else
                {
                    Debug.LogWarning("Expose Attribute supports only Interface Reference fields. (Or fields with a sub-" + typeof(SerializedProperty).Name + " with name <i>target</i>");
                }
            }
            else
            {
                Debug.LogWarning("Serialized Property is not of Generic type.");
            }
        }
Exemplo n.º 2
0
            public void CorrectlySetsProperties()
            {
                var exposeAttribute = new ExposeAttribute("myProperty");

                Assert.AreEqual("myProperty", exposeAttribute.PropertyName);
                Assert.AreEqual("myProperty", exposeAttribute.PropertyNameOnModel);
                Assert.AreEqual(ViewModelToModelMode.TwoWay, exposeAttribute.Mode);
            }
Exemplo n.º 3
0
        private FieldInfo createFieldInfo(MemberInfo field)
        {
            string fieldName = field.Name;

            if (this.fieldNamingStrategy != null)
            {
                fieldName = this.fieldNamingStrategy.TranslateName(field);
            }

            SerializedNameAttribute annotationName = field.GetCustomAttribute <SerializedNameAttribute>();

            if (annotationName != null)
            {
                fieldName = annotationName.Name;
            }

            ExposeAttribute expose      = field.GetCustomAttribute <ExposeAttribute>();
            bool            serialize   = expose != null ? expose.Serialize : true;
            bool            deserialize = expose != null ? expose.Deserialize : true;
            Type            clazz       = field.DeclaringType;

            return(new _FieldInfo_153(field, clazz, fieldName, serialize, deserialize));
        }
Exemplo n.º 4
0
 public static MethodInfoNode Create(ExposeAttribute att, MethodInfo mi, AbstractNode parent)
 {
     return(new MethodInfoNode(parent, mi));
 }