Пример #1
0
        public override void OnGUI(GUIContent label)
        {
            base.OnGUI(label);
            ICZType c = Value as ICZType;

            c.SetValue(EditorGUILayoutExtension.DrawField(label, c.ValueType, c.GetValue()));
        }
Пример #2
0
        public void AddFieldView(string _name, ICZType _data)
        {
            BlackboardField blackboardField = new BlackboardField()
            {
                text = _name, typeText = _data.ValueType.Name, userData = _data
            };

            blackboardField.RegisterCallback <MouseEnterEvent>(evt =>
            {
                GraphView.nodes.ForEach(node =>
                {
                    if (node is ParameterNodeView parameterNodeView && parameterNodeView.T_Model.Name == blackboardField.text)
                    {
                        parameterNodeView.HighlightOn();
                    }
                });
            });

            blackboardField.RegisterCallback <MouseLeaveEvent>(evt =>
            {
                GraphView.nodes.ForEach(node =>
                {
                    if (node is ParameterNodeView parameterNodeView && parameterNodeView.T_Model.Name == blackboardField.text)
                    {
                        parameterNodeView.HighlightOff();
                    }
                });
            });
            BindableElement fieldDrawer = UIElementsFactory.CreateField("", _data.ValueType, _data.GetValue(), _newValue =>
            {
                _data.SetValue(_newValue);
                if (_data.GetValue() != null)
                {
                    blackboardField.typeText = _data.ValueType.Name;
                }
            });
            BlackboardRow blackboardRow = new BlackboardRow(blackboardField, fieldDrawer);

            contentContainer.Add(blackboardRow);
            fields[_name] = blackboardRow;
        }