Example #1
0
        private void RebuildSharedComponents(VisualElement container)
        {
            container.Clear();

            var header = new Label("Shared Components:");

            header.AddToClassList("header");
            container.Add(header);

            var element = new VisualElement();
            var so      = new SerializedObject(this.temp);
            var source  = so.FindProperty("sharedComponents");

            this.fieldsCacheSharedComponents.Clear();
            DataConfigEditor.BuildInspectorPropertiesElement("data",
                                                             this,
                                                             null,
                                                             source,
                                                             element,
                                                             noFields: false,
                                                             onBuild: (index, propElement) => {
                this.fieldsCacheSharedComponents.Add(index, propElement);
            });

            this.sharedComponentsDirty = true;

            container.Add(element);
        }
Example #2
0
        private void RebuildComponents(VisualElement container)
        {
            container.Clear();

            var header = new Label("Components:");

            header.AddToClassList("header");
            container.Add(header);

            var element = new VisualElement();
            var so      = new SerializedObject(this.temp);

            foreach (var fields in this.fieldsCacheComponents)
            {
                fields.Value.Unbind();
            }
            var source = so.FindProperty("components");

            this.fieldsCacheComponents.Clear();
            DataConfigEditor.BuildInspectorPropertiesElement("data",
                                                             this,
                                                             null,
                                                             source,
                                                             element,
                                                             noFields: false,
                                                             onBuild: (index, propElement) => {
                this.fieldsCacheComponents.Add(index, propElement);
            });

            /*
             * this.fieldsCacheComponents.Clear();
             * var prop = so.FindProperty("components");
             * for (int i = 0; i < prop.arraySize; ++i) {
             *
             *  var propField = prop.GetArrayElementAtIndex(i);
             *  var dataField = propField.FindPropertyRelative("data");
             *  var field = new PropertyField(dataField);
             *  field.BindProperty(dataField);
             *  element.Add(field);
             *  this.fieldsCacheComponents.Add(i, field);
             *
             * }*/

            this.componentsDirty = true;

            container.Add(element);
        }