void OnEnable()
        {
            _schema = target as VariableSchema;
            _proxy  = new DefinitionsProxy {
                Schema = _schema
            };
            _definitions = serializedObject.FindProperty("_definitions._items");

            _createPopup.Setup(_addDefinitionLabel, PopupCreate, PopupValidate);

            _list.Setup(_proxy)
            .MakeDrawable(DrawDefinition)
            .MakeRemovable(_removeDefinitionButton, RemoveDefinition)
            .MakeReorderable()
            .MakeHeaderButton(_addDefinitionButton, _createPopup, Color.white)
            .MakeCustomHeight(GetDefinitionHeight)
            .MakeEmptyLabel(_emptyLabel);
        }
Exemple #2
0
        public override void Setup(VariableSchema target, SerializedProperty property, FieldInfo fieldInfo, PropertyAttribute attribute)
        {
            _owner  = property.serializedObject.targetObject;
            _schema = target;
            _proxy  = new DefinitionsProxy {
                Schema = target
            };

            List.Setup(_proxy)
            .MakeDrawable(DrawDefinition)
            .MakeRemovable(_removeDefinitionButton, RemoveDefinition)
            .MakeCollapsable(property.serializedObject.targetObject.GetType().Name + "." + property.propertyPath + ".IsOpen")
            .MakeReorderable()
            .MakeHeaderButton(_addDefinitionButton, new AddPopup(new AddVariableContent(this), _addDefinitionLabel), Color.white)
            .MakeCustomHeight(GetDefinitionHeight)
            .MakeEmptyLabel(_emptyLabel);

            _type           = TypeHelper.GetAttribute <VariableInitializerAttribute>(fieldInfo)?.Type ?? VariableInitializerType.Expression;
            _availabilities = TypeHelper.GetAttribute <VariableAvailabilitiesAttribute>(fieldInfo)?.Availabilities;
        }