private void Init(SerializedProperty property) { _attributes = null; _modifiers = null; _visibleDrawer = null; _attributes = (from a in this.fieldInfo.GetCustomAttributes(typeof(PropertyAttribute), true) where !(a is ModifierChainAttribute) orderby(a as PropertyAttribute).order ascending select a as PropertyAttribute).ToArray(); var propDrawerTp = typeof(PropertyDrawer); var lst = new List <PropertyModifier>(); if (_attributes.Length > 0) { for (int i = 0; i < _attributes.Length - 1; i++) { var attrib = _attributes[i]; if (attrib is PropertyModifierAttribute) { var dtp = ScriptAttributeUtility.GetDrawerTypeForType(attrib.GetType()); if (TypeUtil.IsType(dtp, typeof(PropertyModifier))) { var drawer = PropertyDrawerActivator.Create(dtp) as PropertyModifier; if (drawer == null) { continue; } PropertyDrawerActivator.InitializePropertyDrawer(drawer, attrib, this.fieldInfo); drawer.Init(false); lst.Add(drawer); } } } _modifiers = lst.ToArray(); var lastAttrib = _attributes.Last(); var lastDrawerTp = ScriptAttributeUtility.GetDrawerTypeForType(lastAttrib.GetType()); if (TypeUtil.IsType(lastDrawerTp, typeof(PropertyDrawer))) { var drawer = PropertyDrawerActivator.Create(lastDrawerTp, lastAttrib, this.fieldInfo); if (drawer is PropertyModifier) { (drawer as PropertyModifier).Init(true); } _visibleDrawer = drawer; } } _initialized = true; }
internal void Init(bool bIsVisibleDrawer) { if (_initialized) { return; } if (bIsVisibleDrawer) { var drawerTp = ScriptAttributeUtility.GetDrawerTypeForType(this.fieldInfo.FieldType); if (drawerTp != null) { _subDrawer = PropertyDrawerActivator.Create(drawerTp, null, this.fieldInfo); } } _initialized = true; }