Наследование: GraphItemViewModel
        protected override void CreateContent()
        {
            
            foreach (var item in GraphItem.GraphItems.OfType<GenericSlot>())
            {
                var vm = new InputOutputViewModel()
                {
                    Name = item.Name,
                    IsOutput = item is IActionOut,
                    IsInput = !(item is IActionOut),
                    DataObject = item,
                    IsNewLine = true,
                    DiagramViewModel = DiagramViewModel
                };
                ContentItems.Add(vm);
                if (vm.InputConnector != null)
                {
                    vm.InputConnector.Style = ConnectorStyle.Circle;
                    vm.InputConnector.TintColor = UnityEngine.Color.green;
                }

            }
           
            base.CreateContent();
        }
Пример #2
0
        private void AddOutput(NodeInputConfig inputConfig, GenericNode node = null)
        {
            if (!IsVisible(inputConfig.Visibility))
            {
                return;
            }
            var nodeToUse = node ?? GraphItem;
            var header    = new InputOutputViewModel();

            header.Name       = inputConfig.Name.GetValue(node);
            header.DataObject = inputConfig.IsAlias
                ? DataObject
                : inputConfig.GetDataObject(nodeToUse);
            header.OutputConnectorType = inputConfig.SourceType;
            header.IsInput             = false;
            header.IsOutput            = true;
            if (inputConfig.AttributeInfo != null)
            {
                header.IsNewLine = inputConfig.AttributeInfo.IsNewRow;
            }
            else
            {
                header.IsNewLine = true;
            }
            ContentItems.Add(header);
            ApplyOutputConfiguration(inputConfig, header.DataObject as IGraphItem, header.OutputConnector, true);
            if (header.InputConnector != null)
            {
                header.OutputConnector.Configuration = inputConfig;
            }
        }
 protected override void CreateContent()
 {
     base.CreateContent();
     if (IsVisible(SectionVisibility.WhenNodeIsNotFilter))
     {
         var propertySelection = new InputOutputViewModel()
         {
             DataObject = PropertyChangedNode.CollectionIn,
             Name = "Collection",
             IsInput = true,
             IsOutput = false,
             IsNewLine = true,
             AllowSelection = true
         };
         ContentItems.Add(propertySelection);
         AddPropertyFields();
     }
    
 }
        protected override void CreateContent()
        {
            var inputs = Handler.HandlerInputs;
            if (IsVisible(SectionVisibility.WhenNodeIsNotFilter))
            {

                //if (inputs.Length > 0)
                //    ContentItems.Add(new GenericItemHeaderViewModel()
                //    {
                //        Name = "Mappings",
                //        DiagramViewModel = DiagramViewModel,
                //        IsNewLine = true,
                //    });



                foreach (var item in inputs)
                {
                    var vm = new InputOutputViewModel()
                    {
                        DataObject = item,
                        Name = item.Title,
                        IsInput = true,
                        IsOutput = false,
                        IsNewLine = true,
                        AllowSelection = true
                    };
                    ContentItems.Add(vm);


                }
            }
            else
            {
                foreach (var handlerIn in inputs)
                {
                    var handlerItem = handlerIn.Item;
                    if (handlerItem != null)
                    {
                        foreach (var component in handlerItem.SelectComponents)
                        {
                            var component1 = component;

                            ContentItems.Add(new GenericItemHeaderViewModel()
                            {
                                Name = component.Name,
                                IsBig = true,
                                IsNewLine = true,
                                NodeViewModel = this,
                            });
                            //ContentItems.Add(new GenericItemHeaderViewModel()
                            //{
                            //    Name = component.Name,
                            //    DataObject = component,
                            //    IsNewLine = true
                            //});
                            ContentItems.Add(new GenericItemHeaderViewModel()
                            {
                                Name = "Properties",
                                IsNewLine = true,
                                NodeViewModel = this,
                                //DataObject = component,
                                AddCommand = new LambdaCommand("", () =>
                                {
                                    var item = new PropertiesChildItem() { Node = component1 };
                                    DiagramViewModel.CurrentRepository.Add(item);
                                    item.Name = item.Repository.GetUniqueName("Collection");
                                    item.IsEditing = true;
                                    DataObjectChanged();
                                })
                                
                            });
                            foreach (var property in component.Properties)
                            {
                                ContentItems.Add(new ScaffoldNodeTypedChildItem<PropertiesChildItem>.ViewModel(property,this));
                            }
                            
                            ContentItems.Add(new GenericItemHeaderViewModel()
                            {
                                Name = "Collections",
                                IsNewLine = true,
                                NodeViewModel = this,
                                //DataObject = component,
                                AddCommand = new LambdaCommand("", () =>
                                {
                                    var item = new CollectionsChildItem {Node = component1};
                                    DiagramViewModel.CurrentRepository.Add(item);
                                    item.Name = item.Repository.GetUniqueName("Collection");
                                    item.IsEditing = true;
                                    DataObjectChanged();
                                })

                            });
                            foreach (var property in component.Collections)
                            {
                                ContentItems.Add(new ScaffoldNodeTypedChildItem<CollectionsChildItem>.ViewModel(property, this));

                            }

                        }
                    }
                }
            }
            base.CreateContent();
        }
        protected virtual void CreateActionOuts()
        {
            foreach (var item in SequenceNode.GraphItems.OfType<IActionOut>())
            {
                var vm = new InputOutputViewModel()
                {
                    Name = item.Name,
                    DataObject = item,
                    IsOutput = true,
                    IsNewLine =
                        item.ActionFieldInfo == null || item.ActionFieldInfo.DisplayType == null
                            ? true
                            : item.ActionFieldInfo.DisplayType.IsNewLine,
                    DiagramViewModel = DiagramViewModel
                };
                ContentItems.Add(vm);

	            if (!(item is ActionBranch))
                {
                    vm.OutputConnector.Style = ConnectorStyle.Circle;
                    vm.OutputConnector.TintColor = UnityEngine.Color.green;
                }
            }
        }